Woburn Challenge 2018-19 Round 3 - Junior Division

Oh boy, is it ever Team Rocket's lucky day: They've stumbled upon a
gathering of
Jessie and James each have a net, which can allow them to catch at most
one Pikachu each. There's just one possible caveat: Each net can only
hold a Pikachu which weighs at most
Heavier Pikachus are sure to be more valuable, so Team Rocket would like
to catch the heaviest ones they can. Given that Jessie and James each
choose at most one Pikachu to catch (and don't both catch the same
Pikachu), such that each of their chosen Pikachus weighs at most
Input Specification
The first line of input consists of a single integer,
Output Specification
Output a single integer, the maximum combined weight of Pikachus which Team Rocket can catch (in pounds).
Sample Input 1
5
43
100
31
104
62
Sample Output 1
162
Sample Input 2
3
101
1
200
Sample Output 2
1
Sample Explanation
In the first case, Jessie can catch the
In the second case, Jessie can catch the
Comments