In this problem, we assume the positive integer with the following properties are called "the special number":
The special number is a non-negative integer without any leading zero.
The numbers in every digit of the special number is unique ,in decimal system.
Of course,it is easy to check whether one integer is a "the special number" or not, for instances, 1532 is the "the special number" and 101 is not. However, we just want to know the quantity of the special numbers that is less than N in this problem.
The input will consist of a series of signed integers which are not bigger than 10000000. one integer per line. (You may assume that there are no more than 20000 test cases)
For each case, output the quantity of the special numbers that is less than N in a single line.