AtCoder Regular Contest 184
B
123 Set
AtCoder
⌀ 2867
原题
← AC →
翻译中…

Problem Statement

翻译中…

You are given a positive integer $N$. There is an empty set $S$, and you can perform the following operation any number of times:

翻译中…
  • Choose any positive integer $x$. For each of $x$, $2x$, and $3x$, add it to $S$ if it is not already in $S$.
翻译中…

Find the minimum number of operations required to satisfy $\{1, 2, \dots, N\} \subseteq S$.

翻译中…

Constraints

翻译中…
  • $1 \leq N \leq 10^{9}$
翻译中…

Input

翻译中…

The input is given from Standard Input in the following format:

翻译中…

N

翻译中…

Output

翻译中…

Print the answer in one line.

翻译中…

样例

Input #1
7
Output #1
4
Choosing $1$, $2$, $5$, and $7$ yields $S = \{1, 2, 3, 4, 5, 6, 7, 10, 14, 15, 21\}$, which satisfies the condition. It is impossible to satisfy the condition with three or fewer operations.
Input #2
25
Output #2
14
题目信息
题号
arc184_b
时间限制
8 s
内存限制
1024 MB

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