def Tmin(n) count = 0 while n & 1 == 0 count += 1 n /= 2 end count + (n == 0 ? 0 : n - 1) end n = gets.to_i print Tmin(n) print ' ' puts n - 1