Problem A. Astrological prediction

Input file:Standard input   Time limit:1 sec
Output file:Standard output   Memory limit:256 Mb

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.864s 0.033s 15