Exam on Computer Graphics
Professor Artur, who teaches computer graphics, is an enthusiast of the game of Nim and the Ben-Batzalel problem. During exams, he offers students a choice: either defeat him in Nim or help solve the Ben-Batzalel problem. Knowing the problem is unsolvable, the students invariably choose to play Nim. However, aware that students have mastered the winning strategy through diligent study, the professor has decided to alter the rules.
Consider there are n students in the class, numbered from 1 to n in the register. Each student takes the exam individually. Before each student enters the room, the professor arranges n piles of cones on the floor, with A_i cones in the i-th pile. If a student's register number is k, then during the game, both the student and Professor Artur can remove cones from up to k piles per turn (they may take a different number of cones from each pile), but they must take at least 1 cone per turn. The turns alternate, with the student going first, and the player unable to make a move loses.
Your task is to identify which students have no chance of passing the exam, as the professor is well-versed in the winning strategy of this modified game and will employ it effectively.
Input
The first line of the input contains a single integer n (1 ≤ n ≤ 10000). The second line contains n integers A_{i }(1 ≤ A_{i }≤ 10^6), separated by spaces.
Output
Output the sorted list of student numbers who will inevitably fail the exam, regardless of their strategy. If all students are able to pass the exam, output -1.