The number of numbers without 8#8688

The number of numbers without 8

1 second
64 megabytes
Hard

During long winter evenings, Lady entertains herself with numbers. She takes the numbers from to , crosses out any number that includes the digit , and counts how many numbers remain. Since can be quite large and Lady is feeling weary, she seeks your assistance. Your task is to write a program that calculates the number of natural numbers from to that do not have the digit in their representation.

Input

The input consists of a single line containing the integer (1 \leq n \leq 10^{18}).

Output

The output should be a single number representing the count of natural numbers from to that do not contain the digit in their notation.

Examples

Example 1

Loading
Loading