시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB47403487.179%

문제

Alice and Bob want to play Nim. Well, some kind of it.

Initially, they have n heaps of stones, i-th heap containing ai stones. Players take alternating turns, Alice moves first. On their turn, a player chooses any heap with at least two stones and splits it into two new heaps with at least one stone in each. After that, the player colors all stones in one of the new heaps white and all stones in the other one black. The game lasts until every heap contains only one stone.

After the game, Alice’s score is the number of white stones on the board, and Bob’s score is the number of black stones. Both players want to maximize their score and play optimally. What will be Alice’s score?

입력

The first line of input contains a single integer n (1 ≤ n ≤ 128).

The second line of input contains n integers a1, a2, . . . , an (2 ≤ ai ≤ 128).

Note that the initial colors of the stones are irrelevant.

출력

Output a single integer: Alice’s score if both players play optimally.

예제 입력 1

2
2 2

예제 출력 1

2

힌트

In the example, no matter how players move, both heaps will be split between them equally.