N = int(input()) res = 0 for i in range(1, N+1): if i*i > N: break if N%i == 0: a, b = i, N//i if a & b != a: continue res += 2**(bin(a)[2:].count('1') - 1) print(res)