Question
Unlucky Seven
Mahi hates the number 7.
We are interested in integers without the digit 7 in both decimal and octal. How many such integers are there between 1 and N (inclusive)?
We are interested in integers without the digit 7 in both decimal and octal. How many such integers are there between 1 and N (inclusive)?
Input
Input is given from Standard Input in the following format:
N
Constraints
1≤N≤10^5
N is an integer.
N
Constraints
1≤N≤10^5
N is an integer.
Output
Print an integer representing the answer.
Example
Sample Input 1
20
Sample Output 1
17
Sample Input 2
100000
Sample Output 2
30555
Note: Octal number system has base 8 instead of 10.
20
Sample Output 1
17
Sample Input 2
100000
Sample Output 2
30555
Note: Octal number system has base 8 instead of 10.