New Year's Gifts - 2#152

New Year's Gifts - 2

1 second
64 megabytes
Easy

Santa Claus distributes candies into packages so that the first package contains candy, the second contains candies, and so on up to the -th package, which contains candies. An elf wants to make the number of candies in all packages equal. In each operation, the elf may add one candy to any two different packages.

Input

The input contains a single integer (3 \leq N \leq 100\,000\,000).

Output

Print the minimum number of operations necessary to make the number of candies in all packages equal. If it is impossible, print -1.

Examples

Example 1

Loading
Loading