SEQ6 - Consecutive sequence


We define consecutive sequence as a sequence of integer numbers {n, n+1, n+2 ... n+m}. For each given positive integer N ≤ 107 calculate number of such sequences which sum is equal to N.

Input

The input file consists of multiple lines (about 103 in the first data set and 105 in the second), each line contains integer N. The input is terminated with N = 0, which should not be processed.

Output

Expected number in each line.

Example

Input:
500
0

Output:
8

hide comments
.:: Pratik ::.: 2014-10-12 07:55:37

n,m
500 0
98 4
8 24
-58 124
59 7
-7 39
-97 199
-499 999

Nikhil Garg: 2014-10-12 07:55:37

How is 8 answer to 500 ? My brute checker gives 4 as answer. Am I missing on something ?
Thanks.


Added by:Ruslan Sennov
Date:2010-05-14
Time limit:9s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: PERL6