#C1501. Maximum Minimum Team Skill

    ID: 44714 Type: Default 1000ms 256MiB

Maximum Minimum Team Skill

Maximum Minimum Team Skill

You are given an even integer \(N\) representing the number of participants in a contest and an array of \(N\) integers representing their skill levels. Your task is to form \(\frac{N}{2}\) teams by pairing the participants optimally such that the minimum team skill is maximized. The skill of a team is defined as the sum of the skills of its two members.

Optimal Strategy: Sort the skill array and pair the smallest element with the largest, the second smallest with the second largest, and so on. The answer is the minimum sum among these pairs.

Example:

Input: 4
       3 6 2 8
After sorting: [2, 3, 6, 8]
Pairs: 2+8=10, 3+6=9
Output: 9 (since 9 is the minimum pair sum)

inputFormat

The first line contains an even integer \(N\) indicating the number of participants. The second line contains \(N\) space-separated integers representing the skill levels of the participants.

outputFormat

Output a single integer, the maximum possible value of the minimum team skill that can be achieved by optimally pairing the participants. The output should be printed to standard output.

## sample
4
3 6 2 8
9