# frozen_string_literal: true n = gets.to_i c = 1 t = 0 d = 0 while c < n if (c - d) * 2 + d <= n t += 1 c = (c - d) * 2 + d d = 0 next end d += 1 end puts t