Two players play a game.

Initially there are $n$ integers $a_1, a_2, \ldots, a_n$ written on the board. Each turn a player selects one number and erases it from the board. This continues until there is only one number left on the board, i. e. $n - 1$ turns are made. The first player makes the first move, then players alternate turns.

The first player wants to minimize the last number that would be left on the board, while the second player wants to maximize it.

You want to know what number will be left on the board after $n - 1$ turns if both players make optimal moves.


-----Input-----

The first line contains one integer $n$ ($1 \le n \le 1000$) — the number of numbers on the board.

The second line contains $n$ integers $a_1, a_2, \ldots, a_n$ ($1 \le a_i \le 10^6$).


-----Output-----

Print one number that will be left on the board.


-----Examples-----
Input
3
2 1 3

Output
2
Input
3
2 2 2

Output
2


-----Note-----

In the first sample, the first player erases $3$ and the second erases $1$. $2$ is left on the board.

In the second sample, $2$ is left on the board regardless of the actions of the players.

Difficulty: interview

Starter code:

Solutions:
n = int(input())
num = list(map(int, input().split()))
for i in range(n - 1):
    if i % 2 == 0:
        num.pop(num.index(max(num)))
    else:
        num.pop(num.index(min(num)))
print(*num)

def inp():
    return list(map(int, input().split()))
        
n = int(input())
a = sorted(list(inp()))
t = 1
while len(a) != 1:
    if t == 1:
        t = 2
        del a[-1]
    else:
        t = 1
        del a[0]
print(a[0])



from sys import stdin, stdout
from math import factorial
from math import log10
from math import sqrt

n = int(stdin.readline())
values = sorted(list(map(int, stdin.readline().split())))
l, r = 0, n - 1
label = 0

while l != r:
    if not label:
        r -= 1
    else:
        l += 1
    
    label ^= 1

stdout.write(str(values[l]))

n=int(input())

arr=list(map(int,input().strip().split(' ')))
arr.sort()
if(n%2==0):
  print(arr[n//2-1])
else:
  print(arr[n//2])

n=int(input())
a=list(map(int,input().split()))
q=1
for i in range(n-1):
    if q==1:
        a.remove(max(a))
    else:
        a.remove(min(a))
    q*=-1
print(a[0])
    
        


n = int(input())
arr = list(map(int, input().split()))
arr = sorted(arr)
print(arr[(n-1)//2])

n = int(input())
arr = list(map(int, input().split()))
arr.sort()
print(arr[(n - 1) // 2])

import sys
import io

stream_enable = 0

inpstream = """
3
2 1 3

"""

if stream_enable:
    sys.stdin = io.StringIO(inpstream)
    input()

def inpmap():
    return list(map(int, input().split()))

n = int(input())
arr = inpmap()
arr.sort()
print(arr[len(arr) // 2 - (1 - n % 2)])


n=int(input())
l=list(map(int,input().split()))
l.sort()
if(n%2!=0):
      print(l[n//2])
else:
      print(l[n//2 -1])


n=int(input())
arr=list(map(int,input().split()))
arr.sort()
if(n%2!=0):
	print(arr[n//2])
else:
	print(arr[n//2-1])



n = int(input())
a = list(map(int,input().split()))
a.sort()
if n%2==1:
    print(a[n//2])
else:
    print(a[n//2-1])


n = int(input())
m = list(map(int, input().split()))
m.sort()
print(m[(n-1)//2])

n = int(input())
a = [int(x) for x in input().split()]
a.sort()
print(a[(n-1)//2])


n = int(input())
L = list(map(int,input().split()))
L.sort()
print(L[(n-1)//2])

n = int(input())
T = input().split(' ')
for i in range(n):
    T[i] = int(T[i])
T.sort()
if n%2==0:
    print(T[n//2-1])
else:
    print(T[n//2])


from collections import deque

n=int(input())
x=[*map(int,input().split())]
xx=deque()
x.sort()
for i in x: xx.append(i)

turn=0
while len(xx)>1:
  if turn%2==0:
    xx.pop()
  else:
    xx.popleft()
  turn+=1

print(xx.pop())

n = int(input())
ai = list(map(int,input().split()))
ai.sort()
print(ai[n // 2-(1-n%2)])


n = int(input())
v = sorted(map(int, input().split()))

k = (n-1) // 2

print(v[k])


n=int(input())
#don't hack me lel or u can't hack me lol 
l=list(map(int,input().split()))
l.sort()
if(n%2!=0):
      print(l[n//2])
else:
      print(l[n//2 -1])


def go():
    n = int(input())
    a = sorted(int(i) for i in input().split(' '))
    if n % 2 == 1:
        return a[n // 2]
    else:
        return a[n // 2 - 1]

print(go())


n = int(input())
a = list(map(int, input().split()))

a.sort()

if n % 2 == 0:
	print(a[len(a) // 2 - 1])
else:
	print(a[len(a) // 2])


n = int(input())
a = list(map(int, input().split()))

a.sort()
print(a[(n-1)//2])

n = int(input())
a = list(map(int,input().strip().split()))

a.sort()

print(a[(n - 1)//2])

N = int(input())
arr = sorted(list(map(int, input().split())))

fidx ,ridx = 0,N-1
flag = True

for _ in range(N-1):
    if flag:
        ridx -= 1
        flag = False
    else:
        fidx += 1
        flag = True

print(arr[fidx])



n = int(input())
a = [int(s) for s in input().split()]
a.sort()
if n % 2 == 0: n -= 1
print(a[n//2])