{"raw_statement":[{"iden":"problem statement","content":"There are $N$ piles of stones, and the $i$\\-th pile ($1 \\leq i \\leq N$) has $A_i$ stones.\nYou will choose a positive integer $k$. Then, Alice and Bob will play a game with these piles as follows.\n\n*   Starting with Alice, the players take turns to play.\n*   In each turn, the player must choose a non-empty pile and remove from it some number of stones between $1$ and $k$, inclusive.\n\nThe person who cannot make a move on their turn loses, and the other person wins.\nYou want to choose a positive integer $k$ for which there is a winning strategy for Alice. Determine if such a $k$ exists. If it exists, determine if there is a maximum value for such $k$. If the maximum value exists, provide that value."},{"iden":"constraints","content":"*   $1 \\leq N \\leq 250000$\n*   $1 \\leq A_i \\leq 10^9$\n*   All input values are integers."},{"iden":"input","content":"The input is given from Standard Input in the following format:\n\n$N$\n$A_1$ $A_2$ $\\cdots$ $A_N$"},{"iden":"sample input 1","content":"3\n1 2 3"},{"iden":"sample output 1","content":"2\n\nFor example, if $k=2$, Alice has a winning strategy. If $k \\geq 3$, Alice has no winning strategy, so the answer is $k=2$."},{"iden":"sample input 2","content":"4\n1 2 3 4"},{"iden":"sample output 2","content":"\\-1\n\nFor example, Alice has winning strategies for all $k=100,200,300,\\cdots$. Thus, there is no maximum value for $k$, so print $-1$."},{"iden":"sample input 3","content":"2\n100 100"},{"iden":"sample output 3","content":"0\n\nNo matter what $k$ is chosen, Alice has no winning strategy. Thus, print $0$."}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}