while True:

    n = eval(input())

    if n==0:

        break

    ans = 0

    for i in range(1, n/2+1):

        su = 0

        c = i

        while su<n:

            su += c

            c += 1

        if su==n:

            ans += 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 True:
    n = eval(input())
    if n == 0:
        break
    ans = 0
    for i in range(1, n / 2 + 1):
        su = 0
        c = i
        while su < n:
            su += c
            c += 1
        if su == n:
            ans += 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 True: -    n = eval(input()) -    if n == 0: +import math + +while 1: +    n = int(input()) +    if not n: -    for i in range(1, n / 2 + 1): -        su = 0 -        c = i -        while su < n: -            su += c -            c += 1 -        if su == n: -            ans += 1 +    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