{"problem":{"name":"Cheating Nim","description":{"content":"#nck { width: 30px; height: auto; }A cheetah and a cheater are going to play the game of Nim. In this game they use $N$ piles of stones. Initially the $i$\\-th pile contains $a_i$ stones. The players t","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"cf16_exhibition_final_c"},"statements":[{"statement_type":"Markdown","content":"#nck { width: 30px; height: auto; }A cheetah and a cheater are going to play the game of Nim. In this game they use $N$ piles of stones. Initially the $i$\\-th pile contains $a_i$ stones. The players take turns alternately, and the cheetah plays first. In each turn, the player chooses one of the piles, and takes one or more stones from the pile. The player who can't make a move loses.\nHowever, before the game starts, the cheater wants to cheat a bit to make sure that he can win regardless of the moves by the cheetah. From each pile, the cheater takes zero or one stone and eats it before the game. In case there are multiple ways to guarantee his winning, he wants to minimize the number of stones he eats.\nCompute the number of stones the cheater will eat. In case there is no way for the cheater to win the game even with the cheating, print `-1` instead.\n\n## Constraints\n\n*   $1 ≤ N ≤ 10^5$\n*   $2 ≤ a_i ≤ 10^9$\n\n## Input\n\nThe input is given from Standard Input in the following format:\n\n$N$\n$a_1$\n:\n$a_N$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"cf16_exhibition_final_c","tags":[],"sample_group":[["3\n2\n3\n4","3\n\nThe only way for the cheater to win the game is to take stones from all piles and eat them."],["3\n100\n100\n100","\\-1"]],"created_at":"2026-03-03 11:01:14"}}