def main(): n = int(input()) ans = 0 v = 1 while v < n: v *= 2 ans += 1 print(ans - (n - v)) if __name__ == '__main__': main()