n = int(input()) lst = [] for i in range(1, int(n ** 0.5 + 1)): if n % i == 0: lst.append((i, n // i)) ans = 0 for a, b in lst: if a | b != b: continue cnt = 1 for i in range(30): if b >> i & 1: if a >> i & 1: cnt *= 2 ans += cnt // 2 print(ans)