eolymp
bolt
Try our new interface for solving problems
Problems

Consecutive Sums

Consecutive Sums

The sum of p (p > 0) consecutive integers can often be equal to the sum of next q consecutive positive integers. For example:

  • 9 + 10 + 11 + 12 = 13 + 14 + 15, here p = 4 and q = 3
  • 4 + 5 + 6 + 7 + 8 = 9 + 10 + 11, here p = 5 and q = 3.

Given the value of q, how many possible values of p are there?

Input

Contains at most 1500 lines. Each line contains a positive integer less than 1014, which denotes the value of q. Input is terminated by a line containing a single zero. This line should not be processed.

Output

For each input line print one line that contains an integer, which denotes the total number of possible values of p.

Time limit 10 seconds
Memory limit 128 MiB
Input example #1
5
1
0
Output example #1
6
2
Source 2011 ACM Asia Phuket Regional Programming Contest, November 4