1494: CF87 - C. Interesting Game
[Creator : ]
Description
Two best friends Serozha and Gena play a game.
Initially there is one pile consisting of $n$ stones on the table. During one move one pile should be taken and divided into an arbitrary number of piles consisting of $a_1>a_2>...>a_k>0$ stones. The piles should meet the condition $a_1-a_2=a_2-a_3=...=a_{k-1}-a_k=1$. Naturally, the number of piles $k$ should be no less than two.
The friends play in turns. The player who cannot make a move loses. Serozha makes the first move. Who will win if both players play in the optimal way?
The friends play in turns. The player who cannot make a move loses. Serozha makes the first move. Who will win if both players play in the optimal way?
Input
The single line contains a single integer $n\ (1≤n≤10^5)$.
Output
If Serozha wins, printk, which represents the minimal number of piles into which he can split the initial one during the first move in order to win the game.
If Gena wins, print "-1" (without the quotes).
If Gena wins, print "-1" (without the quotes).
Sample 1 Input
3
Sample 1 Output
2
Sample 2 Input
6
Sample 2 Output
-1
Sample 3 Input
100
Sample 3 Output
8
HINT
CF87.