Let us define that a positive integer A is simpler than a
positive integer B if the decimal representation of A requires
less different digits than the decimal representation of B.

For example, number 55 is simpler than 12 which in turn is simpler than 123.

Your program will be given a number N and must find the largest integer X
such that X < N and X is simpler than N.

Input file format

Input file contains integer N.

Output file format

Output file must contain integer X.
If there is no integer simpler than N, output file must contain 0 (zero).