Excellence

Pair all students into teams of two so the smallest team rating sum is as large as possible.

Medium4GreedySortingTwo pointersInterviewNo attempts yetTime limit2sMemory limit256 MB

Problem

The World Coding Federation is setting up a large online programming tournament for teams of two programmers. Judge David puts together the teams of the southeastern delegation. Every student joins exactly one team of two students, and the number of students who want to compete is even, so nobody is left out. David wants every team he sends to the tournament to reach some minimum total rating. The total rating of a team is the sum of the ratings of its two members.

Find the maximum value XX such that David can form the teams so that every team has a total rating of at least XX.

Input

The first line contains a positive integer nn, the number of students who want to enter the tournament (1n1051 \le n \le 10^5, nn is even). Each of the next nn lines contains one integer sis_i, the rating of student ii (1si1061 \le s_i \le 10^6).

Output

Print on a single line the maximum value XX such that David can form teams where every team has a total rating of at least XX.