Problem J

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

The input file contains at most 1500 lines of inputs. 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 line of input produce one line of output. This line contains an integer, which denotes the total number of possible values of p.

 

 

Sample Input

Sample Output

5

1

0

 

6

2