#K4326. Consecutive Sum Representations

    ID: 27270 Type: Default 1000ms 256MiB

Consecutive Sum Representations

Consecutive Sum Representations

You are given a positive integer (n). Your task is to determine the number of ways to express (n) as a sum of two or more consecutive positive integers. In other words, find the number of sequences of the form (a, a+1, a+2, \ldots, a+k) (with (k \ge 1)) such that (n = a + (a+1) + \cdots + (a+k)). For example, when (n = 9), there are 2 ways: (9 = 4+5) and (9 = 2+3+4).

inputFormat

The input is provided via standard input (stdin) and consists of a single line containing one positive integer (n) ((1 \le n \le 10^9)).

outputFormat

Output the number of ways to express (n) as a sum of two or more consecutive positive integers. The output should be sent to standard output (stdout).## sample

9
2

</p>