Our friends Alpha and Beta found a magical treasure of Asgard. It consists of piles of gold coins. It is magical since if anyone tries to take a pile of coins, all the other piles of exactly coins (if they exist) disappear.

Alpha and Beta only have one turn each to choose a pile for themselves starting with Alpha. In one turn, a complete pile of gold coins can be chosen and since our friends are smart they will choose the pile with the maximum coins.

Find the number of coins Beta will get in his turn.

Function Description

Complete the alphaBeta function in the editor below. It should return an integer representing the number of coins Beta will get in his turn.

alphaBeta has the following parameter(s):

pile: an integer array

Input Format

  • First line of the input contains a single integer , number of piles.
  • Second line of the input contains space seperated integers, number of gold coins in each pile.

Constraints

  • (where )

Output Format

  • Single integer which is the number of coins Beta will receive in his first turn.

Sample Input 0

6
1 2 3 3 2 1

Sample Output 0

2

Explanation 0

Alpha will select a pile of coins in his turn. So due to magic the other pile of coins will disappear and Beta will be left with 4 piles:

1 2 2 1

Hence Beta will select a pile of coins.

Sample Input 1

5
1 2 3 4 5

Sample Output 1

4

Explanation 1

Alpha will select a pile of coins in his turn. There are no other piles of coins so none disappear. Hence Beta will select a pile of coins.

Line: 1 Col: 1
  1. Challenge Walkthrough
    Let's walk through this sample challenge and explore the features of the code editor.1 of 6
  2. Review the problem statement
    Each challenge has a problem statement that includes sample inputs and outputs. Some challenges include additional information to help you out.2 of 6
  3. Choose a language
    Select the language you wish to use to solve this challenge.3 of 6
  4. Enter your code
    Code your solution in our custom editor or code in your own environment and upload your solution as a file.4 of 6
  5. Test your code
    You can compile your code and test it for errors and accuracy before submitting.5 of 6
  6. Submit to see results
    When you're ready, submit your solution! Remember, you can go back and refine your code anytime.6 of 6
  1. Check your score