Odometer

No attempts yetTime limit1sMemory limit128 MB

Problem

Farmer John's cows are on a road trip. The car odometer shows an integer mileage value, starting at XX (100X1016100 \le X \le 10^{16}) miles and ending at YY (XY1016X \le Y \le 10^{16}) miles. The cows moo whenever the odometer shows an interesting number, including at the start and end of the trip.

After ignoring leading zeros, look at the remaining digits. A number is interesting if exactly one digit differs and every other digit is the same. For example, 3332333323 and 110110 are interesting, while 97799779 and 5555555555 are not.

Count how many times the cows moo during the trip.

Input

  • Line 1: two integers XX and YY, separated by a space

Output

  • Line 1: the number of times the cows moo during the trip

Hint

An interesting number uses exactly two distinct digits, with one digit appearing once and the other digit filling the remaining positions. Values up to 101610^{16} fit in a 64-bit integer.