import math

while 1:

    n = int(input())

    if not n:

        break

    ans = 0

    for p in range(1, int(math.sqrt(2*n))+1):

        if 2*n % p ==0:

            q = 2*n / p

            if p>1 and (p+q)%2:

                ans += 1

    print(ans)
while 1:

    n = int(input())

    if not n:

        break

    ans = 0

    p = 2

    while p**2 <= 2*n:

        if not 2*n % p:

            if (p + 2*n/p) % 2:

                ans += 1

        p += 1

    print(ans)
import math

while 1:
    n = int(input())
    if not n:
        break
    ans = 0
    for p in range(1, int(math.sqrt(2 * n)) + 1):
        if 2 * n % p == 0:
            q = 2 * n / p
            if p > 1 and (p + q) % 2:
                ans += 1
    print(ans)

while 1:
    n = int(input())
    if not n:
        break
    ans = 0
    p = 2
    while p**2 <= 2 * n:
        if not 2 * n % p:
            if (p + 2 * n / p) % 2:
                ans += 1
        p += 1
    print(ans)

-import math - -    for p in range(1, int(math.sqrt(2 * n)) + 1): -        if 2 * n % p == 0: -            q = 2 * n / p -            if p > 1 and (p + q) % 2: +    p = 2 +    while p**2 <= 2 * n: +        if not 2 * n % p: +            if (p + 2 * n / p) % 2: +        p += 1