パナソニックプログラミングコンテスト(AtCoder Beginner Contest 186)
C
Unlucky 7
AtCoder
⌀ 0
原题
← BD →
翻译中…

Problem Statement

翻译中…

Takahashi 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)?

翻译中…

Constraints

翻译中…
  • $1 \leq N \leq 10^5$
  • $N$ is an integer.
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

N

翻译中…

Output

翻译中…

Print an integer representing the answer.

翻译中…

样例

Input #1
20
Output #1
17
Among the integers between $1$ and $20$, $7$ and $17$ contain the digit $7$ in decimal. Additionally, $7$ and $15$ contain the digit $7$ in octal. Thus, the $17$ integers other than $7$, $15$, and $17$ meet the requirement.
Input #2
100000
Output #2
30555
题目信息
题号
abc186_c
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。