Problem A. Astrological prediction

Author:Антон Карабанов   Time limit:1 sec
Input file:Standard input   Memory limit:256 Mb
Output file:Standard output  

Statement

Astrologer Timofey considers a year to be happy if different consecutive digits are used in its notation. For example, the nearest such year will occur in 2031. Determine, by the year number, how many years it will take for a happy year to come?

Input format

The input consists of a single line containing a natural number n — the year number.

Output format

Output a single non-negative integer — the answer to the problem.

Constraints

1 ≤ n ≤ 9876543210

Sample tests

No. Standard input Standard output
1
2023
8
2
2031
0

0.081s 0.007s 13