AtCoder Regular Contest 119
A
119 × 2^23 + 1
AtCoder
⌀ 0
原题
←B →
翻译中…

Problem Statement

翻译中…

In problems on AtCoder, you are often asked to:

翻译中…

find the answer modulo $998244353$.

翻译中…

Here, we have $998244353 = 119 \times 2^{23} + 1$. Related to this, solve the following prolem:

翻译中…

You are given an integer $N$. Print the minimum possible value of $a + b + c$ for a triple of non-negative integers $(a, b, c)$ satisfying $N = a \times 2^b + c$.

翻译中…

Constraints

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

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

N

翻译中…

Output

翻译中…

Print the answer.

翻译中…

样例

Input #1
998244353
Output #1
143
We have $998244353 = 119 \times 2^{23} + 1$, in other words, the triple $(a, b, c) = (119, 23, 1)$ satisfies $N = a \times 2^{b} + c$. The value $a+b+c$ for this triple is $143$. There is no such triple where $a+b+c \leq 142$, so $143$ is the correct output.
Input #2
1000000007
Output #2
49483
We have $1000000007 = 30517 \times 2^{15} + 18951$, in other words, the triple $(a, b, c) = (30517, 15, 18951)$ satisfies $N = a \times 2^{b} + c$. The value $a+b+c$ for this triple is $49483$. There is no such triple where $a+b+c \leq 49482$, so $49483$ is the correct output.
Input #3
1
Output #3
1
Note that we have $2^0 = 1$.
Input #4
998984374864432412
Output #4
2003450165
题目信息
题号
arc119_a
时间限制
2 s
内存限制
1024 MB

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