print((function (n) for i=0,30 do local t = 2^i if n <= t then return i + t - n end end end)(io.stdin:read("*n")))