def a(n): return bin(n^(n>>1))[2:].count("1") n = int(input()) print(a(n-1))