import sys sys.setrecursionlimit(10**7) def I(): return int(sys.stdin.readline().rstrip()) def MI(): return map(int,sys.stdin.readline().rstrip().split()) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) def LI2(): return list(map(int,sys.stdin.readline().rstrip())) def S(): return sys.stdin.readline().rstrip() def LS(): return list(sys.stdin.readline().rstrip().split()) def LS2(): return list(sys.stdin.readline().rstrip()) N = I() ans = 0 for i in range(1,int(N**.5)+1): if N % i == 0: a,b = i,N//i count = 1 for j in range(30): s,t = (a >> j) & 1,(b >> j) & 1 if s == 0: continue elif s == t == 1: count *= 2 else: count = 0 break ans += count print(ans//2)