#!/usr/bin/python

import sys

if sys.version_info[0]>=3: raw_input=input



try:

	while True:

		n=int(input())

		if n==0: break

		r=0

		i=1

		while 1:

			n-=i

			if n<i: break

			i+=1

			if n%i==0: r+=1

		print(r)

except EOFError:

	pass
#!/usr/bin/python

import sys

if sys.version_info[0]>=3: raw_input=input



try:

	while True:

		n=int(input())

		if n==0: break

		r=0

		i=1

		while 1:

			n-=i

			i+=1

			if n<i: break

			if n%i==0: r+=1

		print(r)

except EOFError:

	pass
#!/usr/bin/python
import sys

if sys.version_info[0] >= 3:
    raw_input = input
try:
    while True:
        n = int(input())
        if n == 0:
            break
        r = 0
        i = 1
        while 1:
            n -= i
            if n < i:
                break
            i += 1
            if n % i == 0:
                r += 1
        print(r)
except EOFError:
    pass

#!/usr/bin/python
import sys

if sys.version_info[0] >= 3:
    raw_input = input
try:
    while True:
        n = int(input())
        if n == 0:
            break
        r = 0
        i = 1
        while 1:
            n -= i
            i += 1
            if n < i:
                break
            if n % i == 0:
                r += 1
        print(r)
except EOFError:
    pass

+            i += 1 -            i += 1