# The Special Number

Time Limit: 2000/1000 MS (Java/Others)

Memory Limit: 65535/32768 K (Java/Others)

## Description

In this problem, we assume the positive integer with the following properties are called ‘the special number’:
1) The special number is a non-negative integer without any leading zero.
2) 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 ‘special number’ or not, for instances, 1532 is 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.

## Input

The input will consist of a series of signed integers which are not bigger than 10,000,000. one integer per line. (You may assume that there are no more than 20000 test cases)

## Output

For each case, output the quantity of the special numbers that is less than N in a single line.

## Sample Input

10
12

## Sample Output

9
10

lcy

## Source

2011百校联动“菜鸟杯”程序设计公开赛