n = int(input())


def popcount(x):
    res = 0
    while x > 0:
        if x % 2 == 1:
            res += 1
        x //= 2
    return res


def solve(a, b):
    cnt = popcount(a)
    while a > 0 or b > 0:
        if a % 2 == 1 and b % 2 == 0:
            return 0
        a //= 2
        b //= 2
    res = 1
    for _ in range(cnt - 1): res *= 2
    return res


x = 1
ans = 0
while x * x <= n:
    if n % x != 0:
        x += 1
        continue
    a = x
    b = n // x
    ans += solve(a, b)
    x += 1

print(ans)