#ABC473B. 抽鬼牌 / Old Maid

抽鬼牌 / Old Maid

Problem Statement

Takahashi currently has NN cards. The ii-th (1iN)(1\le i\le N) card has the integer AiA_i written on it.

He repeats the following operation as many times as possible.

  • Choose two different cards with the same integer written on them, and eat those two cards. The eaten cards are permanently removed and cannot be chosen in subsequent operations.

Find the sum of the integers written on the cards that remain when the operation can no longer be performed.

Constraints

  • 1N1001\le N\le100
  • 1Ai100 (1iN)1\le A_i\le100\ (1\le i\le N)
  • All input values are integers.

Input

The input is given from Standard Input in the following format:

  • NN
  • A1A_1 A2A_2 \dots ANA_N

Output

Output the sum of the integers written on the remaining cards.

8
2 7 1 8 2 8 1 8
15

For example, Takahashi operates as follows.

  1. The fourth card and sixth card both have 88 written on them, so he chooses them and eats them.
  2. The first card and fifth card both have 22 written on them, so he chooses them and eats them.
  3. The third card and seventh card both have 11 written on them, so he chooses them and eats them.

(Original image: https://img.atcoder.jp/abc473/839dc9d3f8c77f88619fee1b74e6428d.png)

Thus, the sum of the integers written on the remaining cards is 7+8=157+8=15.

Note that there are three cards with 88 written on them, so once two of them are eaten, the remaining one cannot be eaten.

5
1 2 3 4 5
15

It is possible that Takahashi cannot perform the operation even once.

15
58 97 74 16 97 74 97 16 51 52 58 52 74 32 43
297