The number of numbers without 8
Hard
Execution time limit is 1 second
Runtime memory usage limit is 64 megabytes
During long winter evenings, Lady entertains herself with numbers. She takes the numbers from 1 to n, crosses out any number that includes the digit 8, and counts how many numbers remain. Since n 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 1 to n that do not have the digit 8 in their representation.
Input
The input consists of a single line containing the integer n (1 ⩽ n ⩽ 10^18
).
Output
The output should be a single number representing the count of natural numbers from 1 to n that do not contain the digit 8 in their notation.
Examples
Input #1
Answer #1
Submissions 610
Acceptance rate 9%