atcoder#AGC001A. [AGC001A] BBQ Easy

[AGC001A] BBQ Easy

Score : 200200 points

Problem Statement

Snuke is having a barbeque party.

At the party, he will make NN servings of Skewer Meal.

Example of a serving of Skewer Meal

He has a stock of 2N2N skewers, all of which will be used in Skewer Meal. The length of the ii-th skewer is LiL_i. Also, he has an infinite supply of ingredients.

To make a serving of Skewer Meal, he picks 22 skewers and threads ingredients onto those skewers. Let the length of the shorter skewer be xx, then the serving can hold the maximum of xx ingredients.

What is the maximum total number of ingredients that his NN servings of Skewer Meal can hold, if he uses the skewers optimally?

Constraints

  • 1N1001 \leq N \leq 100
  • 1Li1001 \leq L_i \leq 100
  • For each ii, LiL_i is an integer.

Input

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

NN

L1L_1 L2L_2 ...... L2NL_{2N}

Output

Print the maximum total number of ingredients that Snuke's NN servings of Skewer Meal can hold.

2
1 3 1 2
3

If he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold 11 and 22 ingredients, for the total of 33.

5
100 1 2 3 14 15 58 58 58 29
135