420. Number Permutations

Time limit per test: 0.75 second(s)
Memory limit: 262144 kilobytes
input: standard
output: standard



Two distinct positive integer numbers with decimal notations of the same length are called similar, if their decimal notations can be obtained from each other by permuting the digits.

How many numbers from the segment [l, r] have exactly one similar number in that segment?

Input
The input file contains two integer numbers l and r (1 ≤ lr ≤ 1015).

Output
Output one integer number — the sought amount.

Example(s)
sample input
sample output
10 99
72




Online Contester Team © 2002 - 2010. All rights reserved.