Bowling Analysis
In this problem, we have a bowling game with the following rules: On each lane, there is a row of k pins, with a distance of 1 between any two adjacent pins. Players take turns, and during each turn, a player can knock down either one pin or two pins that are exactly 1 apart. Missing a pin is not allowed. The winner is the player who knocks down the last pin.
In this scenario, Vovan and Petian, two businessmen, have rented an entire bowling alley, giving them access to n independent bowling lanes. During their turn, a player selects a lane to make their move, and then proceeds to make that move. The next player can choose any lane, including the one previously played on, to make their move. The objective remains the same: to knock down the last pin on any lane.
Vovan plays first, and he wants to determine how many different winning moves he has. Two moves are considered different if at least one pin knocked down in one move is not knocked down in the other, or vice versa.
Input
The first line contains the number of lanes n (n ≤ 1000). The second line contains n natural numbers k[i]
(k[i]
≤ 1000), where k[i]
represents the number of pins on lane number i.
Output
Output the number of winning moves available to Vovan.