CodeEff/ECCO huggingface dataset:
# Original solution
N, M, X = list(map(int, input().split()))
A = list(map(int, input().split()))

for i , a in enumerate(A):
    if X < a:
        break

if i > len(A) / 2:
    ans = len(A[i:])
else:
    ans = len(A[:i])

print(ans)


# Optimized solution
n, m, x = list(map(int, input().split()))
a = list(map(int, input().split()))
cnt1 = 0
cnt2 = 0
x1 = x
x2 = x

while x1 < n+1:
    x1 += 1
    if x1 in a:
        cnt1 += 1

while x2 > 0:
    x2 -= 1
    if x2 in a:
        cnt2 += 1



if cnt1 < cnt2:
    ans = cnt1
else:
    ans = cnt2

print(ans)
# Original solution
from bisect import bisect_left
from bisect import bisect_right
N, M, X = list(map(int, input().split()))
A = sorted(list(map(int, input().split())))
index = bisect_left(A, X)
s = len(A[:index])
g = len(A[index:])
print((min(s,g)))

# Optimized solution
from bisect import bisect_left
N, M, X = list(map(int, input().split()))
A = sorted(list(map(int, input().split())))
index = bisect_left(A, X)
print((min(len(A[:index]), len(A[index:]))))
# Original solution
n,m,x=list(map(int,input().split()))
gate=list(map(int,input().split()))
cnt1=0
cnt2=0
for i in range(1,x):
    if i in gate:
        cnt1+=1
for j in range(x+1,n):
    if j in gate:
        cnt2+=1
print((min(cnt1,cnt2)))

# Optimized solution
n,m,x=list(map(int,input().split()))
a=list(map(int,input().split()))
cnt1=0
cnt2=0
for i in range(0,x+1):
    if i in a:
        cnt1+=1
for j in range(x,n+1):
    if j in a:
        cnt2+=1
print((min(cnt1,cnt2)))
# Original solution
def main():
    N, M, X = list(map(int, input().split()))
    A = [int(a) for a in input().split()]
    costL = 0
    for i in range(len(A)):
        if A[i] < X:
            costL += 1
    return min(costL, M-costL)
    
if __name__ == '__main__':
    print((main()))

# Optimized solution
def main():

    N, M, X = list(map(int, input().split()))
    A = list(map(int, input().split()))
    A.sort()
    count1 = 0
    for i in range(M):
        if A[i] < X: count1 += 1
    return min(count1, len(A)-count1)



if __name__ == '__main__':
    print((main()))
# Original solution
import bisect
N, M, X = list(map(int, input().split()))
a = list(map(int, input().split()))
p = bisect.bisect_left(a, X)
print((min(p, M - p)))

# Optimized solution
n, m, x = list(map(int, input().split()))
a = list(map(int, input().split()))
for i in range(m):
  if x < a[i]:
    break
else:
  i += 1
print((min(i, m - i)))
# Original solution
N, M, X = list(map(int, input().split()))
A = list(map(int, input().split()))
c = 0
for i in range(M):
    if A[i] < X:
        c += 1
print((min((len(A) - c),c)))


# Optimized solution
import bisect

N, M, X = list(map(int, input().split()))
A = list(map(int, input().split()))
index = bisect.bisect_right(A, X)
print((min(index, len(A) - index)))
# Original solution
n, m, x = list(map(int, input().split()))
a = list(map(int, input().split()))
l = []

right = [l for i in a if x < i]
left = [l for i in a if x > i]

print((min(len(right), len(left))))

# Optimized solution
n, m, x = list(map(int, input().split()))
a = list(map(int, input().split()))

right = len([int(i) for i in a if x < i])
left = len([int(i) for i in a if x > i])

print((min(right, left)))
# Original solution
n, m, x = list(map(int, input().split()))
A = list(map(int, input().split()))

import bisect

l = bisect.bisect_left(A, x)
ans = min(l, m-l)
print(ans)

# Optimized solution
n, m, x = list(map(int, input().split()))
a = list(map(int, input().split()))

left = 0
right = 0

for ai in a:
    if ai < x:
        left += 1
    else:
        right += 1
        
print((min(left, right)))
# Original solution
n,m,x = list(map(int,input().split()))
a = list(map(int,input().split()))
d = 0
e = 0
for i in range(0,len(a)):
    if a[i] < x:
        d += 1
    elif a[i] > x:
        e += 1
print((min(d,e)))

# Optimized solution
n,m,x = list(map(int,input().split()))
a = sorted(list(map(int,input().split())))
b = 0
c = 0
for i in range(len(a)):
    if a[i] < x:
        b += 1
    else:
        c += 1
print((min(b,c)))
# Original solution
n,m,x=list(map(int,input().split()))
l=list(map(int,input().split()))
ans1=0
ans2=0
for i in range(x+1,n):
    for j in range(m):
        if l[j]==i:
            ans1+=1
for i in range(0,x):
    for j in range(m):
        if l[j]==i:
            ans2+=1
print((min(ans1,ans2)))

# Optimized solution
n, m, x = list(map(int, input().split()))

nums = [0] * (n + 1)
indices = list(map(int, input().split()))

for i in indices:
    nums[i] = 1

print((min(nums[:x].count(1), nums[x:].count(1))))
# Original solution
N, M, X = list(map(int, input().split()))
A = list(map(int, input().split()))

ctr = 0
for a in A:
    if a < X:
        ctr += 1

print((min(ctr, M - ctr)))

# Optimized solution
N, M, X = list(map(int, input().split()))
A = list(map(int, input().split()))

for i in range(M):
    if A[i] > X:
        print((min(i, M - i)))
        break
# Original solution
n, m, x = list(map(int, input().split()))
a = list(map(int, input().split()))

res1 = 0
res2 = 0
for i in a:
  if i<x:
    res1 += 1
  else:
    res2 += 1
    
print((min(res1, res2)))

# Optimized solution
n,m,x=list(map(int,input().split()))
a=list(map(int,input().split()))
a.sort()

mi=0
ma=0
for i in a:
  if i<x:
    mi+=1
  else:
    ma+=1
print((min(mi,ma)))
# Original solution
n,m,x=list(map(int,input().split()))
a=list(map(int,input().split()))
s=0
i=0
while a[i]<=x:
    s+=1
    i+=1
print((min(s,m-s)))

# Optimized solution
n,m,x=list(map(int,input().split()))
a=list(map(int,input().split()))
i=0
while a[i]<=x:
    i+=1
print((min(i,m-i)))
# Original solution
N,M,X = list(map(int,input().split()))
A = list(map(int,input().split()))
cnt = 0
for i in range(X,N+1):
    if i in A:
        cnt += 1
cntmin = cnt
cnt = 0
for i in range(X,-1,-1):
    if i in A:
        cnt += 1
cntmin = min(cntmin,cnt)
print(cntmin)

# Optimized solution
N,M,X = list(map(int,input().split()))
A = list(map(int,input().split()))
cnt = 0
for i in range(M):
    if X>A[i]:
        cnt += 1
print((min(cnt,M-cnt)))
# Original solution
N, M, X = list(map(int, input().split()))
A = list(map(int, input().split()))
cnt = 0
min = 0
cnt_2 = 0
lists = list(range(N + 1))
for i in range(X, N + 1):
    for j in range(len(A)):
        if i == 0 or i == N or i == X:
            continue
        elif i == A[j]:
            cnt += 1
for m in range(X, -1, -1):
    for n in range(len(A)):
        if m == 0 or m == N or m == X:
            continue
        elif m == A[n]:
            cnt_2 += 1
if cnt > cnt_2:
    min = cnt_2
elif cnt_2 > cnt:
    min = cnt
print(min)


# Optimized solution
n,m,x = list(map(int,input().split()))
a = list(map(int,input().split()))
cnt_r = 0
cnt_l = 0
road = [True]*(n+1)
for i in a:
    road[i] = False
for i in range(x,n+1):
    if not road[i]:
        cnt_r += 1
for i in range(x,-1,-1):
    if not road[i]:
        cnt_l += 1
ans = min(cnt_r,cnt_l)
print(ans)
# Original solution
N, M, X = list(map(int, input().split()))
A = list(map(int, input().split()))

to_left =[1 for i in range(X-1, 0, -1) if i in A] 
to_right =[1 for i in range(X+1, N, 1) if i in A]
print((min(sum(to_left), sum(to_right))))

# Optimized solution
N, M, X = list(map(int, input().split()))
A = list(map(int, input().split()))

to_left =[1 for i in range(X-1, 0, -1) if i in A] 

print((min(sum(to_left), M-sum(to_left))))
# Original solution
N, M, X = list(map(int, input().split()))
A = list(map(int, input().split()))

A.sort()
L = 0
R = 0
for a in A:
    if a < X:
        L += 1
    else:
        R += 1

print((min(L, R)))


# Optimized solution
N, M, X = list(map(int, input().split()))
A = list(map(int, input().split()))
left = 0
right = 0
for i in A:
    if i < X:
        left += 1
    else:
        right += 1

print((min(left, right)))
# Original solution
I=lambda:list(map(int,input().split()));n,m,x=I();s=sum(a<x for a in I());print((min(s,m-s)))

# Optimized solution
n,m,*a=list(map(int,open(0).read().split()));print((min(c:=sorted(a).index(a[0]),m-c)))
# Original solution
n,m,x=list(map(int,input().split()))
a=list(map(int,input().split()))

left=0
right=0

for ai in a:
  if ai<x:
    left+=1
  else:
    right+=1
print((min(left,right)))

# Optimized solution
n,m,x=list(map(int,input().split()))
a=list(map(int,input().split()))

for i in a:
  s=sum(int(i)<x for i in a)
print((min(s,m-s)))
# Original solution
n,m,x = list(map(int, input().split()))
a = sorted(list(map(int, input().split())))
f = list([y for y in a if y>x])
if len(f) < len(a)-len(f):
  print((len(f)))
else:
  print((len(a)-len(f)))

# Optimized solution
n,m,x = list(map(int, input().split()))
a = sorted(list(map(int, input().split())))
f = len(list([y for y in a if y>x]))
b = len(a)-f
print((f if f < b else b))
# Original solution
N, M, X = list(map(int, input().split()))
A = list(map(int, input().split()))

to_0 = 0
if A[-1] < X:
    to_0 = M
    to_N = 0
elif A[0] < X < A[-1]:
    for i in A:
        if i < X:
            to_0 += 1
    to_N = M - to_0
elif X < A[0]:
    to_0 = 0
    to_N = M
print((min(to_0, to_N)))

# Optimized solution
n, m, x = list(map(int, input().split()))
a = list(map(int, input().split()))

left = 0
right = 0

for ai in a:
    if ai < x:
        left += 1
    else:
        right += 1
print((min(left, right)))
# Original solution
N,M,X = list(map(int,input().split()))
A = list(map(int,input().split()))
A_under = [A[i] for i in range(M) if A[i] < X]
A_upper = [A[i] for i in range(M) if A[i] > X]
print((min(len(A_under),len(A_upper))))

# Optimized solution
N,M,X = list(map(int,input().split()))
A = list(map(int,input().split()))
cost = [0]*N
for i in A: cost[i] = 1
print((min(sum(cost[X:]),sum(cost[:X+1]))))
# Original solution
N, M, X = list(map(int, input().split()))
A = list(map(int, input().split()))
costRight, costLeft = 0, 0
for i in range(X, N):
    if i in A:
        costRight +=1
for i in range(X, 0, -1):
    if i in A:
        costLeft += 1
print((min(costRight, costLeft)))

# Optimized solution
N, M, X = list(map(int, input().split()))
A = list(map(int, input().split()))
costRight, costLeft = 0, 0
for a in A:
    if a > X:
        costRight += 1
    else:
        costLeft +=1
print((min(costLeft, costRight)))
# Original solution
N, M, X = list(map(int, input().split()))
A = list(map(int, input().split()))

a = [0 for _ in range(N+1)]
for n in A:
    a[n] = 1

print((min(sum(a[:X]), sum(a[X+1:]))))

# Optimized solution
n,m,x=list(map(int,input().split()))
s=sum(int(i)<x for i in input().split())
print((min(s,m-s)))
# Original solution
N, M, X = list(map(int,input().split()))
A = list(map(int,input().split()))
left, right = X, X
left_cost, right_cost = 0, 0
for i in range(N+1):
  left -= 1
  right += 1
  if(left in A):
    left_cost += 1
  if(right in A):
    right_cost += 1
print((min(left_cost, right_cost)))

# Optimized solution
N, M, X = list(map(int,input().split()))
A = list(map(int,input().split()))
l, r = 0, 0
for a in A:
  if(X > a):
    l += 1
  else:
    r += 1
print((min(l, r)))
# Original solution
from bisect import bisect_left

N, M, X = list(map(int,input().split()))
A = list(map(int,input().split()))
x = bisect_left(A, X)
print((min(len(A[x:]), len(A[:x]))))

# Optimized solution
from bisect import bisect_left

N, M, X = list(map(int,input().split()))
A = list(map(int,input().split()))
x = bisect_left(A, X)
print((min(x, M-x)))
# Original solution
N, M, X = list(map(int, input().split()))
m = [0] * (N + 1)
a = list(map(int, input().split()))
for i in a:
    m[i] = 1

print((min(sum(m[:X]), sum(m[X:]))))

# Optimized solution
N, M, X = list(map(int, input().split()))
A = list(map(int, input().split()))
l = 0
r = 0
for a in A:
  if a < X:
    l += 1
  else:
    r += 1
print((min(l, r)))
# Original solution
#!/usr/bin/env python
# -*- coding: utf-8 -*-
N,M,X = list(map(int,input().split())) #整数の入力
a = list(map(int,input().split()))
#検問所の入力
b=[]
c=[]
for i in range(X+1,N): #X+1からNの範囲の整数について 
  if i in a: #ある整数が検問所の整数として存在する
    b.append(1)
for i in range(1,X): #1からX-1の範囲の整数について
  if i in a: #ある整数が検問所の整数として存在する
    c.append(1)
print((min(sum(b),sum(c))))

# Optimized solution
N,M,X = list(map(int,input().split()))
A = list(map(int,input().split()))
Rcnt = 0
Lcnt = 0
for i in range(X,N+1):
    if i in A:
        Rcnt += 1
for i in range(X):
    if i in A:
        Lcnt += 1

print((min(Lcnt,Rcnt)))
# Original solution
n, m, x = list(map(int, input().split()))
A = [int(i) for i in input().split() if int(i) < x]
print((min(len(A), m - len(A))))

# Optimized solution
n, m, x = list(map(int, input().split()))
A = [int(i) for i in input().split() if int(i) < x]
print((len(A) if m - len(A) > len(A)  else m - len(A)))
# Original solution
n, m, x = list(map(int, input().split()))
al = list(map(int, input().split()))
a1 = 0
for a in al:
    if 0 <= a <= x:
        a1 += 1
print((min(a1, m - a1)))


# Optimized solution
n, m, x = list(map(int, input().split()))
al = list(map(int, input().split()))
t = len([i for i in al if i < x])
print((min(t, m-t)))
# Original solution
n,m,x=input().split()
n,m,x=int(n),int(m),int(x)

a1=input().split()
a2=[]
for i in range(n+1):
    if str(i) in a1:
        a2.append(1)
    else:
        a2.append(0)

print((min([sum(a2[:x]),sum(a2[x+1:])])))


# Optimized solution
n,m,x=list(map(int,input().split()))
a=[int(i) for i in input().split()]
j=0
for i in range(m):
    if a[i]>x:
        j=i
        break
print((min(len(a)-j,j)))
# Original solution
import math
n=int(eval(input()))
a=sorted(list(map(int,input().split())),reverse=True)
maxconb=0
ans=[0,0]

def comb(a,b):
    return math.factorial(a)//(math.factorial(a-b) * math.factorial(b))

def mid(a):
    if(a%2!=0):
        return (a+1)//2
    else:
        return a//2
#print(a)
for i in range(n-1):
    ai=a[i]
    temp=list([abs(x-mid(ai)) for x in a[i+1:]])
#    print(temp)
    bi=a[temp.index(min(temp))+i+1]
#    print(str(ai)+":"+str(bi))
    c=comb(ai,bi)
    if(maxconb<c):
        maxconb=c
        ans=[ai,bi]
print((str(ans[0])+" "+str(ans[1])))

# Optimized solution
n=int(eval(input()))
a=sorted(list(map(int,input().split())),reverse=True)

def mid(a):
    if(a%2!=0):
        return (a+1)//2
    else:
        return a//2

ai=a[0]
temp=list([abs(x-mid(ai)) for x in a[1:]])
bi=a[temp.index(min(temp))+1]
print((str(ai)+" "+str(bi)))
# Original solution
def nCr(n,r):
  if n < 0 or r < 0 or n < r: return 0
  if n - r < r: r = n - r
  if r == 0: return 1
  if r == 1: return n
  
  # 分子のn*(n-1)*...がr個分続くやつ
  numerator = [n-r+k+1 for k in range(r)]
  # 分母：r!=r*(r-1)*...*3*2の要素
  denominator = [k+1 for k in range(r)]
  
  # 分母の要素で割れる部分を割っていく部分
  for p in range(2, r+1):
    # 分母は1,2,3,...rのようになっており、1は意味がないのでスキップした形か
    pivot = denominator[p-1]
    if pivot > 1:
      # 分子のX番目と分母のX-offset番目が共通の約数を持つということだと思う。piv分ずれているのだから、pivの倍数というところか
      offset = (n-r) % p
      for k in range(p-1, r, p):
        # 約分できる要素について割る
        numerator[k - offset]  /= pivot
        denominator[k] /= pivot
        
  ret = 1
  for k in range(r):
    if numerator[k] > 1: ret *= int(numerator[k])
      
  return ret


N = int(eval(input()))
a = list(map(int, input().split()))
a.sort(reverse = True)

max_comb = 0
n = 0
r = 0
n = a[0]
for j in range(1, N):
  if max_comb < nCr(a[0],a[j]):
    max_comb = nCr(a[0],a[j])
    r = a[j]
    
ans = str(n) + " " + str(r)
print(ans)
 

# Optimized solution

N = int(eval(input()))
a = list(map(int, input().split()))
a.sort(reverse = True)

tmp = 10 ** 9
ans = 1
for i in range(1,N):
  if abs(a[0]/2 - a[i]) < tmp:
    tmp = abs(a[0]/2 - a[i])
    ans = a[i]

    
s = str(a[0]) + " " + str(ans)
print(s)
# Original solution
# coding: utf-8
# hello worldと表示する
# coding: utf-8
# hello worldと表示する
# coding: utf-8
# hello worldと表示する
"""def comb2(n,r):
    if n == 0 or r == 0: 
        return 1
    return comb2(n-1,r-1)+comb2(n-1,r)
def fact(n):
    if n==0:
        return 1
    return n*fact(n-1)
nCr = {}
def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]"""
def ncr(n, r):
    r = min(r, n - r)
    if r == 0: return 1;
    if r == 1: return n;
    numerator = [n - r + i + 1 for i in range(r)]
    denominator  = [i + 1 for i in range(r)]
    for p in range(2, r + 1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p - 1, r, p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot
    result = 1
    for k in range(r):
        if numerator[k] > 1: 
            result *= numerator[k]
    return result
#a = cmb(n,r)
ans=0    
N=int(eval(input()))
s=list(map(int,input().split()))
t=max(s)
for i in s:
    c=ncr(t,i)
#    c=fact(t)/(fact(i)*fact(t-i))
    if ans<c and t!=i:
        ans=c
        an=i
print((str(t)+" "+str(an)))        


# Optimized solution
import math
def c(n,r):
    r=min(r,n-r)
    a=math.factorial(n)//(math.factorial(r)*math.factorial(n-r))
    return a
q=1    
N=int(eval(input()))
s=list(map(int,input().split()))
n=max(s)
for i in s:
    t=c(n,i)
    if q<=t:
        q=t
        w=str(n)+" "+str(i)
print(w)
# Original solution
import math
def c(n,r):
    r=min(r,n-r)
    a=math.factorial(n)//(math.factorial(r)*math.factorial(n-r))
    return a
q=1    
N=int(eval(input()))
s=list(map(int,input().split()))
n=max(s)
for i in s:
    t=c(n,i)
    if q<=t:
        q=t
        w=str(n)+" "+str(i)
print(w)        
    

# Optimized solution
N=int(eval(input()))
s=list(map(int,input().split()))
n=max(s)
s.remove(n)
q=n
for i in s:
    t=abs(n/2-i)
    if q>=t:
        q=t
        w=str(n)+" "+str(i)
print(w)
# Original solution
import math
def comb(n,r):
   return math.factorial(n) // (math.factorial(r) * math.factorial(n-r))

def main():
   N = int(eval(input()))
   a = list(map(int, input().split()))
   a.sort()
   if N==2:
      return str(max(a))+" "+str(min(a))

   k = a[N//2-1]
   kk = a[N//2]
   A = a[N-1]
   if comb(A,k) > comb(A,kk):
      return str(A)+" "+str(k)
   return str(a[N-1])+" "+str(kk)



print((main()))



# Optimized solution

def main():
   N = int(eval(input()))
   a = list(map(int, input().split()))
   a.sort()
   A = a.pop()
   k = A/2
   for i in a:
      if k - i == 0:
         B = i
         break
      else:
         sa = k - i
         if sa < 0:
            if abs(B-k)>abs(sa):
               B = i
            break
         B = i
   return str(A)+" "+str(B)
         


print((main()))
# Original solution
from operator import mul
from functools import reduce


def calc_comb(n, r):
    r = min(r, n - r)
    numer = reduce(mul, list(range(n, n - r, -1)), 1)
    denom = reduce(mul, list(range(1, r + 1)), 1)
    return numer // denom


def main():
    n = int(eval(input()))
    a = [int(an) for an in input().split()]
    a.sort()
    ans = 0
    max_comb = 0
    sub_set = set()
    for i in range(n - 1):
        sub = a[-1] - a[i]
        if not sub in sub_set:
            sub_set.add(sub)
            comb = calc_comb(a[-1], a[i])
            if comb > max_comb:
                max_comb = comb
                ans = a[i]
    print(f'{a[-1]} {ans}')


if __name__ == '__main__':
    main()


# Optimized solution
def main():
    _ = int(eval(input()))
    a = [int(an) for an in input().split()]
    a.sort()
    half_val = -(-a[-1] // 2)
    dist_list = [abs(half_val - an) for an in a[:-1]]
    min_index = dist_list.index(min(dist_list))
    print(f'{a[-1]} {a[min_index]}')


if __name__ == '__main__':
    main()
# Original solution
n = int(eval(input()))
l = list(map(int,input().split()))
l.sort()
a = l[-1]
j = 0
while l[j] < int((a+1)/2):
    j += 1
else:
    if l[j] - int((a+1)/2) < int((a+1)/2) - l[j-1]:
        b = l[j]
    else:
        b = l[j-1]
print(("{} {}".format(a,b)))

# Optimized solution
N = int(eval(input()))
a = list(map(int,input().split()))
a.sort()
n = a[-1]
for i in range(N):
    if a[i]>=n/2:
        break

if n-a[i]>min(a[i-1],n-a[i-1]):
    r = a[i]
else:
    r = a[i-1]
print(('{} {}'.format(n,r)))
# Original solution
ri = lambda: int(input())
rl = lambda: list(map(int,input().split()))
rr = lambda N: [ri() for _ in range(N)]
YN = lambda b: print('YES') if b else print('NO')
yn = lambda b: print('Yes') if b else print('No')
OE = lambda x: print('Odd') if x%2 else print('Even')
INF = 10**18

n=ri()
a=rl()
a.sort()
#nCr % MOD
def cmb(n, r, MOD=0):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n
 
    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]
 
    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot
 
    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])
            if MOD != 0:
                result %= MOD
 
    return result

import bisect
ans = []
for i in range(1,min(n,len(str(n))+3)):
    p = a[-i]
    p2 = p/2
    q_i = bisect.bisect_left(a,p2)
    if ((a[q_i]-p2) > (p2 - a[q_i-1])) or p==a[q_i] and q_i != 0:
        q_i -= 1
    q = a[q_i]
    ans.append([cmb(p,q),p,q])

ans.sort(key=lambda x:x[0],reverse=True)
print(*ans[0][1:])


# Optimized solution
ri = lambda: int(input())
rl = lambda: list(map(int,input().split()))
rr = lambda N: [ri() for _ in range(N)]
YN = lambda b: print('YES') if b else print('NO')
yn = lambda b: print('Yes') if b else print('No')
OE = lambda x: print('Odd') if x%2 else print('Even')
INF = 10**18

n=ri()
a=rl()
a.sort()


import bisect

p = a[-1]
p2 = p/2
q_i = bisect.bisect_left(a,p2)
if ((a[q_i]-p2) > (p2 - a[q_i-1]) or p==a[q_i]) and q_i != 0:
    q_i -= 1
q = a[q_i]

print(p,q)
# Original solution
def comb(n,k):
    nCk = 1
    MOD = 10**9+7
    # X
    for i in range(n-k+1, n+1):
        nCk *= i
        nCk %= MOD

    # Y
    for i in range(1,k+1):
        nCk *= pow(i,MOD-2,MOD)
        nCk %= MOD
    return nCk

n = int(eval(input()))
a = list(map(int, input().split()))
ai = max(a)
aj = -1
nck = 0

for i in range(n):
    tmp = comb(ai, a[i])
    if nck <= tmp:
        nck = tmp
        aj = a[i]

print((str(ai) + " " + str(aj)))

# Optimized solution
n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
ai = a[-1]
aj = a[0]
center = ai // 2
diff = 10**10
# print("-----------")
# print(center)

for i in range(n-1):
    if abs(center - a[i]) <= diff and aj < a[i]:
        diff = abs(center - a[i])
        aj = a[i]
        # print(diff)
        # print(aj)
        # print("----")


print((str(ai) + " " + str(aj)))
# Original solution
n = int(eval(input()))
a=list(map(int,input().split()))

b = sorted(a,reverse=True)

def binary_search(x):
    l,r = 0,n-1
    while l+1<r:
        i = (l+r)//2
        if b[i] > x:
            l = i
        else:
            r = i
    if abs(b[l]-x)>=abs(b[l+1]-x):
        l += 1
    return b[l]

def comb(n,r):
    r = min(r,n-r)
    ret = 1
    for i in range(1,r+1):
        ret *= (n+1-i)
        ret /= i
    return int(ret)

ans = ""
m = 0
for c in b[:1]:
    if m > c**(c//2):
        break
    r = binary_search(c/2)
    comb_c_r = comb(c,r)
    if m < comb_c_r:
        m = comb_c_r
        ans = str(c)+" "+str(r)
print(ans)

# Optimized solution
n = int(eval(input()))
a=list(map(int,input().split()))

b = sorted(a,reverse=True)

def binary_search(x):
    l,r = 0,n-1
    while l+1<r:
        i = (l+r)//2
        if b[i] > x:
            l = i
        else:
            r = i
    if abs(b[l]-x)>=abs(b[l+1]-x):
        l += 1
    return b[l]

def comb(n,r):
    r = min(r,n-r)
    ret = 1
    for i in range(1,r+1):
        ret *= (n+1-i)
        ret /= i
    return int(ret)

ans = ""
m = 0
for c in b[:1]:
    r = binary_search(c/2)
    #comb_c_r = comb(c,r)
    #if m < comb_c_r:
        #m = comb_c_r
    ans = str(c)+" "+str(r)
print(ans)