Author: | Антон Карабанов | Time limit: | 1 sec | |
Input file: | Standard input | Memory limit: | 256 Mb | |
Output file: | Standard output |
In the research institute where Timofey works, a successful study of the sequence of natural numbers is underway. Every day, his colleagues discover new and new properties of this sequence, and Timofey tries to keep up with them. Today, as usual, Timofey wrote down a row of natural numbers from 1 to n on the board and tries to answer the question of whether it is possible to erase several (at least one) consecutive numbers in the middle of the list so that the sum of the remaining numbers on the left is equal to the sum of the remaining numbers on the right.
The input consists of a single line containing a natural number n.
The output should include a non-negative integer, representing the number of different ways to erase numbers.
3 ≤ n ≤ 105
In the first example, n = 5. Let's list all the ways to erase numbers in the middle of the row:
In none of them does the required property hold.
In the second example, n = 21. Let's list all the good ways to erase numbers in the middle of the row:
In the first list, the sum of the numbers on the left and right is 21, in the second — 78. There are two ways in total.
No. | Standard input | Standard output |
---|---|---|
1 |
|
|
2 |
|
|