First Move In A Nim Game
medium
Two players Alice and Bob are playing NIM Game with each other. Both are playing optimally.Alice starts the game. The task is to find the number of ways of playing 1st move for Alice to ensure a winning strategy for him if possible, otherwise print -1.
Constraints
1<= n <= 10^5 1<= A[i] <= 10^8
Format
Input
The first line contains one integer n. The second line contains n space separated integers a[1],a[2]...a[n].
Output
Print the number of possible first move for Alice to win. If Alice can't win, Print -1.
Example
Sample Input
7
24 6 10 56 9 1 24
Sample Output
1