Solve the programming task below in a Python markdown code block.
You survived several months of exam wars and were able to enter ICPC University on a sunny day. On the day of admission, there was an enthusiastic recruitment of circles on the campus of the university, and you received a large number of pamphlets and returned. When you return to your room, you find one of the pamphlets you received that interests you. The pamphlet was given by the university's public relations department.

The following problems were described in the pamphlet.

> How many combinations of two or more consecutive positive integers have a sum of N? For example, 9 has two combinations, 2 + 3 + 4 and 4 + 5.

If you were curious about the answer to this question, you decided to write a program to find out the answer. Therefore, your job is to write a program that outputs the answer to the problem for the positive integer N given as the input.



Input

The input is a sequence of datasets. Each dataset is a line of one integer N. Where 1 ≤ N ≤ 1000.

The end of the input is indicated by a single line of zeros.

Output

The output is the order of the input datasets, which is the answer to the question for the positive integers represented by each dataset of the inputs. No other characters should be in the output.

Example

Input

9
500
0


Output

2
3