Solved by 782 users: ...
UserDateAttemptTimeCMSC
david_it21`19 apr 2008`Ruby1500.0234
david_it21`19 apr 2008`Ruby1400.0235
barlukov`19 dec 2009`Kylix100.0141
david_it21`19 apr 2008`Ruby1200.0241
david_it21`19 apr 2008`Ruby1100.0244
david_it21`19 apr 2008`Ruby1000.0247
stasg7`23 nov 2009`C++900.0175
JohnJones_001`11 sep 2006`Python300.0775
sylvandire`15 jan 2014`C++100.0177
pradeepr_ceg`20 jun 2006`C600.0182
gouthampb`10 sep 2008`C++600.0183
nphard`05 oct 2008`C++100.0283
evg281`06 jul 2009`Python1400.5483
Kopyrin_37.5`11 nov 2013`Ruby445.2583
stasg7`23 nov 2009`C++800.0188
 C++ 407 FPC 178 C 109 Java 45 Kylix 43 Ruby 8 Python 7 Lua 2 Haskell 1 Scheme 1 Perl 1
` >  >  >  >  >  >  >  >  >  > `

What is the number?

Time limit = 5 second(s)

Pete thinks out a rational number (irreducible fraction) x, 0 < x < 1, with denominator less or equal to N.

You may ask him questions like

"Is it true that x < r?"

for any number r.

Please, write program that determines minimal number M(N) of questions that will be sufficient to guess the number. It meens that there exists an algorithm of asking questions such that after M or less questions it leads to unambiguity about x.

Input. One line with N, 1 < N < 5000.

Output. One line with M.

 Input#1```2 ``` Output#1```0 ```
 Input#2```4 ``` Output#2```3 ```
 Input#3```5 ``` Output#3```4 ```