You have $$$n$$$ coins, each of the same value of $$$1$$$.
Distribute them into packets such that any amount $$$x$$$ ($$$1 \leq x \leq n$$$) can be formed using some (possibly one or all) number of these packets.
Each packet may only be used entirely or not used at all. No packet may be used more than once in the formation of the single $$$x$$$, however it may be reused for the formation of other $$$x$$$'s.
Find the minimum number of packets in such a distribution.
The only line contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^9$$$) — the number of coins you have.
Output a single integer — the minimum possible number of packets, satisfying the condition above.
6
3
2
2
In the first example, three packets with $$$1$$$, $$$2$$$ and $$$3$$$ coins can be made to get any amount $$$x$$$ ($$$1\leq x\leq 6$$$).
In the second example, two packets with $$$1$$$ and $$$1$$$ coins can be made to get any amount $$$x$$$ ($$$1\leq x\leq 2$$$).
Name |
---|