The Special Number#2769

The Special Number

2 seconds
64 megabytes
Easy

In this problem, we define a positive integer as a special number if it satisfies the following properties:

  1. It is a positive integer with no leading zeros.

  2. All of its digits are unique in the decimal system.

It is straightforward to determine whether an integer is a special number. For example, is a special number, but is not. In this problem, we want to find out how many special numbers are less than .

Input

The input consists of a series of positive integers, each not exceeding , with one integer per line (the number of test cases does not exceed ).

Output

For each test case, print the number of special numbers less than on a separate line.

Examples

Example 1

Loading
Loading