#P1848F. Vika and Wiki
Vika and Wiki
No submission language available for this problem.
Description
Recently, Vika was studying her favorite internet resource - Wikipedia.
On the expanses of Wikipedia, she read about an interesting mathematical operation bitwise XOR, denoted by .
Vika began to study the properties of this mysterious operation. To do this, she took an array consisting of non-negative integers and applied the following operation to all its elements at the same time: . Here denotes the remainder of dividing by . The elements of the array are numbered starting from .
Since it is not enough to perform the above actions once for a complete study, Vika repeats them until the array becomes all zeros.
Determine how many of the above actions it will take to make all elements of the array zero. If this moment never comes, output .
The first line contains a single integer () - the length of the array .
It is guaranteed that can be represented as for some integer ().
The second line contains integers () - the elements of the array .
Output a single number - the minimum number of actions required to make all elements of the array zero, or if the array will never become zero.
Input
The first line contains a single integer () - the length of the array .
It is guaranteed that can be represented as for some integer ().
The second line contains integers () - the elements of the array .
Output
Output a single number - the minimum number of actions required to make all elements of the array zero, or if the array will never become zero.
Note
In the first example, after one operation, the array will become equal to . After one more operation, it will become equal to .
In the second example, the array initially consists only of zeros.
In the third example, after one operation, the array will become equal to .