The package for this problem was not updated by the problem writer or Codeforces administration after we've upgraded the judging servers. To adjust the time limit constraint, a solution execution time will be multiplied by 2. For example, if your solution works for 400 ms on judging servers, then the value 800 ms will be displayed and used to determine the verdict.

Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

The problem statement has recently been changed. View the changes.

×
C. Interesting Game

time limit per test

2 secondsmemory limit per test

256 megabytesinput

standard inputoutput

standard outputTwo 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?

Input

The single line contains a single integer *n* (1 ≤ *n* ≤ 10^{5}).

Output

If Serozha wins, print *k*, 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).

Examples

Input

3

Output

2

Input

6

Output

-1

Input

100

Output

8

Codeforces (c) Copyright 2010-2022 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Sep/25/2022 13:15:59 (h1).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|