N=gets.chomp.to_i def nishinsuu(num) org_num = num keta = 1 total = 0 while num > 0 num = num >> 1 keta += 1 end saidaiketa = keta - 1 amari =0 if org_num % (2 ** (saidaiketa-1)) != 0 amari = 1 end return (saidaiketa - 1) + amari end puts nishinsuu(N) puts nishinsuu(N)