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: EASY
Tags: Sorting
Skill types: Sorting

Starter code:

Solutions:
N = int(input())
A = list(map(int, input().split()))
A.sort()
if N % 2 == 0:
	print(A[N // 2 - 1])
else:
	print(A[N // 2])


n = int(input())
l = list(map(int, input().split()))
i = 0
while n > 1:
	n -= 1
	i += 1
	if i % 2 != 0:
		l.remove(max(l))
	else:
		l.remove(min(l))
for i in l:
	print(i)


n = int(input())
a = [int(i) for i in input().split()]
a.sort()
l = 0
r = n - 1
while l < r:
	r -= 1
	l += 1
print(a[r])


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


from math import *
import sys, random

def nextInt():
	return int(input())

def nextStrs():
	return input().split()

def nextInts():
	return list(map(int, nextStrs()))

def main():
	n = nextInt()
	arr = nextInts()
	arr.sort()
	print(arr[(n - 1) // 2])
exit(main())


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


n = input()
n = int(n)
ans = 0
numbers = []
numbers = [int(i) for i in input().split()]
numbers.sort()
k = int(n / 2 - 1)
l = int(n / 2)
if n % 2 == 0:
	ans = numbers[k]
else:
	ans = numbers[l]
print(ans)


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


import sys
n = int(sys.stdin.readline().split()[0])
numbers = sys.stdin.readline().split()
for i in range(n):
	numbers[i] = int(numbers[i])
numbers.sort()
for i in range(n - 1):
	if i % 2 == 0:
		numbers.pop(len(numbers) - 1)
	else:
		numbers.pop(0)
sys.stdout.write(str(numbers[0]))


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


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


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


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


input()
res = sorted(map(int, input().split()))
print(res[(len(res) - 1) // 2])


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


n = int(input())
numbers = [int(num) for num in input().split()]
for i in range(n - 1):
	if i % 2 == 0:
		numbers.remove(max(numbers))
	else:
		numbers.remove(min(numbers))
print(numbers[0])


x = int(input())
y = [int(i) for i in input().split()]
z = 1
while len(y) > 1:
	if z % 2 == 1:
		y.pop(y.index(max(y)))
	else:
		y.pop(y.index(min(y)))
	z += 1
print(y[0])


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


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


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


def solve():
	n = int(input())
	ls = sorted(map(int, input().split()))
	return ls[(n + (n & 1)) // 2 - 1]
print(solve())


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


from random import randint

def pos(arr, index):
	if len(arr) <= 10:
		return sorted(arr)[index]
	else:
		sublists = [arr[i:i + 5] for i in range(0, len(arr), 5)]
		medians = [sorted(sublist)[len(sublist) // 2] for sublist in sublists]
		if len(medians) <= 5:
			pivot = sorted(medians)[len(medians) // 2]
		else:
			pivot = pos(medians, len(medians) // 2)
		left_arr = [i for i in arr if i < pivot]
		equal_arr = [i for i in arr if i == pivot]
		right_arr = [i for i in arr if i > pivot]
		if len(left_arr) > index:
			return pos(left_arr, index)
		elif len(left_arr) <= index < len(left_arr) + len(equal_arr):
			return pivot
		else:
			return pos(right_arr, index - (len(left_arr) + len(equal_arr)))
n = input()
arr = list(map(int, input().split()))
print(pos(arr, (len(arr) - 1) // 2))
while False:
	ar = [randint(0, 3) for i in range(15)]
	if sorted(ar)[(len(ar) - 1) // 2] != pos(ar, (len(ar) - 1) // 2):
		print(sorted(ar)[(len(ar) - 1) // 2])
		print(pos(ar, (len(ar) - 1) // 2))
		print(sorted(ar))
		break


n = int(input())
a = list(map(int, input().split()))
a.sort()
while len(a) > 1:
	del a[-1]
	if len(a) > 1:
		del a[0]
print(a[0])


n = int(input())
l = list(map(int, input().split()))
l.sort()
for i in range(len(l) - 1):
	if i % 2 == 0:
		l.pop()
	else:
		l.pop(0)
print(l[0])


a = int(input())
b = list(map(int, input().split()))
b = sorted(b)
if a % 2 == 0:
	ind = int(a / 2) - 1
else:
	ind = int((a + 1) / 2) - 1
print(b[ind])


import itertools
import math
import sys
import heapq
from collections import Counter
from collections import deque
from fractions import gcd
from functools import reduce
sys.setrecursionlimit(4100000)
INF = 1 << 60
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 // 2 - (n + 1) % 2])


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


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


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


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


n = int(input())
li = [int(x) for x in input().split()]
li.sort()
if n % 2 == 0:
	middle = n // 2 - 1
else:
	middle = n // 2
print(li[middle])


def merge(A, B):
	Res = []
	i = 0
	j = 0
	while i < len(A) and j < len(B):
		if A[i] <= B[j]:
			Res.append(A[i])
			i += 1
		else:
			Res.append(B[j])
			j += 1
	Res += A[i:] + B[j:]
	return Res

def MergeSort(A):
	if len(A) <= 1:
		return A
	else:
		L = A[:len(A) // 2]
		R = A[len(A) // 2:]
	return merge(MergeSort(L), MergeSort(R))
n = int(input())
A = list(map(int, input().split()))
A = MergeSort(A)
if n == 2:
	print(min(A))
elif n % 2 == 0:
	print(A[n // 2 - 1])
else:
	print(A[(n - 1) // 2])


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


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


def do():
	n = int(input())
	dat = list(map(int, input().split()))
	dat.sort()
	if n == 1:
		print(dat[0])
		return
	if n == 2:
		print(dat[0])
		return
	if n & 1 == 1:
		print(dat[n // 2])
		return
	print(dat[n // 2 - 1])
do()

def resolve():
	from pprint import pprint
	q = int(input())
	for _ in range(q):
		s = input()
		n = int(input())
		(n, k) = map(int, input().split())
		dat = list(map(int, input().split()))
	dat = [1, 2, 3]
	print(' '.join(list(map(str, res))))
	pass
	import math
	math.ceil(1.2)
	math.floor(1.2)
	round(1.2, 3)


n = int(input())
numbers = list(map(int, input().split(' ')))
i = 1
while len(numbers) != 1:
	if i % 2 == 0:
		numbers.remove(min(numbers))
	else:
		numbers.remove(max(numbers))
	i += 1
print(numbers[0])


n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
print(a[n // 2])


n = int(input())
a = [int(i) for i in input().split()]
while len(a) != 1 and len(a) != 2:
	del a[a.index(max(a))]
	del a[a.index(min(a))]
if len(a) == 2:
	del a[a.index(max(a))]
print(a[0])


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


import random
n = int(input())
array = list(map(int, input().split()))
for i in range(1, n):
	if i % 2 == 0:
		array.remove(min(array))
	else:
		array.remove(max(array))
print(array[0])


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())
nums = [int(i) for i in input().split()]
nums = sorted(nums)
L = len(nums)
if L % 2 == 0:
	print(nums[(L - 1) // 2])
else:
	print(nums[L // 2])


n = int(input())
a = []
a += map(int, input().split())
a.sort()
print(a[n // 2 - (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())
l1 = list(map(int, input().split()))
for i in range(n - 1):
	while len(l1) != 1:
		if len(l1) != 1:
			l1.remove(max(l1))
		if len(l1) != 1:
			l1.remove(min(l1))
print(*l1)


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


print((lambda n, numbers: numbers[(n - 1) // 2])(int(input()), sorted((int(x) for x in input().split()))))


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


n = int(input())
board = [int(x) for x in input().split()]
board.sort()
if n % 2 != 0:
	print(board[n // 2])
else:
	print(board[n // 2 - 1])


t = int(input())
l = list(map(int, input().split()))
count = 0
while len(l) != 1:
	if count % 2 == 0:
		l.remove(max(l))
	else:
		l.remove(min(l))
	count += 1
print(l[0])


le = int(input())
a = list(map(int, input().split()))
a = sorted(a)
main = (len(a) - 1) // 2
print(a[main])


_ = input()
nums = sorted(list(map(int, input().split())))
turn = 0
while len(nums) > 1:
	if turn % 2 == 0:
		nums.pop()
	else:
		nums.pop(0)
	turn += 1
print(*nums)


n = int(input())
a = list(map(int, input().split()))
a.sort()
beg = 0
end = n - 1
print(a[(beg + end) // 2])


n = int(input())
li = list(map(int, input().split()))
li.sort()
print(li[n - 1 >> 1])


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


def pop_back(l):
	l.pop(len(l) - 1)

def pop_front(l):
	l.pop(0)
n = int(input())
ls = list(map(int, input().strip().split()))
ls.sort()
for i in range(1, n):
	if i % 2 == 0:
		pop_front(ls)
	else:
		pop_back(ls)
print(*ls, sep='')


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


s = int(input())
l = []
l = list(map(int, input().split(' ')))
l.sort()
if s % 2 == 1:
	while len(l) > 1:
		l.pop(-1)
		l.pop(0)
else:
	while len(l) > 2:
		l.pop(-1)
		l.pop(0)
print(l[0])


from sys import stdin, stdout, exit as sys_ret
(f_input, f_print, f_flush) = (stdin.readline, stdout.write, stdout.flush)
(amount, numbers) = (int(f_input()), sorted([int(_) for _ in f_input().split()]))
if amount % 2:
	f_print(str(numbers[amount // 2]))
else:
	f_print(str(numbers[amount // 2 - 1]))


import math
n = int(input())
x = [int(n) for n in input().split(' ')]
x = sorted(x)
t = math.ceil(len(x) / 2)
print(x[t - 1])


n = int(input())
numbers = [int(i) for i in input().split(' ')]
i = 0
while len(numbers) != 1:
	numbers.remove(max(numbers))
	if len(numbers) == 1:
		print(numbers[0])
		exit()
	numbers.remove(min(numbers))
print(numbers[0])


from collections import deque
n = int(input().strip())
nums = deque([k for k in map(int, input().strip().split())])
for i in range(n):
	for j in range(n - i - 1):
		if nums[j] > nums[j + 1]:
			t = nums[j]
			nums[j] = nums[j + 1]
			nums[j + 1] = t
while len(nums) > 1:
	nums.pop()
	if len(nums) == 1:
		break
	nums.popleft()
print(nums[0])


import math
n = int(input()) - 1
s = sorted(map(int, input().split()))
print(s[math.floor(n / 2)])


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


T_ON = 0
DEBUG_ON = 0
MOD = 998244353

def solve():
	n = read_int()
	A = read_ints()
	A.sort()
	print(A[(n - 1) // 2])

def main():
	T = read_int() if T_ON else 1
	for i in range(T):
		solve()

def debug(*xargs):
	if DEBUG_ON:
		print(*xargs)
from collections import *
import math
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def read_int():
	return int(input())

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

def print_nums(nums):
	print(' '.join(map(str, nums)))

def YES():
	print('YES')

def Yes():
	print('Yes')

def NO():
	print('NO')

def No():
	print('No')

def First():
	print('First')

def Second():
	print('Second')

def fib(n):
	(a, b) = (0, 1)
	for _ in range(n):
		(a, b) = (b, a + b)
	return a

def fib_ns(n):
	assert n >= 1
	f = [0 for _ in range(n + 1)]
	f[0] = 0
	f[1] = 1
	for i in range(2, n + 1):
		f[i] = f[i - 1] + f[i - 2]
	return f

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def xgcd(a, b):
	(x0, x1, y0, y1) = (0, 1, 1, 0)
	while a != 0:
		((q, a), b) = (divmod(b, a), a)
		(y0, y1) = (y1, y0 - q * y1)
		(x0, x1) = (x1, x0 - q * x1)
	return (b, x0, y0)

def lcm(a, b):
	d = gcd(a, b)
	return a * b // d

def modinv(a, m):
	(g, x, _) = xgcd(a, m)
	if g != 1:
		raise Exception('gcd(a, m) != 1')
	return x % m

def mod_add(x, y):
	x += y
	while x >= MOD:
		x -= MOD
	while x < 0:
		x += MOD
	return x

def mod_mul(x, y):
	return x * y % MOD

def mod_pow(x, y):
	if y == 0:
		return 1
	if y % 2:
		return mod_mul(x, mod_pow(x, y - 1))
	p = mod_pow(x, y // 2)
	return mod_mul(p, p)

def mod_inv(y):
	return mod_pow(y, MOD - 2)

def mod_div(x, y):
	return mod_mul(x, mod_inv(y))

def is_prime(n):
	if n == 1:
		return False
	for i in range(2, int(n ** 0.5) + 1):
		if n % i:
			return False
	return True

def gen_primes(n):
	P = [True for _ in range(n + 1)]
	P[0] = P[1] = False
	for i in range(int(n ** 0.5) + 1):
		if P[i]:
			for j in range(2 * i, n + 1, i):
				P[j] = False
	return P
main()


n = int(input())
s = input().split()
v = []
for i in s:
	v.append(int(i))
v.sort()
if len(v) % 2 == 0:
	print(v[len(v) // 2 - 1])
else:
	print(v[len(v) // 2])


n = int(input())
lst = sorted(map(int, input().split()), reverse=True)
print(lst[n // 2])


n = int(input())
l = [int(x) for x in input().split()]
l.sort()
if n % 2:
	print(l[n // 2])
else:
	print(l[n // 2 - 1])


n = int(input())
s = [i for i in map(int, input().split())]
s.sort()
while len(s) > 2:
	del s[s.index(max(s))]
	del s[s.index(min(s))]
print(s[0])


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


n = int(input())
s = list(map(int, input().strip().split()))[:n]
for i in range(len(s) - 1):
	if i % 2 == 0:
		s.pop(s.index(max(s)))
	else:
		s.pop(s.index(min(s)))
print(s[0])


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


x = input()
y = input()
ar = list(map(int, y.split(' ')))
ar.sort()
print(ar[int((len(ar) - 1) / 2)])


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


n = int(input())
ar = sorted([int(i) for i in input().split()])
print(ar[(n - 1) // 2])


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


from sys import stdin
from math import floor
n = int(stdin.readline())
a = list(map(int, stdin.readline().split()))
a.sort()
print(a[floor(n / 2 - 0.1)])


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


n = int(input())
a = list(map(int, input().split()))
a.sort()
l = 0
r = n - 1
while l < r:
	l = l + 1
	r = r - 1
print(a[r])


n = int(input())
l = [int(i) for i in input().split()]
for i in range(n):
	if len(l) > 1:
		l.remove(max(l))
	else:
		break
	if len(l) > 1:
		l.remove(min(l))
	else:
		break
print(''.join(list(map(str, l))))


def main():
	n = int(input())
	a = [int(x) for x in input().split()]
	a.sort()
	print(a[n // 2 - 1] if n % 2 == 0 else a[(n + 1) // 2 - 1])
main()


n = int(input())
s = [int(i) for i in input().split()]
for i in range(n - 1):
	if i % 2 == 0:
		x = max(s)
	else:
		x = min(s)
	y = s.index(x)
	s.pop(y)
print(s[0])


class Solution:

	def remove(self, a):
		a = sorted(a)
		if len(a) % 2 == 0:
			n = int(len(a) / 2 - 1)
			return a[n]
		elif len(a) == 1:
			return a[0]
		else:
			m = int((len(a) - 1) / 2)
			return a[m]
t = Solution()
b = input()
a = [int(x) for x in input().split()]
print(t.remove(a))


n = int(input())
num = sorted(list(map(int, input().split())))
if len(num) % 2 == 0:
	print(num[len(num) // 2 - 1])
else:
	print(num[len(num) // 2])


inp = int(input()) - 1
inp_2 = sorted(map(int, input().split()))
print(inp_2[inp // 2])


import sys
input = sys.stdin.readline
ins = lambda : input().rstrip()
ini = lambda : int(input().rstrip())
inm = lambda : map(int, input().rstrip().split())
inl = lambda : list(map(int, input().split()))
out = lambda x, s='\n': print(s.join(map(str, x)))
n = ini()
a = sorted(inl())
print(a[n // 2] if n % 2 else a[n // 2 - 1])


n = int(input())
nums = list(map(int, input().split()))
length = len(nums)
nums = sorted(nums)
if length % 2 == 0:
	print(nums[length // 2 - 1])
else:
	print(nums[length // 2])


n = int(input())
inp = input().split()
li1 = []
for i in inp:
	li1.append(int(i))
li1.sort()
for j in range(1, n):
	if j % 2 == 1:
		li1.pop()
	elif j % 2 == 0:
		li1.pop(0)
print(li1[0])


number = eval(input())
Array = list(map(int, input().split()))
Array = sorted(Array, reverse=False)
count = 1
for i in range(0, number - 1):
	if count % 2 != 0:
		Array.pop(-1)
	else:
		Array.pop(0)
	count = count + 1
print(Array[0])


n = int(input())
a = list(input().split(' '))
a = list((int(x) for x in a))
a = sorted(a)
i = 1
while len(a) > 1:
	if i % 2 == 0:
		a.remove(min(a))
	else:
		a.remove(max(a))
	i += 1
print(a[0])


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


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


n = int(input())
a = sorted([int(i) for i in input().split()])
print(a[n // 2 - (1 - n % 2)])


import sys
n = int(sys.stdin.readline().strip())
line = sys.stdin.readline().strip()
a = list(map(int, line.split()))
a.sort()
print(a[(n - 1) // 2])


n = int(input())
L = sorted([int(x) for x in input().split()])
print(L[len(L) // 2 - 1] if len(L) % 2 == 0 else L[len(L) // 2])


input()
li = list(map(int, input().split()))
while len(li) > 2:
	x = max(li)
	li.remove(x)
	y = min(li)
	li.remove(y)
print(sorted(li)[0])


a = int(input())
s = input()
s = [int(x) for x in s.split(' ')]
s = sorted(s)
if a == 1:
	print(s[0])
elif a % 2 == 1:
	print(s[int(a / 2)])
else:
	print(s[int(a / 2) - 1])


import os
import sys
from io import BytesIO, IOBase
import math

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

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


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


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


n = int(input())
mlist = list(map(int, input().split()))
mlist.sort()
turn = 'X'
i = 0
while i < n:
	a = len(mlist)
	if a == 1:
		break
	elif turn == 'X':
		mlist.remove(mlist[a - 1])
		turn = 'Y'
		i += 1
	else:
		mlist.remove(mlist[0])
		turn = 'X'
		i += 1
print(mlist[0])


R = lambda : map(int, input().split())
n = int(input())
a = sorted(list(R()))
print(a[(n - 1) // 2])


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

def getTransIntList(n):
	first = getIntList()
	m = len(first)
	result = [[0] * n for _ in range(m)]
	for i in range(m):
		result[i][0] = first[i]
	for j in range(1, n):
		curr = getIntList()
		for i in range(m):
			result[i][j] = curr[i]
	return result
n = int(input())
a = getIntList()
a.sort()
if n % 2 == 1:
	print(a[(n - 1) // 2])
else:
	print(a[n // 2 - 1])


n = int(input())
arr = [int(x) for x in input().split()]
arr.sort()
i = 0
while len(arr) != 1:
	if i % 2 == 0:
		arr.remove(max(arr))
	else:
		arr.remove(min(arr))
	i += 1
print(arr[0])


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


n = int(input())
arr = sorted([int(i) for i in input().split()])
print(arr[(n - 1) // 2])


k = input()
a = sorted(list(map(int, input().split())))
print(a[len(a) // 2 - (len(a) + 1) % 2])


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


import sys

def main():
	data = sys.stdin.readlines()
	n = int(data[0])
	array = [int(k) for k in data[1].split()]
	array.sort()
	if n % 2 == 1:
		print(array[int(n / 2)])
	if n % 2 == 0:
		print(array[int(n / 2) - 1])
main()


nmbrs = []
n = input()
sp = input()
sp = sp.split(' ')
for i in sp:
	nmbrs.append(int(i))
nmbrs.sort()
x = int(n) - 1
t = 1
for i in range(0, x):
	if t % 2 == 1:
		nmbrs.remove(nmbrs[int(n) - 1])
	else:
		nmbrs.remove(nmbrs[0])
	n = int(n) - 1
	t = t + 1
print(nmbrs[0])


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


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


n = int(input())
a = list(map(int, input().split()))
flag = True
while len(a) != 1:
	if flag:
		a.remove(max(a))
		flag = False
	else:
		a.remove(min(a))
		flag = True
print(a[0])


n = int(input())
d = list(map(int, input().split()))
while len(d) != 1:
	d.remove(max(d))
	if len(d) == 1:
		break
	d.remove(min(d))
print(d[0])


n = int(input())
a = list(map(int, input().split()))
a = sorted(a)
cur = 2
while len(a) > 1:
	if cur == 1:
		a = a[1:]
		cur = 2
	else:
		a = a[:len(a) - 1]
		cur = 1
print(a[0])


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


def string_list(s, char):
	output_list = []
	intermediator = ''
	for i in range(len(s)):
		if s[i] != char:
			intermediator += s[i]
			if i == len(s) - 1:
				output_list.append(int(intermediator))
		elif intermediator:
			output_list.append(int(intermediator))
			intermediator = ''
	return output_list

def list_string(l, char):
	output_str = ''
	for i in range(len(l) - 1):
		output_str += str(l[i]) + char
	output_str += str(l[len(l) - 1])
	return output_str

def merge_sort(l):

	def merge(l1, l2):
		(i, j) = (0, 0)
		output_list = []
		while i < len(l1) and j < len(l2):
			if l1[i] < l2[j]:
				output_list.append(l1[i])
				i += 1
			else:
				output_list.append(l2[j])
				j += 1
		if i == len(l1):
			output_list += l2[j:]
		else:
			output_list += l1[i:]
		return output_list

	def sorts(l):
		if len(l) < 2:
			return l
		else:
			mid = len(l) // 2
			left = sorts(l[:mid])
			right = sorts(l[mid:])
			return merge(left, right)
	return sorts(l)

def main_function():
	n = int(input())
	l = string_list(input(), ' ')
	sorted_l = merge_sort(l)
	if len(sorted_l) % 2:
		return sorted_l[len(sorted_l) // 2]
	return sorted_l[len(sorted_l) // 2 - 1]
print(main_function())


def a_game(n):
	a = len(n)
	i = 0
	while i < a - 1:
		if i % 2 == 0:
			n.remove(max(n))
		else:
			n.remove(min(n))
		i += 1
	print(n[0])
_ = input()
n = list(map(int, input().split(' ')))
a_game(n)


n = int(input())
values = []
valuesStr = input()
for x in valuesStr.split(' '):
	values.append(int(x))
for i in range(n - 1):
	if i % 2 == 0:
		values.remove(max(values))
	else:
		values.remove(min(values))
print(values[0])


a = int(input())
print(sorted([int(i) for i in input().split()], reverse=True)[a // 2])


n = int(input())
l = [int(x) for x in input().split()]
k = 0
while len(l) > 1:
	i = l.index(min(l)) if k % 2 else l.index(max(l))
	del l[i]
	k = 1 - k
print(l[0])


a = int(input())
b = list(map(int, input().split()))
b.sort()
b.reverse()
print(b[len(b) // 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())
l = [int(y) for y in input().split()]
if n % 2 == 0:
	l.sort()
	print(l[n // 2 - 1])
else:
	l.sort()
	print(l[n // 2])


t = int(input())
l = list(map(int, input().split()))
for i in range(1, t):
	if i % 2 != 0:
		l.remove(max(l))
	else:
		l.remove(min(l))
print(l[0])


n = int(input())
if n > 0:
	val = input().split(' ')
	mat = [int(x) for x in val]
	i = 0
	while i != n - 1:
		mat.remove(max(mat))
		i += 1
		if i == n - 1:
			break
		mat.remove(min(mat))
		i += 1
	print(mat[0])


n = int(input())
a = list(map(int, input().split()))
a = sorted(a)
t = 0
for i in range(0, n - 2):
	if i % 2 == 0:
		t += 1
print(a[t])


n = input()
l = sorted(list(map(int, input().split())))
while len(l) != 1:
	l.pop()
	if len(l) == 1:
		break
	l.pop(0)
print(l[0])


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


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 = input()
f = int(n)
a = [int(x) for x in input().split()]
a.sort()
x = len(a)
if f % 2 != 0:
	print(a[int(x / 2)])
else:
	print(a[int(x / 2) - 1])


n = eval(input())
line = input()
strings = line.split()
list = []
for string in strings:
	list.append(eval(string))
result = sorted(list)
size = len(result)
index = (size - 1) // 2
print(result[index])


n = int(input())
a = list(map(int, input().split()))
a.sort()
(d, m) = divmod(len(a), 2)
if m:
	print(a[d])
else:
	print(a[d - 1])


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


n = input()
a = list(map(int, input().split()))
while len(a) > 1:
	if len(a) > 1:
		a.remove(max(a))
	if len(a) > 1:
		a.remove(min(a))
	else:
		pass
print(a[0])


k = int(input())
nn = [int(x) for x in input().split()]
nOrdenado = sorted(nn)
if k % 2 == 0:
	print(nOrdenado[k // 2 - 1])
else:
	print(nOrdenado[k // 2])


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


import math
input()
a = list(map(int, input().split()))
for i in range(math.ceil(len(a) / 2) - 1):
	a.remove(max(a))
	a.remove(min(a))
if len(a) > 1:
	a.remove(max(a))
print(*a)


from sys import stdin, stdout

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


n = int(input())
l = [int(i) for i in input().split()]
l.sort()
while len(l) > 2 - n % 2:
	l = l[1:]
	l = l[:-1]
	l.sort()
print(l[0])


n = int(input())
s = list(map(int, input().split()))
if n == 1:
	print(s[0])
else:
	k = 0
	s.sort()
	while k < n - 1:
		a = len(s)
		if k % 2 == 0:
			del s[a - 1]
		else:
			del s[0]
		k = k + 1
	print(s[0])


a = int(input())
b = [int(x) for x in input().split()]
b.sort()
if a % 2 == 0:
	c = a // 2
else:
	c = (a + 1) // 2
print(b[c - 1])


x = int(input())
num = [int(a) for a in input().split(' ')]
s_num = sorted(num, reverse=True)
print(s_num[len(num) // 2])


from math import ceil
n = int(input())
g = list(map(int, input().split()))
g.sort()
if n % 2 == 0:
	print(g[n // 2 - 1])
else:
	print(g[n // 2])


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


import sys
n = int(input())
numbers = list(map(int, input().split()))
turn = False
numbers = sorted(numbers)
for x in range(0, n - 1):
	if turn:
		numbers.pop(0)
		turn = False
	else:
		numbers.pop(-1)
		turn = True
print(numbers[0])


n = int(input())
a = list(map(int, input().split(' ')))
a.sort(reverse=True)
print(a[n >> 1])


from math import *
n = int(input())
tab = list(map(int, input().split()))
tab.sort()
print(tab[-ceil((n - 1) / 2) - 1])


import sys

def main():
	n = int(sys.stdin.readline())
	l = sorted(list(map(int, sys.stdin.readline().split())))
	print(l[(n - 1) // 2])
main()


n = int(input())
x = list(map(int, input().split()))
while len(x) != 1:
	x.remove(max(x))
	if len(x) != 1:
		x.remove(min(x))
print(x[0])


int(input())
data = [int(j) for j in input().split(' ')]
data.sort()
if len(data) % 2 == 1:
	print(data[len(data) // 2])
else:
	print(data[len(data) // 2 - 1])


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


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


n = int(input())
a_i = sorted([int(x) for x in input().split()])
if n % 2 == 1:
	print(a_i[n // 2])
else:
	print(a_i[n // 2 - 1])


n = int(input())
l = [int(i) for i in input().strip().split()]
l.sort(reverse=True)
print(l[len(l) // 2])


n = int(input())
steps = list(map(int, input().split()))
if len(steps) == 1:
	print(*steps)
	exit()
elif len(steps) == 2:
	print(min(steps))
	exit()
elif n % 2 != 0:
	for i in range(n - 1):
		steps.remove(max(steps))
		steps.remove(min(steps))
		if len(steps) == 1:
			print(*steps, sep=' ')
			exit()
else:
	for i in range(n - 2):
		steps.remove(max(steps))
		steps.remove(min(steps))
		if len(steps) == 2:
			print(min(steps))
			exit()


import math
n = int(input())
a = [int(i) for i in input().split(' ')]
t = math.ceil((n - 1) / 2)
a = sorted(a)
a = a[::-1]
print(a[t])


n = int(input())
x = [int(i) for i in input().split()]
i = 0
flag = 0
while len(x) != 1:
	if flag == 0:
		x.remove(max(x))
		flag = 1
	elif flag == 1:
		x.remove(min(x))
		flag = 0
print(x[0])


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


x = int(input())
aList = list(map(int, input().split()))
sortList = []
if len(aList) % 2 != 0:
	sortList = sorted(aList)
	print(sortList[len(aList) // 2])
	sortList.clear()
else:
	sortList = sorted(aList)
	print(sortList[len(aList) // 2 - 1])


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


n = int(input())
s = [int(elem) for elem in input().split()]
s.sort()
player = 1
while len(s) > 1:
	if player == 1:
		s = s[:len(s) - 1]
		player = 2
	else:
		s = s[1:]
		player = 1
print(s[0])


n = int(input())
stu = input().split()
lstu = []
for i in range(n):
	lstu.append(int(stu[i]))
for i in range(n):
	for j in range(i + 1, n):
		if lstu[i] > lstu[j]:
			d = lstu[i]
			lstu[i] = lstu[j]
			lstu[j] = d
if n % 2 == 1:
	print(lstu[n // 2])
else:
	print(lstu[n // 2 - 1])


M = int(input())
L = input().split(' ')
for i in range(M):
	L[i] = int(L[i])
	pass
H = 1
for i in range(M - 1):
	if H == 1:
		L.remove(max(L))
		H = 2
	else:
		L.remove(min(L))
		H = 1
print(str(L[0]))


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


n = int(input())
numbers = sorted([int(c) for c in input().split()])
idx = n // 2
if n % 2 == 0:
	idx -= 1
print(numbers[idx])


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())


import sys
import io
stream_enable = 0
inpstream = '\n3\n2 1 3\n\n'
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)])


t = int(input())
b = [int(s) for s in input().split()]
b.sort()
if t % 2 == 1:
	print(b[t // 2])
else:
	print(b[t // 2 - 1])


import math
n = int(input())
li = []
m = input()
li = m.split(' ')
li = list(map(int, li))
li.sort()
p = n - 1
for i in range(0, n - 1):
	p = len(li)
	if i % 2 == 0:
		li.pop(p - 1)
	else:
		li.pop(0)
p = li[0]
print(p)


a = int(input())
b = sorted([int(i) for i in input().split()])
for i in range(a - 1):
	if i % 2 == 0:
		del b[-1]
	else:
		del b[0]
print(*b)


input()
l = sorted(map(int, input().split()))
print(l[(len(l) - 1) // 2])


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


n = int(input())
n1 = list(map(int, input().split()))
n1.sort()
if n == 1:
	print(n1[0])
else:
	for i in range(len(n1)):
		if len(n1) == 2:
			print(n1[0])
			break
		if len(n1) == 1:
			print(n1[0])
			break
		n1.remove(n1[0])
		n1.remove(n1[-1])


def middle_element(A):
	if len(A) == 1:
		return A[0]
	A.sort()
	if len(A) % 2 == 0:
		return A[len(A) // 2 - 1]
	else:
		return A[len(A) // 2]
n = int(input())
numbers = list(map(int, input().split()))
print(middle_element(numbers))


n = int(input())
data = input().split()
for idx in range(n):
	data[idx] = int(data[idx])
data.sort()
if n % 2:
	print(data[n // 2])
else:
	print(data[n // 2 - 1])


n = int(input())
val = list(map(int, input().split()))
p1 = 0
while n > 1:
	if p1 % 2 == 0:
		p1 += 1
		val.remove(max(val))
		n -= 1
	else:
		val.remove(min(val))
		n -= 1
		p1 += 1
print(val[0])


input()
a = list(map(int, input().split()))
m = len(a) // 2
if len(a) % 2 == 0:
	m -= 1
a = sorted(a)
print(a[m])


n = int(input())
l = list(map(int, input().split()))
(l1, l2, k1, k2) = ([], [], 0, 0)
for i in l:
	l1.append(i)
	l2.append(i)
l1.sort()
l2.sort(reverse=True)
for i in range(n - 1):
	if i % 2 == 0:
		k2 += 1
	else:
		k1 += 1
if (n - 1) % 2 == 0:
	print(l2[k2])
else:
	print(l1[k1])


length = int(input())
l = input().split(' ')
l = [int(e) for e in l]
assert len(l) == length
l = sorted(l)
print(l[(len(l) - 1) // 2])


input()
a = sorted(list(map(int, input().split())))
i = 0
while len(a) != 1:
	if i % 2 == 0:
		a.pop()
		i += 1
	else:
		a.pop(0)
		i += 1
print(*a)


n = int(input())
a = [int(i) for i in input().split()]
for i in range(len(a)):
	for j in range(i + 1, len(a)):
		if a[i] <= a[j]:
			(a[i], a[j]) = (a[j], a[i])
print(a[n // 2])


t = int(input())
p1 = list(map(int, input().split()))
while len(p1) != 1:
	p1.remove(max(p1))
	if len(p1) == 1:
		break
	p1.remove(min(p1))
print(p1[0])


from sys import stdin
n = int(stdin.readline())
values = sorted(map(int, stdin.readline().strip().split()))
print(values[(n - 1) // 2])


n = int(input())
ListOf_n = list(map(int, input().split()))
del ListOf_n[n:]
for i in range(n - 1):
	if i % 2 == 0:
		max_num1 = max(ListOf_n)
		try:
			ListOf_n.remove(max_num1)
		except Exception as e:
			print(e)
	else:
		min_num1 = min(ListOf_n)
		try:
			ListOf_n.remove(min_num1)
		except Exception as e:
			print(e)
print(ListOf_n[0])


n = int(input().strip())
arr = [int(i) for i in input().strip().split()]
arr.sort()
print(arr[n // 2] if n % 2 == 1 else arr[n // 2 - 1])


s = int(input())
l = list(map(int, input().split(' ')))
l.sort()
print(l[(s - 1) // 2])


import math

def s():
	n = int(input())
	arr = [int(x) for x in input().split(' ')]
	arr.sort()
	print(arr[(n - 1) // 2])
s()


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


n = int(input())
li = list(map(int, input().split()))
if n == 1:
	print(li[0])
if n == 2:
	print(min(li))
li.sort(reverse=True)
even = 0
for i in range(n - 1):
	if even == 0:
		li.pop(0)
		even = 1
	elif even == 1:
		li.pop()
		even = 0
if n >= 3:
	print(li[0])


n = int(input())
a = list(map(int, input().split()))
a.sort()
for i in range(n - 1):
	if i % 2 == 0:
		del a[-1]
	elif i % 2 == 1:
		del a[0]
print(a[0])


import sys
import math

def fun():
	N = int(input())
	array = list(map(int, input().split()))
	array.sort()
	print(array[int((N - 1) / 2)])
fun()


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


n = int(input())
lst = list(map(int, input().split()))
lst.sort(reverse=True)
print(lst[n // 2])


numNumbers = int(input())
numbers = list(map(int, input().split(' ')))
numbers.sort(reverse=True)
print(numbers[numNumbers // 2])


n = int(input())
array = [int(i) for i in input().split()]
flag = 1
while n != 1:
	if flag:
		index = array.index(max(array))
		array.pop(index)
		flag = 0
		n -= 1
	else:
		index = array.index(min(array))
		array.pop(index)
		flag = 1
		n -= 1
print(array[0])


n = int(input())
a = sorted(map(int, input().split()), reverse=True)
print(a[n // 2])


n = int(input())
x = input().split(' ')
l = list()
for i in range(n):
	l.append(int(x[i]))
t = 0
while True:
	if n == 1:
		break
	l.remove(max(l))
	t += 1
	if t == n - 1:
		break
	l.remove(min(l))
	t += 1
	if t == n - 1:
		break
print(l[0])


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


n = int(input())
t = list(map(int, input().split()))
if len(t) != 1:
	for i in range(n // 2):
		t.remove(max(t))
	for i in range(n // 2 - 1):
		t.remove(min(t))
	if n % 2 != 0:
		t.remove(min(t))
print(t[0])


import math
number = int(input())
first = list(map(int, input().split()))
first.sort()
first.reverse()
print(first[math.floor(number / 2)])


n = int(input())
numbers = [int(w) for w in input().split()]
numbers.sort()
print(numbers[int((len(numbers) - 0.1) / 2)])


n = int(input())
a = list(map(int, input().split()))
print(list(reversed(sorted(a)))[n // 2])


x = int(input())
l = list(map(int, input().split()))
l.sort()
i = 0
while len(l) != 1:
	i += 1
	if i == 1:
		l.pop()
	if i == 2:
		l.pop(0)
		i = 0
x = l[0]
print(x)


t_moves = int(input())
moves = t_moves - 1
a = list(map(int, input().split()))
a.sort()
i = 0
j = t_moves - 1
while moves:
	if moves == 1:
		j -= 1
		moves -= 1
	else:
		j -= 1
		i += 1
		moves -= 2
print(a[j])


n = int(input())
x = [int(y) for y in input().split()]
while n >= 3:
	x.remove(max(x))
	x.remove(min(x))
	n -= 2
print(min(x))


n = int(input())
l = [int(i) for i in input().split()]

def bubbleSort(l):
	size = len(l)
	while size > 1:
		for i in range(size - 1):
			if l[i] > l[i + 1]:
				tmp = l[i]
				l[i] = l[i + 1]
				l[i + 1] = tmp
		size = size - 1
bubbleSort(l)
if n % 2 == 1:
	print(l[int(n / 2)])
else:
	print(l[int(n / 2) - 1])


n = eval(input())
line = input()
strings = line.split()
list = []
for string in strings:
	list.append(eval(string))
sortedList = sorted(list)
size = len(list)
i = (size - 1) // 2
print(sortedList[i])


a = int(input())
b = [int(x) for x in input().split()]
i = 1
while i < a:
	if i % 2 == 1:
		b.remove(max(b))
	else:
		b.remove(min(b))
	i += 1
print(b.pop())


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


from math import ceil
T = int(input())
L = list(map(int, input().split()))
L.sort()
if len(L) % 2:
	print(L[int(len(L) // 2)])
else:
	print(L[int(len(L) // 2) - 1])


def game():
	n = int(input())
	numbers = list(map(int, input().split(sep=' ')))
	numbers = sorted(numbers)
	if len(numbers) % 2 == 0:
		print(numbers[n // 2 - 1])
	else:
		print(numbers[n // 2])
game()


import time

def calculateLastNumber(nums, numsList):
	numsList.sort()
	pos = 0
	if nums % 2 == 0:
		pos = nums // 2 - 1
	else:
		pos = nums // 2
	return numsList[pos]

def solve():
	nums = int(input())
	numsList = list(map(int, input().split()))
	print(calculateLastNumber(nums, numsList))
solve()


N = int(input())
numbers = [int(x) for x in input().split(' ')]
numbers.sort()
print(numbers[(len(numbers) + 1) // 2 - 1])


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


a = int(input())
b = list(map(int, input().split()))
b.sort(reverse=True)
print(b[a // 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])


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


n = int(input())
line = input().split()
a = []
for i in range(n):
	a.append(int(line[i]))
a.sort()
print(a[(n - 1) // 2])


n = int(input())
ai = list(map(int, input().split()))
if n > 2:
	while len(ai) > 1:
		ai.pop(ai.index(max(ai)))
		ai.pop(ai.index(min(ai)))
		if n % 2 == 0:
			if len(ai) == 2:
				print(min(ai))
		elif len(ai) == 1:
			print(*ai)
else:
	print(min(ai))


n = int(input())
strArr = input().split()
numArr = list(map(lambda s: int(s), strArr))
numArr.sort()
print(numArr[(numArr.__len__() - 1) // 2])


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


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


N = int(input())
numbers = list(map(int, input().split(' ')[:N]))
for x in range(1, N):
	if x % 2 == 0:
		numbers.remove(min(numbers))
	else:
		numbers.remove(max(numbers))
print(numbers[0])


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


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


n = int(input())
arr = input().split()
for i in range(len(arr)):
	arr[i] = int(arr[i])
for i in range(len(arr)):
	for j in range(len(arr) - 1):
		if arr[j] > arr[j + 1]:
			(arr[j], arr[j + 1]) = (arr[j + 1], arr[j])
if n % 2 == 0:
	print(arr[n // 2 - 1])
else:
	print(arr[n // 2])


n = int(input())
a = [*map(int, input().split())]
a.sort()
j = 0
for i in range(10 ** 9):
	if j + 1 == len(a):
		break
	if i % 2 == 0:
		a.pop()
	else:
		j += 1
print(a[j])


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


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


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


a = int(input())
b = list(map(int, input().split()))
c = sorted(b)
if len(c) % 2 != 0:
	print(c[(len(c) + 1) // 2 - 1])
else:
	print(c[len(c) // 2 - 1])


a = int(input())
l = list(map(int, input().split()))
l.sort()
x = 0
y = a - 1
r = 0
for i in range(len(l) - 1):
	if i % 2 == 0:
		l[y - r] = 0
		r += 1
	elif i % 2 != 0:
		l[x] = 0
		x += 1
print(max(l))


from statistics import median
n = int(input())
a = [int(x) for x in input().split(' ')]
if len(a) % 2 == 0:
	a.remove(max(a))
print(median(a))


n = int(input())
a = list(map(int, input().split()))
while True:
	if len(a) == 1:
		break
	a.remove(max(a))
	if len(a) == 1:
		break
	a.remove(min(a))
	if len(a) == 1:
		break
print(a[0])


a = int(input())
b = list(map(int, input().split()))
b.sort()
print(b[(a + 1) // 2 - 1])


def max1(a):
	p = a[0]
	for x in a:
		if x > p:
			p = x
	return p

def preobr(x):
	if x % 2 == 1:
		return x + 1
	else:
		return x - 1

def prlist(a):
	for x in a:
		print(x, end=' ')

def dlin(n):
	k = 0
	while n > 0:
		n -= k
		k += 1
	return k - 1

def foundm(x, a):
	for i in range(len(a)):
		if x == a[i]:
			return i
	return -1

def max1m(a):
	k = max(a)
	for i in range(len(a)):
		if a[i] == k:
			return i

def min1m(a):
	k = min(a)
	for i in range(len(a)):
		if a[i] == k:
			return i
n = int(input())
a = list(map(int, input().split()))
fl = True
while len(a) > 1:
	b = []
	c = []
	t = len(a)
	if fl:
		b = a[0:max1m(a)]
		c = a[max1m(a) + 1:t]
		fl = False
	else:
		b = a[0:min1m(a)]
		c = a[min1m(a) + 1:t]
		fl = True
	a = b + c
	t = len(a)
print(a[0])


def do():
	N = int(input())
	ch = input()
	ch = [int(i) for i in ch.split()]
	ch.sort()
	print(ch[(N - 1) // 2])
do()


def game(c, te):
	te.sort()
	if c % 2 == 0:
		print(te[int(c / 2) - 1])
	else:
		print(te[int(c / 2)])
asa = int(input())
ar = input()
br = list(map(int, ar.split()))
game(asa, br)


import os, sys, math

def main():
	T = int(input())
	testcase()

def testcase():
	l = [int(x) for x in input().split()]
	print(solve(l))

def solve(l):
	l.sort()
	n = len(l)
	if n % 2 == 0:
		i = n // 2 - 1
	else:
		i = n // 2
	return l[i]

def debug(*args):
	if 'DEBUG' in os.environ:
		print(*args)
main()


n = int(input())
list1 = []
list1 = list(map(int, input().split()))
list1.sort()
if n % 2 == 0:
	x = int(n / 2) - 1
	y = list1[x]
	print(y)
if n % 2 == 1:
	x = int(n / 2)
	y = list1[x]
	print(y)


class Game:

	def main(self):
		n = int(input())
		arr = [int(x) for x in input().split()]
		arr.sort()
		count = len(arr)
		if count % 2 == 0:
			result = arr[int(count / 2) - 1]
		else:
			result = arr[int(count / 2)]
		print(result)
g = Game()
g.main()


import math
n = int(input())
ch = [int(x) for x in input().split()]
ch.sort()
if n % 2 == 0:
	print(ch[int(len(ch) / 2 - 1)])
else:
	print(ch[math.floor(len(ch) / 2)])


import sys
input = sys.stdin.readline
L = lambda : list(map(int, input().split()))
M = lambda : map(int, input().split())
n = int(input())
l = L()
l.sort()
if n % 2 == 0:
	n = n // 2 - 1
else:
	n = n // 2
print(l[n])


n = int(input())
a = map(int, input().split())
a = list(a)
a.sort()
tag = True
for i in range(n - 1):
	if tag:
		del a[-1]
		tag = False
	else:
		del a[0]
		tag = True
print(a[0])


n = int(input(' '))
m = input().split(' ')
m.sort(key=float)
if n % 2 == 1:
	h = int(n // 2 + 1)
else:
	h = int(n // 2)
print(m[h - 1])


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])


n = int(input())
nums = []
str = [int(num) for num in input().split()]
for i in range(n):
	k = max(str)
	nums.append(k)
	str.remove(k)
for i in range(n):
	if len(nums) == 1:
		for i in nums:
			print(i)
		break
	elif len(nums) == 2:
		nums.remove(nums[0])
	else:
		nums.remove(nums[0])
		nums.remove(nums[-1])


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


x = int(input())
y = list(map(int, input().split(' ')))
for i in range(x - 1):
	if i % 2 == 0:
		del y[y.index(max(y))]
	else:
		del y[y.index(min(y))]
print(*y)


q = int(input())
w = list(map(int, input().split()))
e = 0
if q % 2 == 0:
	w.remove(max(w))
	e = 2
for i in range((q - e) // 2):
	w.remove(max(w))
	w.remove(min(w))
print(*w)


n = int(input())
l = list(map(int, input().split()))
l.sort()
import collections
de = collections.deque(l)
for i in range(len(de) - 1):
	if i % 2 == 0:
		de.pop()
	else:
		de.popleft()
print(*de)


n = int(input())
s = list(map(int, input().split()))
while len(s) != 1:
	m1 = max(s)
	if len(s) != 1:
		s.remove(m1)
	m2 = min(s)
	if len(s) != 1:
		s.remove(m2)
print(*s)


a = int(input())
b = list(map(int, input().split()))
b.sort()
import math
if len(b) % 2 == 0:
	print(b[math.floor(len(b) / 2) - 1])
else:
	print(b[math.floor(len(b) / 2)])


try:
	n = int(input())
	sequence = list(map(int, input().split()))
	sequence.sort()
	count = 2
	for each in range(0, n - 1):
		if count % 2 == 0:
			sequence.remove(sequence[-1])
		else:
			sequence.remove(sequence[0])
		count += 1
	print(sequence[0])
except:
	pass


n = int(input())
s = input().split()
a = []
j = 0
for i in range(n):
	s[i] = int(s[i])
	a.append(s[i])
while len(a) > 1:
	if j % 2 == 0:
		maximum = max(a)
		a.remove(maximum)
	else:
		minimum = min(a)
		a.remove(minimum)
	j += 1
print(a[0])


n = int(input())
s = input().split(' ')
a = []
for i in range(n):
	a.append(int(s[i]))
a.sort()
print(a[int((len(a) - 1) / 2)])


n = int(input())
r = 0
e = 0
p = [int(a) for a in input().split(' ')]
p.sort()
e = n // 2
if e * 2 == n:
	e = e - 1
	r = p[e]
else:
	r = p[e]
print(r)


t = int(input())
a = input()
if (t - 1) % 2 == 0:
	fmove = (t - 1) // 2
	smove = t - 1 - fmove
else:
	fmove = (t - 1) // 2 + 1
	smove = t - 1 - fmove
a = [int(x) for x in a.split()]
a = sorted(a)
for y in range(fmove):
	a.pop(-1)
for y in range(smove):
	a.pop(0)
print(a[0])


n = input()
l = [int(x) for x in input().split()]
l.sort(reverse=False)
if len(l) % 2 == 0:
	print(l[int((len(l) - 1) / 2)])
else:
	print(l[int(len(l) / 2)])


n = int(input())
x = []
arr = input()
l = list(map(int, arr.split(' ')))
for k in range(n):
	x.append(l[k])
x.sort()
if n == 1:
	print(x[0])
elif n % 2 == 0:
	print(x[n // 2 - 1])
else:
	print(x[int(n / 2)])


n = int(input())
a = [int(s) for s in input().split(' ')]
if n == 1:
	print(a[0])
	exit()
first = 1
for i in range(n - 1):
	if first == 1:
		m = max(a)
		for i in range(len(a)):
			if a[i] == m:
				del a[i]
				break
		first = 0
	else:
		m = min(a)
		for i in range(len(a)):
			if a[i] == m:
				del a[i]
				break
		first = 1
print(a[0])


a = int(input())
x = [int(i) for i in input().split()]
if len(x) % 2 != 0:
	while len(x) != 1:
		b = max(x)
		x.remove(b)
		c = min(x)
		x.remove(c)
else:
	while len(x) != 2:
		b = max(x)
		x.remove(b)
		c = min(x)
		x.remove(c)
	b = max(x)
	x.remove(b)
print(x[0])


n = int(input())
ln = list(map(int, input().split()))
ln.sort(reverse=True)
for i in range(n):
	if len(ln) > 2:
		o1h = ln.sort(reverse=True)
		o1 = ln.pop(0)
		o2h = ln.sort(reverse=False)
		o2 = ln.pop(0)
if len(ln) == 2:
	o1h = ln.sort(reverse=True)
	o1 = ln.pop(0)
print(ln[0])


x = int(input())
s = [int(n) for n in input().split()]
s.sort()
for n in range(x):
	if len(s) > 2:
		del s[s.index(max(s))]
		del s[s.index(min(s))]
print(s[0])


import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *

class Scanner:

	@staticmethod
	def int():
		return int(sys.stdin.readline().rstrip())

	@staticmethod
	def string():
		return sys.stdin.readline().rstrip()

	@staticmethod
	def map_int():
		return [int(x) for x in Scanner.string().split()]

	@staticmethod
	def string_list(n):
		return [input() for i in range(n)]

	@staticmethod
	def int_list_list(n):
		return [Scanner.map_int() for i in range(n)]

	@staticmethod
	def int_cols_list(n):
		return [int(input()) for i in range(n)]

class Math:

	@staticmethod
	def gcd(a, b):
		if b == 0:
			return a
		return Math.gcd(b, a % b)

	@staticmethod
	def lcm(a, b):
		return a * b // Math.gcd(a, b)

	@staticmethod
	def divisor(n):
		res = []
		i = 1
		for i in range(1, int(n ** 0.5) + 1):
			if n % i == 0:
				res.append(i)
				if i != n // i:
					res.append(n // i)
		return res

	@staticmethod
	def round_up(a, b):
		return -(-a // b)

	@staticmethod
	def is_prime(n):
		if n < 2:
			return False
		if n == 2:
			return True
		if n % 2 == 0:
			return False
		d = int(n ** 0.5) + 1
		for i in range(3, d + 1, 2):
			if n % i == 0:
				return False
		return True

def pop_count(x):
	x = x - (x >> 1 & 6148914691236517205)
	x = (x & 3689348814741910323) + (x >> 2 & 3689348814741910323)
	x = x + (x >> 4) & 1085102592571150095
	x = x + (x >> 8)
	x = x + (x >> 16)
	x = x + (x >> 32)
	return x & 127
MOD = int(1000000000.0) + 7
INF = int(1000000000000000.0)

def isOK(A):
	A.sort()
	for i in range(len(A) - 1):
		if A[i] + 1 != A[i + 1]:
			return False
	return True

def solve():
	N = Scanner.int()
	A = Scanner.map_int()
	A.sort(reverse=True)
	for i in range(N - 1):
		if i % 2 == 0:
			A.pop(0)
		else:
			A.pop()
	print(A[0])

def main():
	solve()
main()


m = int(input())
l = [int(i) for i in input().split()]
l.sort(reverse=True)
print(l[m // 2])


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


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


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


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


noe = int(input())
arr = [int(x) for x in input().split()]
arr = sorted(arr)
x = [noe // 2 - 1, noe // 2][noe % 2 == 1]
print(arr[x])


n = int(input())
b = n - 1
x = [int(x) for x in input().split()]
x.sort()
if n % 2:
	print(x[b // 2])
elif x[(b + 1) // 2] <= x[(b - 1) // 2]:
	print(x[(b + 1) // 2])
else:
	print(x[(b - 1) // 2])


n = int(input())
a = list(map(int, input().split()))
a.sort()
f = 0
for i in range(n - 1):
	if f == 0:
		a = a[:-1]
		f = 1
	else:
		del a[0]
		f = 0
print(a[0])


from collections import deque

def solve(arr):
	q = deque(sorted(arr))
	m = True
	while q:
		if m:
			c = q.pop()
			m = not m
		else:
			c = q.popleft()
			m = not m
	return c

def main():
	n = int(input())
	arr = list(map(int, input().split()))
	print(solve(arr))
main()


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


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


from collections import deque
import sys
input = sys.stdin.readline

def main():
	n = int(input())
	l = list(map(int, input().split()))
	l.sort()
	l = deque(l)
	while len(l) > 1:
		l.pop()
		if len(l) > 1:
			l.popleft()
	print(l[0])
main()


f = lambda : map(int, input().split())
n = int(input())
b = sorted(list(f()))
print([b[n // 2 - 1], b[n // 2]][n % 2])


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


n = int(input())
nums = input().split()
nums = [int(c) for c in nums]
nums = sorted(nums)
i = 0
if n % 2 != 0:
	print(nums[n // 2])
else:
	print(nums[n // 2 - 1])


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


t = int(input())
l = list(map(int, input().split()))
l.sort(reverse=True)
a = int(t / 2)
print(l[a])


n = int(input())
alldata = input()
data = []
all = alldata.split()
for i in range(n):
	data.append(int(all[i]))
data.sort()
if n % 2 == 1:
	h = int(n / 2)
	print(data[h])
else:
	h = int(n / 2)
	h = h - 1
	print(data[h])


n = int(input())
k = list(map(int, input().split()))
k = sorted(k)
t = n // 2
if n % 2 == 0:
	print(k[t - 1])
else:
	print(k[t])


n = int(input())
arr = [0] * n
arr = list(map(int, input().split()))
arr.sort(reverse=True)
print(arr[int(n / 2)])


n = int(input())
str_arr = input().split(' ')
arr = [int(num) for num in str_arr]
arr.sort()
if n % 2:
	print(arr[n // 2])
else:
	print(arr[n // 2 - 1])


n = int(input())
l = sorted([int(s) for s in input().split()])
if len(l) % 2 == 1:
	print(l[(len(l) - 1) // 2])
else:
	print(l[len(l) // 2 - 1])


nItems = int(input())
items = sorted([int(k) for k in input().split()])
print(items[(nItems - 1) // 2])


n = int(input())
l = sorted(list(map(int, input().split())))
x = sum(l)
i = 0
while len(l) > 1:
	if i % 2 == 0:
		x -= max(l)
		l.remove(max(l))
	elif i % 2 != 0:
		x -= min(l)
		l.remove(min(l))
	i += 1
print(x)


n = int(input())
numbers = [int(i) for i in input().split(' ')]
numbers = sorted(numbers)
print(numbers[(len(numbers) - 1) // 2])


num = int(input())
array = input().strip().split()
array = list(map(lambda x: int(x), array))
array.sort()
for i in range(num - 1):
	if i % 2 == 0:
		array.pop()
	else:
		array.pop(0)
print(array[0])


n = int(input())
ip = [int(x) for x in input().split()]
ip = sorted(ip)
print(ip[(n + 1) // 2 - 1])


import sys
line = int(sys.stdin.readline().strip())
original = list(map(int, sys.stdin.readline().strip().split()))
original.sort()
if line == 1:
	res = 0
elif line % 2 == 0:
	res = line // 2 - 1
else:
	res = line // 2
print(original[res])


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def main():
	n = I()
	a = sorted(LI())
	return a[(n - 1) // 2]
print(main())


n = int(input())
x = list(map(int, input().split(' ')))
for i in range(0, n - 1, 1):
	for j in range(i + 1, n, 1):
		if x[i] > x[j]:
			t = x[i]
			x[i] = x[j]
			x[j] = t
if n % 2 == 0:
	print(x[n // 2 - 1])
else:
	print(x[(n - 1) // 2])


n = int(input(''))
data = sorted([int(a) for a in input('').split()])
if len(data) % 2 != 0:
	print(data[int((1 + len(data)) / 2 - 1)])
else:
	print(data[int(len(data) / 2 - 1)])


n = int(input())
d = sorted([x for x in map(int, input().split())])
print(d[int((n - 1) / 2)])


n = int(input())
a = [int(i) for i in input().strip().split(' ')]
sa = sorted(a)
if n % 2 == 0:
	print(sa[int(n / 2) - 1])
else:
	print(sa[int(n / 2)])


n = int(input())
number_list = sorted(map(int, input().split()))
last = number_list[n // 2 - (n % 2 == 0)]
print(last)


n = int(input())
array = []
line = input()
for x in line.split():
	array.append(int(x))
array.sort()
print(array[(n + 1) // 2 - 1])


def main():
	n = int(input())
	a = [int(_) for _ in input().split()]
	a.sort()
	print(a[(n - 1) // 2])
main()


def sort(n, a):
	list = a
	for i in range(0, n):
		for j in range(0, n):
			if list[i] > list[j]:
				t = list[i]
				list[i] = list[j]
				list[j] = t
	return list

def erase(n, a):
	temp = 1
	list = sort(n, a)
	t = 0
	print(a[n // 2])
n = int(input())
a = [int(i) for i in input().split()]
erase(n, a)


def maks(data):
	hasil = 0
	for i in data:
		if int(i) > hasil:
			hasil = int(i)
	return hasil

def minimum(data):
	for i in range(len(data)):
		if i == 0:
			hasil = int(data[i])
		elif int(data[i]) < hasil:
			hasil = int(data[i])
	return hasil
n = int(input())
angka = input().split()
for i in range(n):
	angka[i] = int(angka[i])
for i in range(n - 1):
	if i % 2 == 0:
		del angka[angka.index(maks(angka))]
	else:
		del angka[angka.index(minimum(angka))]
for i in angka:
	print(i)


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


a = int(input())
b = list(map(int, input().split()))
for i in range(1, a):
	if i % 2 == 1:
		h = 0
		for j in range(0, len(b)):
			if h < b[j]:
				h = b[j]
				p = j
		del b[p]
	else:
		k = 100000001
		for j in range(0, len(b)):
			if k > b[j]:
				k = b[j]
				o = j
		del b[o]
print(*b)


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


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


n = int(input())
ar = sorted(map(int, input().split()))
if n % 2 == 0:
	print(ar[n // 2 - 1])
else:
	print(ar[n // 2])


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


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


n = int(input())
a = [int(x) for x in input().strip().split(' ')]
a.sort()
c = 1
for i in range(n - 1):
	if c == 1:
		a.pop(-1)
	else:
		a.pop(0)
	c ^= 1
print(a[0])


_ = int(input())
arr = list(map(int, input().split()))
len_arr = len(arr)
print(sorted(arr)[len_arr // 2 - 1 if len_arr % 2 == 0 else len_arr // 2])


n = int(input())
l = list(map(int, input().split()))
if n == 1:
	print(l[0])
elif n == 2:
	m = max(l)
	i = l.index(m)
	del l[i]
	print(l[0])
else:
	while n > 1:
		m = max(l)
		i = l.index(m)
		del l[i]
		n -= 1
		if n == 1:
			break
		m = min(l)
		i = l.index(m)
		del l[i]
		n -= 1
	print(l[0])


n = int(input())
arr = sorted(list(map(int, input().split())))
for i in range(0, n - 1):
	if i % 2 == 0:
		m = max(arr)
		arr.remove(m)
	else:
		m = min(arr)
		arr.remove(m)
print(arr[0])


k = int(input())
a = [int(x) for x in input().split()]
a.sort(reverse=True)
print(a[int(k / 2)])


from math import ceil

def main():
	n = int(input())
	vals = [int(v) for v in input().split()]
	vals.sort()
	print(vals[n // 2] if n % 2 != 0 else vals[n // 2 - 1])
main()


def game(n, ls):
	ls.sort()
	k = int(len(ls) / 2)
	if len(ls) % 2 == 0:
		k = k - 1
	return ls[k]
n = int(input())
ls = [int(i) for i in input().split()]
print(game(n, ls))


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


n = int(input())
a = input()
a = [int(x) for x in a.split()]
a.sort()
while len(a) > 1:
	a = a[:-1]
	if len(a) > 1:
		a = a[1:]
print(a[0])


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


T = int(input())
l = list(map(int, input().split()))
l = sorted(l)
if len(l) % 2 == 1:
	print(l[len(l) // 2])
else:
	print(l[len(l) // 2 - 1])


n = int(input())
l = sorted([int(i) for i in input().split()])
l[n // 2]
if n % 2 != 0:
	print(l[n // 2])
else:
	print(l[n // 2 - 1])


n = int(input())
l = sorted(map(int, input().split()))
i = 0
while len(l) != 1:
	if i % 2 == 0:
		l.pop()
	else:
		l = l[1:]
	i += 1
print(*l)


import math
count = int(input())
data = list(map(int, input().split()))
data.sort()
midle = math.floor((count - 1) / 2)
print(data[midle])


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


n = int(input())
s = [int(x) for x in input().split()]
for i in range(n - 1):
	if i % 2 == 0:
		mx = max(s)
		s.remove(mx)
	else:
		mn = min(s)
		s.remove(mn)
print(*s)


line0 = int(input())
line1 = [int(i) for i in input().split()]
line1 = sorted(line1)
if line0 % 2 == 0:
	ind = len(line1) / 2 - 1
else:
	ind = (len(line1) - 1) * 0.5
ind = int(ind)
print(line1[ind])


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


x = 0
y = 0
s = int(input())
a = [int(x) for x in input().split()]
m = sorted(a)
x = int(s / 2)
y = s % 2
if y == 0:
	print(m[x - 1])
else:
	print(m[x])


_ = int(input())
l = list(map(int, input().split(' ')))
l.sort()
print(l[int((_ - 1) / 2)])


def median(n):
	if n % 2 == 0:
		return n // 2 - 1
	return n // 2

def left_over(n, board):
	return board[median(n)]
n = int(input())
board = [int(i) for i in input().split()]
board = sorted(board)
print(left_over(n, board))


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

def insertionSort(n, arr):
	for index in range(n):
		currentvalue = arr[index]
		position = index
		while position > 0 and arr[position - 1] > currentvalue:
			arr[position] = arr[position - 1]
			position = position - 1
			arr[position] = currentvalue

def game(n, arr):
	if n == 1:
		return arr[0]
	else:
		insertionSort(n, arr)
		stop = False
		while not stop:
			arr.pop(-1)
			if len(arr) == 1:
				break
			arr.pop(0)
			if len(arr) == 1:
				break
		return arr[0]
ans = game(n, arr)
print(ans)


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


n = int(input())
A = sorted(map(int, input().split()))
(left, right) = (-1, n)
for i in range(n - 1):
	if i % 2 == 1:
		left += 1
	else:
		right -= 1
assert left + 1 == right - 1 == (n - 1) // 2
print(A[~-n // 2])


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


n = int(input())
x = list(map(int, input().split()))
l = 0
r = n - 1
x.sort()
state = 1
i = 1
while i < n:
	if state == 1:
		r -= 1
		state = 0
	else:
		l += 1
		state = 1
	i += 1
print(x[l])


n = int(input())
l = [int(i) for i in input().split()]
print(sorted(l)[-(n // 2 + 1)])


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

def step1(arr):
	i = arr.index(max(arr))
	_arr = arr
	del _arr[i]
	return _arr

def step2(arr):
	i = arr.index(min(arr))
	_arr = arr
	del _arr[i]
	return _arr
if len(arr) > 1:
	while True:
		if len(arr) > 2:
			step1(arr)
			step2(arr)
		elif len(arr) == 2:
			step1(arr)
		else:
			print(arr[0])
			break
else:
	print(arr[0])


n = int(input())
s = list(map(int, input().split()))
middle = sum(s) / len(s)
s.sort()
print(s[int((n - 1) / 2)])


n = int(input())
l = list(map(int, input().split()))
for i in range(n - 1):
	if i % 2 == 1:
		ind = 0
		m = l[0]
		for j in range(len(l)):
			if l[j] < m:
				ind = j
				m = l[j]
		l.pop(ind)
	else:
		ind = 0
		m = l[0]
		for j in range(len(l)):
			if l[j] > m:
				ind = j
				m = l[j]
		l.pop(ind)
print(*l)


n = int(input())
numbers = list(map(int, input().split()))
numbers.sort()
while len(numbers) > 1:
	numbers.pop()
	if len(numbers) > 1:
		numbers.pop(0)
print(numbers[0])


n = int(input())
num = input().split()
num = [int(num[i]) for i in range(n)]
while len(num) != 1:
	num.remove(max(num))
	if len(num) > 1:
		num.remove(min(num))
num[0] = str(num[0])
num = ''.join(num)
print(num)


def kstatic(array, key):
	if len(array) > 1:
		(less, more) = ([], [])
		equal = []
		pivot = array[0]
		for i in range(len(array)):
			if array[i] < pivot:
				less.append(array[i])
			elif array[i] > pivot:
				more.append(array[i])
			else:
				equal.append(array[i])
		if key < len(less):
			return kstatic(less, key)
		elif key < len(less) + len(equal):
			return equal[0]
		else:
			return kstatic(more, key - len(less) - len(equal))
	if len(array) == 1 and key == 0:
		return array[0]
k = int(input())
a = input().split(' ')
array = []
for i in range(len(a)):
	array.append(int(a[i]))
if len(array) % 2 == 0:
	key = k // 2 - 1
	print(kstatic(array, key))
elif k == 1:
	print(array[0])
else:
	key = k // 2
	print(kstatic(array, key))


n = int(input())
a = list(map(int, input().split()))
(current_el, current_el_i, move) = (0, 0, 0)
while move < n - 1:
	if move % 2 == 0:
		for i in range(n):
			if a[i] != -1 and current_el < a[i]:
				current_el = a[i]
				current_el_i = i
	else:
		for i in range(n):
			if a[i] != -1 and current_el > a[i]:
				current_el = a[i]
				current_el_i = i
	a[current_el_i] = -1
	move += 1
for i in range(n):
	if a[i] != -1:
		print(a[i])
		break


import math
input()
a = sorted(list(map(int, input().split())))
r = len(a) // 2 - 1 if len(a) % 2 == 0 else len(a) // 2
print(str(a[r]), end='')


import math
n = int(input())
List = list(map(int, input().split()))
List.sort()
print(List[n - 1 - math.ceil((n - 1) / 2)])


n = int(input())
list1 = []
list1 = list(map(int, input().split()))[:n]
list1.sort()
turn = 1
while len(list1) > 1:
	if turn == 1:
		list1.pop()
		turn = 2
	else:
		list1.pop(0)
		turn = 1
print(list1[0])


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


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


def test_0():
	import math
	from collections import Counter
	n = list(map(int, input().split(' ')))[0]
	data = list(map(int, input().split(' ')))
	data.sort()
	k = n // 2 - 1 if n % 2 == 0 else n // 2
	print(data[k])
test_0()


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


n = int(input())
a = list(map(int, input().split()))
a.sort()
b = []
j = 0
for k in a:
	b.append(k)
while len(b) > 1:
	j += 1
	if j % 2 == 1:
		b.pop()
	else:
		b.pop(0)
for i in b:
	print(i)
if len(b) == 0:
	print(0)


from math import ceil
n = int(input())
arr = list(map(int, input().split()))
arr = sorted(arr, reverse=True)
if n % 2 != 0:
	print(arr[(n - 1) // 2])
else:
	print(arr[ceil((n - 1) / 2)])


x = int(input())
ins = list(map(int, input().split()))
ins.sort()
for i in range(x - 1):
	if i % 2 == 0:
		ins.pop(len(ins) - 1)
	else:
		ins.pop(0)
print(ins[0])


n = int(input())
a = sorted(list(map(int, input().split())))
j = n
k = -1
for i in range(n - 1):
	if i % 2 == 0:
		j -= 1
	else:
		k += 1
print(a[j - 1])


a = input()
k = list(input().split())
s = []
for i in k:
	s.append(int(i))
t = 0
while 1:
	t += 1
	if len(s) == 1:
		print(s[0])
		break
	elif t % 2 == 1:
		s.remove(max(s))
	else:
		s.remove(min(s))


probs = int(input())
numbers = list(map(int, input().split(' ')))
numbers.sort()
out = 0
length = len(numbers)
if length % 2 == 0:
	out = numbers[length // 2 - 1]
else:
	out = numbers[length // 2]
print(out)


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


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


n = eval(input())
ly1 = [eval(x) for x in input().split()]
result = sorted(ly1)
print(result[(len(result) - 1) // 2])


def find_min(liste):
	min_value = None
	for value in liste:
		if not min_value:
			min_value = int(value)
		elif int(value) < min_value:
			min_value = int(value)
	return min_value

def extract_min(liste):
	new_liste = []
	min_val = int(find_min(liste))
	c = 0
	for i in range(0, len(liste)):
		if int(liste[i]) != min_val:
			new_liste.append(int(liste[i]))
		else:
			c = c + 1
	if c != 0:
		for j in range(0, c - 1):
			new_liste.append(min_val)
	return new_liste

def find_max(liste):
	max_value = None
	for value in liste:
		if not max_value:
			max_value = int(value)
		elif int(value) > max_value:
			max_value = int(value)
	return max_value

def extract_max(liste):
	new_liste = []
	max_val = int(find_max(liste))
	c = 0
	for i in range(0, len(liste)):
		if int(liste[i]) != max_val:
			new_liste.append(liste[i])
		else:
			c = c + 1
	if c != 0:
		for j in range(0, c - 1):
			new_liste.append(max_val)
	return new_liste
n = input()
integers = []
inp = input()
list_int = inp.split()
for j in range(0, len(list_int)):
	integers.insert(j, list_int[j])
i = 1
while len(integers) > 1:
	while i <= int(n) - 1:
		if i % 2 == 0:
			integers = extract_min(integers)
		else:
			integers = extract_max(integers)
		i = i + 1
print(' '.join((str(x) for x in integers)))


n = int(input())
s = input().split()
a = []
for i in s:
	a.append(int(i))
a.sort()
for i in range(n - 1):
	if i % 2 == 0:
		a.pop(len(a) - 1)
	else:
		a.pop(0)
for i in a:
	print(i)


n = int(input())
m = list(map(int, input().split()))
for _ in range(n - 1):
	if _ % 2 == 0:
		m.remove(max(m))
	else:
		m.remove(min(m))
print(m[0])


n = int(input())
li = [int(x) for x in input().split()]
count = 1
for i in range(n - 1):
	if count % 2 == 1:
		li.remove(max(li))
	else:
		li.remove(min(li))
	count += 1
print(li[0])


input()
data = sorted(map(int, input().split()))
print(data[(len(data) - 1) // 2])


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


n = int(input())
a = list(map(int, input().split()))
t = 0
while len(a) > 1:
	a.remove(max(a))
	if len(a) == 1:
		break
	a.remove(min(a))
	if len(a) == 1:
		break
for i in a:
	print(i)


n = int(input())
a = sorted([int(i) for i in input().split()])
if n % 2 == 1:
	ans = a[n // 2]
else:
	ans = a[n // 2 - 1]
print(ans)


def bubblesort(array):
	lengthOfArray = len(array) - 1
	for i in range(lengthOfArray):
		for j in range(lengthOfArray - i):
			if array[j] > array[j + 1]:
				(array[j], array[j + 1]) = (array[j + 1], array[j])
	return array
n = int(input())
a = input().split()
for i in range(n):
	a[i] = int(a[i])
a = bubblesort(a)
print(a[(n - 1) // 2])


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


n = int(input())
li = list(map(int, input().split()))
i = 1
while i < n:
	k = max(li)
	li.remove(k)
	i += 1
	if i < n:
		k1 = min(li)
		li.remove(k1)
		i += 1
print(*li)


import sys
n = int(sys.stdin.readline().split()[0])
numbers = sys.stdin.readline().split()
for i in range(n):
	numbers[i] = int(numbers[i])
a = list(numbers)
while len(a) > 1:
	maximum = 0
	minimum = 1000001
	for i in range(len(a)):
		if a[i] > maximum:
			maximum = a[i]
		if a[i] < minimum:
			minimum = a[i]
	if len(a) > 1:
		a.remove(maximum)
	if len(a) > 1:
		a.remove(minimum)
sys.stdout.write(str(a[0]))


def getMid(arr, l):
	return sorted(arr)[int((l - 1) / 2)]
l = int(input())
arr = [int(x) for x in input().split()]
print(getMid(arr, l))


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


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


n = int(input())
a = [int(s) for s in input().split()]
b = 1
for i in range(n // 2):
	if len(a) > 2:
		a.remove(max(a))
		a.remove(min(a))
	elif len(a) == 2:
		a.remove(max(a))
print(a[0])


def answer():
	n = int(input())
	l = [int(x) for x in input().split()]
	l.sort()
	print(l[int(n / 2) - (n % 2 == 0)])
answer()


import sys
n = int(input())
an = list(map(int, sys.stdin.readline().split()))
an.sort()
print(an[(n - 1) // 2])


input()
m = input().split(' ')
for i in range(len(m)):
	m[i] = int(m[i])
while not len(m) == 1:
	m.remove(max(m))
	if len(m) == 1:
		break
	m.remove(min(m))
print(m[0])


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, queue, copy
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def I():
	return int(sys.stdin.readline())

def LS():
	return sys.stdin.readline().split()

def S():
	return input()

def main():
	n = I()
	l = LI()
	l.sort()
	if n % 2 == 0:
		return l[n // 2 - 1]
	return l[n // 2]
print(main())


def play(a, lst):
	(b, m) = (sorted(lst), a // 2)
	if a == 1:
		return b[0]
	elif a % 2 == 0:
		return b[m - 1]
	return b[m]
n = int(input())
z = [int(i) for i in input().split()]
print(play(n, z))


input()
m = list(map(int, input().split()))
m = sorted(m)
print(m[int(len(m) / 2)] if len(m) % 2 == 1 else m[int(len(m) / 2) - 1])


import math
n = int(input())
numbers = sorted(map(int, input().split()))
if n % 2 == 1:
	print(numbers[n // 2])
else:
	print(numbers[n // 2 - 1])


import statistics
n = int(input())
a = map(int, input().split())
l = list(a)
l.sort()
l.reverse()
if n % 2 == 1:
	print(statistics.median(l))
else:
	l.remove(l[0])
	print(statistics.median(l))


n = int(input())
m = input().split(' ')
m.sort(key=int)
h = (n - 1) // 2
print(m[h])


l = []
n = int(input())
l = [int(x) for x in input().split()]
count = 0
while count != n - 1:
	if count % 2 == 0:
		l.sort(reverse=True)
		del l[0]
	else:
		l.sort()
		del l[0]
	count += 1
print(l[0])


import logging
fmt = '%(levelname)s - %(name)s (line:%(lineno)s) - %(message)s'
formatter = logging.Formatter(fmt)
ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG)
ch.setFormatter(formatter)
logger = logging.getLogger('ga')
logger.setLevel(logging.DEBUG)
logger.addHandler(ch)

def solve(sequence):
	if len(sequence) == 1:
		return sequence[0]
	sequence = sorted(sequence)
	if len(sequence) % 2 == 0:
		return sequence[len(sequence) // 2 - 1]
	return sequence[len(sequence) // 2]

def main():
	_ = int(input().strip())
	sequence = [int(x) for x in input().strip().split()]
	result = solve(sequence)
	print(result)
main()


from bisect import bisect_left, bisect_right

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


def sort(A):
	for i in range(len(A) - 1, -1, -1):
		for j in range(i):
			if A[i] > A[j]:
				(A[i], A[j]) = (A[j], A[i])
	return A
aaaaaaaaaaaaaa = int(input())
a = input() + ' '
b = ''
A = []
for j in range(len(a)):
	if a[j] == ' ':
		A.append(int(b))
		b = ''
	else:
		b += a[j]
A = sort(A)
for i in range(len(A) - 1):
	if i % 2 == 0:
		A = A[1:]
	else:
		A = A[:-1]
print(A[0])


from heapq import heappop, heappush
(n, a) = (int(input()), [])
for i in input().split():
	heappush(a, int(i))
for i in range((n + 1) // 2):
	b = heappop(a)
print(b)


n = int(input())
myList = list(map(int, input().split()))
myList.sort()
myNewList = myList[:]
myNewList.reverse()
length = len(myList)
for i in range(1, len(myList)):
	if i % 2 == 1:
		myList.pop()
	else:
		myNewList.pop()
print(*list(set(myList).intersection(myNewList)))


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


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


def main():
	n = int(input())
	numbers = [int(x) for x in input().split(' ')]
	numbers = sorted(numbers)
	index = n // 2
	if n % 2 == 0:
		index -= 1
	return numbers[index]
print(main())


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


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


global cnt, a, Blackboard
cnt = 0
a = int(input())
Blackboard = list(map(int, input().split()))
while len(Blackboard) ^ 1 != 0:
	if cnt & 1 == 1:
		Blackboard.remove(min(Blackboard))
	else:
		Blackboard.remove(max(Blackboard))
	cnt += 1
print(Blackboard[0], end='')


n = int(input())
l = [int(x) for x in input().split()]
l.sort()
if len(set(l)) == 1:
	print(l[0])
elif n % 2 != 0:
	print(l[n // 2])
else:
	print(l[n // 2 - 1])


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


n = int(input())
a = [int(x) for x in input().split(' ')]
for i in range(len(a) - 1):
	if i % 2 == 0:
		a.remove(max(a))
	else:
		a.remove(min(a))
print(a[0])


n = int(input())
data = [int(x) for x in input().split()]
data.sort()
if n % 2 == 0:
	data = data[n // 2 - 1:n // 2]
	pr = max(data)
else:
	pr = data[n // 2]
print(pr)


n = int(input())
arr = list(map(int, input().split()))
arr.sort()
while len(arr) > 1:
	arr.pop()
	if len(arr) == 1:
		break
	arr.pop(0)
print(arr[0])


n = int(input())
a = [int(i) for i in input().split()]
i = 0
while i != n - 1:
	if i % 2 == 0:
		a.remove(max(a))
	else:
		a.remove(min(a))
	i += 1
print(a[0])


n = int(input())
num = [int(n) for n in input().split()]
for i in range(len(num) // 2):
	num.remove(max(num))
	if len(num) == 1:
		break
	num.remove(min(num))
for i in range(len(num)):
	print(num[i])


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)


n = int(input())
arr = list()
arr = [int(n) for n in input().split()]
arr.sort()
c = int(n / 2)
if n % 2 != 0:
	c = c + 1
print(arr[c - 1])


x = int(input())
y = [int(y) for y in input().split()]
y.sort()
n = len(y)
if n % 2 == 0:
	print(y[n // 2 - 1])
else:
	print(y[n // 2])


n = int(input()) - 1
l = list(map(int, input().split()))
l = sorted(l)
maior = True
while len(l) != 1:
	if maior:
		l.pop(len(l) - 1)
		maior = False
	else:
		l.pop(0)
		maior = True
print(l[0])


number = int(input())
data = list(map(int, input().split()))
count = 1
while count < number:
	if count % 2 == 1:
		data.remove(max(data))
		count += 1
	else:
		data.remove(min(data))
		count += 1
print(data[0])


n = int(input())
a = [int(i) for i in input().split()]
b = 1
for i in range(n - 1):
	if b % 2 != 0:
		c = a.index(max(a))
		a.pop(c)
		b += 1
	elif b % 2 == 0:
		c = a.index(min(a))
		a.pop(c)
		b += 1
print(*a)


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


n = int(input())
a = [int(x) for x in input().split()]
a.sort()
c = 0
while len(a) != 1:
	if c % 2 == 0:
		t = a.pop()
	elif len(a) != 1:
		t = a.pop(0)
	c += 1
print(a[0])


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


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


n = int(input())
a = list(map(int, input().split()))
for i in range(len(a)):
	for j in range(len(a) - i - 1):
		if a[j + 1] < a[j]:
			(a[j], a[j + 1]) = (a[j + 1], a[j])
if n % 2 == 1:
	print(a[n // 2])
else:
	print(a[n // 2 - 1])


import sys
n = int(input())
li = list(map(int, input().rstrip().split()))
li.sort()
li.reverse()
n = n // 2
print(li[n])


num_moves = int(input())
inp = input()
inp = inp.split(' ')
lst_num = []
for number in inp:
	lst_num.append(int(number))
lst_num.sort()
for index in range(len(lst_num) - 1):
	if index % 2 == 0:
		del lst_num[-1]
	else:
		del lst_num[0]
print(lst_num[0])


a = int(input())
l = list(map(int, input().split(' ')))
for i in range(len(l) - 1):
	maxi = max(l)
	mini = min(l)
	if i % 2 == 0:
		l.remove(maxi)
	else:
		l.remove(mini)
print(l[0])


n = int(input())
general = list(map(int, input().split()))
for i in range(1, n):
	if i % 2 != 0:
		general.remove(max(general))
	elif i % 2 == 0:
		general.remove(min(general))
print(general[0])


import sys
import math
import bisect

def main():
	n = int(input())
	A = list(map(int, input().split()))
	A.sort()
	print(A[(n - 1) // 2])
main()


s = [list(map(int, input().split())) for _ in range(2)][1]
while len(s) > 1:
	s.remove(max(s))
	if not len(s) - 1:
		break
	s.remove(min(s))
print(s[0])


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


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


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


lis = []
lis.append(input())
lis.append(input())
l = map(int, lis[1].rstrip().split())
l = sorted(l)
k = 0
while k < (int(lis[0]) - 1) // 2:
	del l[0]
	del l[-1]
	k += 1
if (int(lis[0]) - 1) % 2 == 1:
	del l[-1]
print(l[0])


n = int(input())
X = [int(x) for x in input().split(' ')]
while len(X) != 1:
	X.remove(max(X))
	if len(X) != 1:
		X.remove(min(X))
print(X[0])


n = int(input())
ls = [eval(x) for x in input().split(' ')]
ls.sort(reverse=True)
i = 0
while len(ls) != 1:
	i = i + 1
	if i % 2 == 0:
		del ls[len(ls) - 1]
	else:
		del ls[0]
print(ls[0])


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


t = int(input())
l = 0
h = t - 1
arr = list(map(int, input().split()))
if t == 1:
	print(*arr, sep='')
else:
	arr.sort()
	for i in range(t // 2):
		h = h - 1
		l = l + 1
		if l == h or l > h:
			print(arr[h])


n = int(input())
a = list(map(int, input().split()))
step = 1
a.sort()
while len(a) > 1:
	if step % 2 == 1:
		a.pop()
	else:
		a.pop(0)
	step += 1
print(*a)


n = int(input())
data = [int(i) for i in input().split(' ')]
moves = n - 1
for i in range(moves):
	if i % 2 == 0:
		tmpmax = max(data)
		data.remove(tmpmax)
	else:
		tmpmin = min(data)
		data.remove(tmpmin)
print(data[0])


def readline():
	return map(int, input().split())
(n,) = readline()
array = readline()
print(sorted(array)[n - 1 >> 1])


n = int(input())
p = list(map(int, input().split()))
if len(p) == 1:
	print(p[0])
if len(p) > 1:
	for num in range(n - 1):
		p.remove(max(p))
		if len(p) > 1:
			p.remove(min(p))
		if len(p) == 1:
			print(p[0])
			break


n = int(input())
c = input().split(' ')
f = []
for e in c:
	f.append(int(e))
f.sort()
if n % 2 == 0:
	print(f[n // 2 - 1])
else:
	print(f[n // 2])


n = int(input())
board = [int(x) for x in input().split()]
while len(board) != 1:
	board.remove(max(board))
	if len(board) == 1:
		break
	board.remove(min(board))
print(board[0])


rounds = int(input())
numbers = [int(x) for x in input().split(' ')]
numbers = sorted(numbers)
for i in range(rounds - 1):
	if (i + 1) % 2 == 1:
		numbers.pop(-1)
	else:
		numbers.pop(0)
print(numbers[0])


numero = [int(x) for x in input().split()]
cantidad = [int(x) for x in input().split()]
cantidad = sorted(cantidad)
numero = numero[0]
if numero % 2 == 1:
	print(cantidad[int(numero / 2)])
else:
	numero = int(numero / 2)
	print(cantidad[numero - 1])


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


n = int(input())
arr = list(map(int, input().rstrip().split()))
arr.sort(reverse=True)
if n % 2 == 1:
	print(arr[n // 2])
else:
	print(arr[n // 2])


n = int(input())
arr = list(map(int, input().split()))
arr = sorted(arr)
for i in range(n):
	if len(arr) == 1:
		break
	elif i % 2 == 0:
		arr.pop()
	else:
		arr.pop(0)
print(arr[0])


x = int(input())
l = [int(n) for n in input().split()]
l.sort()
i = 0
while len(l) > 1:
	if i % 2 == 0:
		l = l[0:len(l) - 1]
	else:
		l = l[1:len(l)]
	i = i + 1
print(l[0])


from sys import stdin, setrecursionlimit, stdout
from collections import deque
from math import sqrt, floor, ceil, log, log2, log10, pi, gcd, sin, cos, asin

def ii():
	return int(stdin.readline())

def fi():
	return float(stdin.readline())

def mi():
	return map(int, stdin.readline().split())

def fmi():
	return map(float, stdin.readline().split())

def li():
	return list(mi())

def si():
	return stdin.readline().rstrip()

def lsi():
	return list(si())
res = ['Yes', 'No']
test_case = 1
while test_case:
	test_case -= 1
	n = ii()
	a = li()
	a.sort(reverse=True)
	print(a[n // 2])


import math

def main():
	n = int(input())
	a = list(map(int, input().split()))
	a.sort()
	print(a[math.ceil((n - 1) // 2)])
main()


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


def inline():
	return [int(i) for i in input().split()]
n = int(input())
lst = sorted(inline())
print(lst[(n - 1) // 2])


n = int(input())
a = list(map(int, input().split()))
if n & 1:
	while len(a) != 1:
		a.remove(max(a))
		a.remove(min(a))
else:
	while len(a) != 2:
		a.remove(max(a))
		a.remove(min(a))
	a.remove(max(a))
print(*a)


a = int(input(''))
z = list(map(int, input().split()))
b = []
r = 0
for lk in range(len(z)):
	b.append(z[r])
	r = r + 1
import copy
t = copy.deepcopy(b)
for i in range(len(b) - 1):
	if i % 2 == 0:
		b.sort()
		t.remove(b[len(b) - 1])
		b.remove(b[len(b) - 1])
	elif i % 2 == 1:
		b.sort()
		t.remove(b[0])
		b.remove(b[0])
print(t[0])


count = int(input())
numbers = [int(number) for number in input().strip().split()]
numbers.sort()
if numbers:
	print(numbers[(count - 1) // 2])


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


cantidad = int(input())
numeros = list(map(int, input().split()))
numeros.sort()
for _ in range(cantidad - 1):
	numeros.reverse()
	numeros.pop(0)
print(numeros[0])


n = int(input())
a = list(map(int, input().split()))
a.sort()
left = 0
right = len(a) - 1
for i in range(len(a) - 1):
	if i % 2 == 0:
		right -= 1
	else:
		left += 1
print(a[right])


n = int(input())
l = list(map(int, input().split()))
c = 0
for i in range(n - 1):
	if c == 0:
		l.remove(max(l))
		c = 1
	elif c == 1:
		l.remove(min(l))
		c = 0
print(l[0])


n = int(input())
a = sorted(map(int, input().split()))
dl = len(a) // 2
if len(a) % 2 == 0:
	dl -= 1
for _ in range(dl):
	a.remove(max(a))
	a.remove(min(a))
print(a[0])


x = int(input())
l = list(map(int, input().split()))
l.sort()
while len(l) > 1:
	l.pop()
	if len(l) == 1:
		break
	l.pop(0)
print(*l)


input()
ls = sorted([*map(int, input().split())])
print(ls[(len(ls) - 1) // 2])


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


n = int(input())
a = list(map(int, input().split()))
t = 1
k = len(a)
while t < k:
	if t % 2 != 0:
		a.remove(max(a))
	elif t % 2 == 0:
		a.remove(min(a))
	t = t + 1
print(a[0])


n = int(input())
a = [int(i) for i in input().split()]
for i in range(n - 1):
	a.remove(max(a))
	if len(a) == 1:
		break
	a.remove(min(a))
	if len(a) == 1:
		break
print(*a)


def do():
	N = int(input())
	ch = sorted(map(int, input().split()))
	print(ch[(N - 1) // 2])
do()


n = int(input())
entrada = str(input())
a = [int(x) for x in entrada.split()]
a.sort()
k = int(n / 2)
if n % 2 == 0:
	ans = a[k - 1]
else:
	ans = a[k]
print(ans)


n = int(input())
a = sorted([int(x) for x in input().split()])
while len(a) > 1:
	a.pop()
	a.reverse()
print(a[0])


n = int(input())
j = [int(i) for i in input().split()]
j.sort()
print(j[n // 2 + n % 2 - 1])


n = int(input())
l = [int(i) for i in input().split()]
if n == 1:
	print(l[0])
else:
	while 1:
		l.remove(max(l))
		if len(l) == 1:
			break
		l.remove(min(l))
		if len(l) == 1:
			break
	print(l[0])


import time
n = int(input())
nu = input().strip().split()
num = [int(i) for i in nu]
for i in range(n - 1):
	if i % 2 == 0:
		num.remove(max(num))
	else:
		num.remove(min(num))
print(num[0])


n = int(input())
L = [int(z) for z in input().split()]
for i in range(n - 1):
	z = [max(L), min(L)][i % 2]
	L.remove(z)
print(L[0])


n = int(input())
a = list(map(int, input().split()))
while len(a) != 1:
	d = max(a)
	a.remove(d)
	if len(a) != 1:
		e = min(a)
		a.remove(e)
print(*a)


n = int(input())
l = list(map(int, input().split()))
l.sort()
while len(l) != 1:
	l = l[:-1]
	if len(l) != 1:
		l = l[1:]
print(l[0])


n = int(input())
a = list(map(int, input().split()))
for i in range(n - 1):
	d = i % 2
	if d == 0:
		del a[a.index(max(a))]
	elif d == 1:
		del a[a.index(min(a))]
	else:
		exit(100500)
print(a[0])


n = int(input())
board = list(map(int, input().split()))
sort_board = sorted(board)
for i in range(1, n):
	if i % 2 != 0:
		sort_board.pop(-1)
	else:
		sort_board.pop(0)
print(sort_board[0])


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


y = int(input())
x = [int(x) for x in input().split()]
z = len(x)
x.sort()
q = z // 2
if z % 2 != 0:
	print(x[q])
else:
	print(x[q - 1])