#D7668. Number

    ID: 6377 Type: Default 1000ms 268MiB

Number

Number

problem

AOR Ika-chan, who loves feasts, defined "the number of feasts". A feast number is a natural number that includes "513 51-3 " in 10 10 decimal notation. ?? Can be any number from 0 0 to 9 9 .

Find the number of feasts out of the natural numbers below N N .

input

N N

output

Output the number of feasts in one line. Also, output a line break at the end.

Example

Input

5124

Output

3

inputFormat

input

N N

outputFormat

output

Output the number of feasts in one line. Also, output a line break at the end.

Example

Input

5124

Output

3

样例

5124
3