641. Array Partition
0
Easy
Given an array of 2n integers, the task is to group these integers into n pairs (a1, b1), (a2, b2), ..., (an, bn) such that the sum of the minimum of each pair is maximized. Find the maximum sum.
Input Format
The first line contains an integer N.
The second line contains an integer array.
Output Format
Print the maximized sum.
Example
Input
6
6 2 6 5 1 2
Output
9
Constraints
1 <= N <= 10^4
-10^4 <= Array[i] <= 10^4
Loading...
View Submissions
Console