Alice and Bob are playing a game. They have N containers each having one or more chocolates. Containers are numbered from 1 to N, where ith container has A[i] number of chocolates.
The game goes like this. First player will choose a container and take one or more chocolates from it. Then, second player will choose a non-empty container and take one or more chocolates from it. And then they alternate turns. This process will continue, until one of the players is not able to take any chocolates (because no chocolates are left).
One who is not able to take any chocolates loses the game. Note that player can choose only non-empty container.
The game between Alice and Bob has just started, and Alice has got the first Chance. She wants to know the number of ways to make a first move such that under optimal play, the first player always wins.
Example : If we have 2 containers with chocolates as follow : [2,3] then here answer is only 1
Explanation :
Only 1 set of moves helps player 1 win.
Player: 1 2 1 2 1
Chocolates: 2 3 -> 2 2 -> 1 2 -> 1 1 -> 0 1