#P6267. Consecutive Integer Sum Representations

    ID: 19485 Type: Default 1000ms 256MiB

Consecutive Integer Sum Representations

Consecutive Integer Sum Representations

Every positive integer can be represented as the sum of one or more consecutive positive integers. In other words, for any positive integer \(N\), there exists at least one sequence of consecutive positive integers whose sum is \(N\). For example, when \(N = 9\), the possible representations are:

  • \(9\)
  • \(4 + 5\)
  • \(2 + 3 + 4\)

Given a positive integer \(N\) (with \(N \le 9\times10^{14}\)), determine the number of distinct ways to represent \(N\) as a sum of consecutive positive integers.

Hint: It can be shown that the number of representations is equal to the number of odd divisors of \(N\).

inputFormat

The input consists of a single line containing a positive integer \(N\) (\(N \le 9\times10^{14}\)).

outputFormat

Output a single integer representing the number of ways to express \(N\) as a sum of consecutive positive integers.

sample

9
3