cswork / OAOpen practice workspace

MetaOA #29

Count 3 Sister Numbers

Estimated EasyJudge-ready

Topics (AI-labelled)Bits & Math

Count the three-digit integers in a closed range whose hundreds, tens, and ones digits are pairwise different. The 1..10⁹ constraint appended on the original site conflicts with the three-digit statement, so this site follows the explicit three-digit definition and limits the input range to 100..999.

Input

One line with left right (100≤left≤right≤999).

Output

Output the number of qualifying three-digit integers.

Example 1

Input:

876 890

Output:

3

Example 2

Input:

100 100

Output:

0

Example 3

Input:

102 102

Output:

1

Example notes

Example 1: only 876, 879, and 890 have three distinct digits, so the output is 3.

Example 2: the two 0s in 100 repeat, so the output is 0.

Example 3: the three digits of 102 are all different, so the output is 1.

Editorial

Loading solution…