Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

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

if n == 2:
    print(max(a))
else:
    l = [-1]
    r = []
    
    def gcd(x,y):
        while y != 0:
            x, y = y, x%y
    #        print(x,y)
        return(x)
    
    for i in range(n-1):
        m = a[i+1:][0]
        if len(a[i+1:]) == 1:
            m = a[i+1:][0]
        elif len(a[i+1:]) > 1:
            for j in a[i+1:]:
                m = gcd(m,j)
        r.append(m)
        m2 = a[:i+1][0]
        if len(a[:i+1]) == 1:
            m2 = a[:i+1][0]
        elif len(a[:i+1]) > 1:
            for j in a[:i+1]:
                m2 = gcd(m2,j)
        l.append(m2)
    r.append(-1)
 #   print(r)
  #  print(l)
    ans = 0
    for i in range(n):
        if l[i] == -1:
            ans = max(ans,r[i])
        elif r[i] == -1:
            ans = max(ans,l[i])
        else:
            ans = max(ans,gcd(l[i],r[i]))
    print(ans)

### FIXED CODE ###

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

if n == 2:
    print(max(a))
else:
    l = [0 for i in range(n)]
    r = [0 for i in range(n)]
    
    def gcd(x,y):
        while y != 0:
            x, y = y, x%y
    #        print(x,y)
        return(x)
    
    for i in range(1,n):
        l[i] = gcd(l[i-1],a[i-1])
        r[n-i-1] = gcd(r[n-i],a[n-i])
  #  print(l)
  #  print(r)
    ans = 0
    for i in range(n):
        if l[i] == -1:
            ans = max(ans,r[i])
        elif r[i] == -1:
            ans = max(ans,l[i])
        else:
            ans = max(ans,gcd(l[i],r[i]))
    print(ans)
### BUGGY CODE ###

import numpy as np
N = int(input())
A = list(map(int, input().split()))
a = np.array(A)
l = int(((N*N)+1)/2)
b = []
for i in range(l):
    b.append(1)
    b.append(-1)
b = b[:-1]
c = (np.array(b)).reshape(N,N)
# print(b)
# c = (np.delete(b, 2*l-1, axis=None)).reshape(N,N)
# print(c)
# d = c.reshape(N,N)
inv = 0.5*( np.triu(c) - ( np.tril(c) - np.eye(N) ) )
g = np.eye(N)
x = 2*(np.dot(inv,a))
ans = list(map(str, list(map(int, list(x)))))
print(" ".join(ans))

### FIXED CODE ###

import numpy as np
N = int(input())
A = list(map(int, input().split()))
a = np.array(A)
# l = int(((N*N)+1)/2)
b = []
for i in range(N):
    if i%2==0:
        b.append(1)
    else:
        b.append(-1)
c = np.dot(np.array(b),a)
x = [c]
for j in range(1,N):
    x_j = 2*a[j-1] - x[j-1]
    x.append(x_j)
ans = list(map(str, list(map(int, list(x)))))
print(" ".join(ans))
### BUGGY CODE ###

from sys import stdin
from sys import setrecursionlimit
from numba import jit
setrecursionlimit(10 ** 7)

n,m,k = map(int,stdin.readline().rstrip().split())
mod = 998244353
wariate = 1
point = 0

@jit
def combination(n,r,mod=mod):
    r=min(r,n-r)
    up,down=1,1
    for i in range(r):
        up=up*(n-i)%mod
        down=down*(i+1)%mod
    return up*pow(down,mod-2,mod)%mod

for i in range(n-1,-1,-1):
    now = 1
    if i != n-1:
        wariate *= m-1
        wariate %= mod
    if i <= k:
        now *= m%mod
        now *= combination(n-1,i)%mod
        now *= wariate%mod
        point += now

print(point%mod)

### FIXED CODE ###

from sys import stdin
from sys import setrecursionlimit

setrecursionlimit(10 ** 7)

n,m,k = map(int,stdin.readline().rstrip().split())
mod = 998244353
wariate = 1
point = 0

def prepare(n, MOD=mod):
    facts = [1]*(n+1)
    for i in range(1, n+1):
        facts[i] = facts[i-1]*i%MOD
    invs = [1]*(n+1)
    invs[n] = pow(facts[n], MOD-2, MOD)
    for i in range(0, n)[::-1]:
        invs[i] = invs[i+1] * (i+1) % MOD
    return facts, invs
facts, invs = prepare(n, mod)
for i in range(n-1,-1,-1):
    now = m
    if i != n-1:
        wariate *= m-1
        wariate %= mod
    now *= wariate%mod

    now *= facts[n-1]*invs[n-1-i]*invs[i]
    if i <= k:
        point += now%mod

print(point%mod)
### BUGGY CODE ###

import sys
import math
sys.setrecursionlimit(20000000)
input = sys.stdin.readline
x,y,z,p = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
a.sort()
b.sort()
c.sort()
"""
if x*y*z <= 3*10**6:
    abc = []
    for i in range(x):
        for j in range(y):
            for k in range(z):
                abc.append(a[i]+b[j]+c[k])
    abc.sort()
    abc = abc[::-1]
    for i in range(p):
        print(abc[i])  
    exit()
"""
ab = []
for i in range(x):
    for j in range(y):
        ab.append(a[i]+b[j])
ab.sort()
c = c[::-1]
ab = ab[::-1]
ab.append(-2**62)
ans = []
miru = [0]*z
for i in range(z):
    if i + 1 == z:
        d = -2**60
    else:
        d = c[i+1]+ab[0]
    for j in range(i+1):
         while ab[miru[j]] + c[j] >= d:
             ans.append(ab[miru[j]] + c[j])
             miru[j]+=1
    if len(ans) >= 3000:
        break
ans.sort()
ans = ans[::-1]
for i in range(p):
    print(ans[i])


### FIXED CODE ###

import sys
import math
sys.setrecursionlimit(20000000)
input = sys.stdin.readline
x,y,z,p = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
a.sort()
b.sort()
c.sort()
"""
if x*y*z <= 3*10**6:
    abc = []
    for i in range(x):
        for j in range(y):
            for k in range(z):
                abc.append(a[i]+b[j]+c[k])
    abc.sort()
    abc = abc[::-1]
    for i in range(p):
        print(abc[i])  
    exit()
"""
ab = []
for i in range(x):
    for j in range(y):
        ab.append(a[i]+b[j])
ab.sort()
c = c[::-1]
ab = ab[::-1]
ab.append(-2**62)
ans = []
miru = [0]*z
for i in range(z):
    if i + 1 == z:
        d = -2**60
    else:
        d = c[i+1]+ab[0]
    for j in range(i+1):
        flag = 0
        while ab[miru[j]] + c[j] >= d and (len(ans)<= p or ab[miru[j]] + c[j] >= ans[0]):
             ans.append(ab[miru[j]] + c[j])
             miru[j]+=1
             flag = 1
        if flag and len(ans) <=p+1:
            ans.sort()
ans.sort()
ans = ans[::-1]
for i in range(p):
    print(ans[i])
### BUGGY CODE ###

N=int(input())
A=list(map(int,input().split()))
ans=1
for i in range(N):
    ans=ans*A[i]
print(ans if ans<=10**18 else -1)

### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
ans=1
if 0 in A:
    print(0)
    exit()
for i in range(N):
    ans=ans*A[i]
    if ans>10**18:
        print(-1)
        exit()
print(ans)
### BUGGY CODE ###

N = int(input())
line = list(input())

# print(line)
bottom_w = N
top = 0
count = 0
while(bottom_w > top):
    for i in reversed(range(bottom_w)):
        if(line[i]=='R'):
            bottom_w = i
            break
    if(line[-1]=='W' and bottom_w == N):
        print(0)
        exit()
    if(bottom_w <= top):
        break
    for i in range(top,N):
        if(line[i]=='W' and bottom_w > i):
            # print("line",i,line[i])
            # print("swap",i,bottom_w)
            count += 1
            line[bottom_w] = 'W'
            top = i+1
            break
print(count)


### FIXED CODE ###

N = int(input())
line = list(input())

# print(line)
bottom_w = N
top = 0
count = 0
while(bottom_w > top):
    for i in reversed(range(bottom_w)):
        if(line[i]=='R'):
            bottom_w = i
            break

    if(line[-1]=='W' and bottom_w == N):
        print(0)
        exit()
    if(bottom_w <= top):
        break
    for i in range(top,N):
        if(i == N-1):
            print(count)
            exit()
        if(line[i]=='W' and bottom_w > i):
            # print("line",i,line[i])
            # print("swap",i,bottom_w)
            count += 1
            line[bottom_w] = 'W'
            top = i+1
            break
print(count)
### BUGGY CODE ###

def main():

    N, K = map(int, input().split())
    a = list(map(int, input().split()))
    dp = [[0]*(K+1) for i in range(N+1)]
    import collections
    dp[0][K] = 1
    mod = 10**9 + 7
    # dp[i][j] i人目まで配って、残りがj個の方法の数
    for i in range(1, N+1):
        tmp = 0
        q = collections.deque()
        for j in range(K, -1, -1):
            while(q):
                if q[0][0] > j:
                    t = q.popleft()
                    tmp -= t[1]
                else:
                    break
            if dp[i-1][j]:
                tmp += dp[i-1][j]
                q.append((max(j - a[i-1], 0), dp[i-1][j]))
            tmp %= mod
            dp[i][j] = tmp

    print(dp[-1][0])
main()


### FIXED CODE ###

def main():

    N, K = map(int, input().split())
    a = list(map(int, input().split()))
    dp = [[0]*(K+1) for i in range(N+1)]
    import collections
    dp[0][K] = 1
    mod = 10**9 + 7
    # dp[i][j] i人目まで配って、残りがj個の方法の数
    for i in range(1, N+1):
        tmp = 0
        q = collections.deque()
        for j in range(K, -1, -1):
            while(q):
                if q[0][0] > j:
                    t = q.popleft()
                    tmp -= t[1]
                else:
                    break
            if dp[i-1][j]:
                tmp += dp[i-1][j]
                q.append((max(j - a[i-1], 0), dp[i-1][j]))
            tmp %= mod
            dp[i][j] = tmp

    print(dp[-1][0])


main()
### BUGGY CODE ###

import  copy

N, M = map(int, input().split())

Alist = list(map(int,input().split()))

Alist_B = copy.copy(Alist)
Alist_C = [1]*N

for i in range(0,M):
    temp = Alist_B.index(max(Alist_B))
    Alist_B[temp] = Alist[temp] // (2 ** Alist_C[temp])
    Alist_C[temp] +=1

ans = 0
for j in Alist_B:
    ans +=j

print(ans)

### FIXED CODE ###

import  heapq

N, M = map(int, input().split())

Alist = list(map(lambda x : x * (-1), map(int, input().split())))
heapq.heapify(Alist)

for i in range(0,M):
    a = - (-heapq.heappop(Alist) // 2)
    heapq.heappush(Alist,a)

ans = 0
for j in Alist:
    ans += j * (-1)

print(ans)
### BUGGY CODE ###

s = input()

l = [0 for i in range(2019)]
n = len(s)
s_int = int(s)

for i in range(n+1):
    tmp = s_int % (10**i) % 2019 
    l[tmp] += 1

res = 0
for i in l:
    res += i * (i-1) // 2

print(res)

### FIXED CODE ###

s = input()
s = s[::-1]

l = [0 for i in range(2019)]
n = len(s)
l[0] = 1
prev = 0
digit = 1
for c in s:
    t = (int(c) * digit + prev) % 2019
    l[t] += 1
    digit = (digit * 10) % 2019
    prev = t

res = 0
for i in l:
    res += i * (i-1) // 2

print(res)
### BUGGY CODE ###

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

filled = [0 for _ in range(n)]
ans = []
for i in range(n-1, -1, -1):
  if sum(filled[i:][::i+1]) % 2 != A[i]:
    filled[i] = 1
    ans.append(i+1)
print(len(ans))
print(' '.join(map(str, ans)))

### FIXED CODE ###

# from other person's code
n = int(input())
a = list(map(int, input().split()))
ls = [0]*(n+1)
ans = []
for i in reversed(list(range(n))):
    if sum(ls[::i+1][1:]) % 2 != a[i]:
        ls[i+1] = 1
        ans.append(i+1)
print(sum(ls))
if ans: print(' '.join(map(str, ans)))
### BUGGY CODE ###

n=int(input())
s=[""]*n
r=0
for ii in range(n):
  ss=list(input())
  ss.sort()
  s[ii]="".join(ss)
"""
for ii in range(n):
  print(s[ii])
"""
import numpy as np
for ii in range(n-1):
  for jj in np.arange(ii+1,n):
    #print(ii,jj)
    if s[ii]==s[jj]:
      #print(s[ii],s[jj])
      r+=1
print(r)


### FIXED CODE ###

n=int(input())
s=[""]*n
st=set()
d={}
for ii in range(n):
  ss=list(input())
  ss.sort()
  ss="".join(ss)
  if ss in st:
    d[ss]+=1
  else:
    d[ss]=1
    st.add(ss)

if len(st)==n:
  print(0)
  exit()
if len(st)==1:
  print((n*(n-1))//2)
  exit()

r=0
for sss in st:
  c=d[sss]
  if c>1:
    r+=(c*(c-1))//2
    
print(r)
### BUGGY CODE ###

k,s=[int(i) for i in input().split()]

count=0
for x in range(k+1):
    for y in range(k+1):
        for z in range(k+1):
            if x+y+z==s:
                count+=1
                break
                
print(count)

### FIXED CODE ###

k,s=[int(i) for i in input().split()]

count=0
for x in range(k+1):
    for y in range(k+1):
        if 0<=s-(x+y)<=k:
            count+=1
               
                
print(count)
### BUGGY CODE ###

(n, k) = [int(i) for i in input().split(" ")]
p = [int(i) for i in input().split(" ")]


maxNum = -1
maxIndex = [0, 0]
for i in range(n-k+1):
  s = 0
  for j in range(i, i+k, 1):
    s += p[j]
  if s > maxNum:
    maxNum = s
    maxIndex = [i, i+k]

dices = p[maxIndex[0]:maxIndex[1]]
exs = 0
for dice in dices:
  e = 0
  for i in range(1, dice+1):
    e += i / dice
  exs += e
print(exs)

### FIXED CODE ###

(n, k) = [int(i) for i in input().split(" ")]
p = [int(i) for i in input().split(" ")]

s = 0
sums = [0]
for i in p:
  	s += i
  	sums.append(s)

maxNum = -1
maxIndex = [0, 0]
for i in range(len(sums)-k):
  if sums[i+k] - sums[i] > maxNum:
    maxNum = sums[i+k] - sums[i]
    maxIndex = [i, i+k-1]

dices = p[maxIndex[0]:maxIndex[1]+1]
e = 0
for dice in dices:
  e += sum(list(range(1, dice+1))) / dice
print(e)
### BUGGY CODE ###

N = int(input())
A = list(map(int, input().split()))
d = dict()
for i in range(1,N+1):
    print(A[i-1:].count(i))

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
B = [0 for _ in range(N)]
for i in A:
    B[i-1] += 1
for j in range(N):
    print(B[j])
### BUGGY CODE ###

def max(a,b):
    if a>b:
        return a
    else:
        return b
 
def min(a,b):
    if a>b:
        return b
    else:
        return a
 
def gcd(a,b):
    a,b = max(a,b),min(a,b)
    while a%b!=0:
        a,b = b,a%b
    return b
 
 
def gcdl(A):
    if len(A)==2:
        return gcd(A[0],A[1])
    elif len(A)==1:
        return A[0]
    else:
        return gcd(gcdl(A[:len(A)//2]),gcdl(A[len(A)//2:]))


def sieve_of_eratosthenes(n):
    pl = [i for i in range(2, n + 1)]
    i=0
    D = [0]*(n+1)
    p = pl[0]
    while p**2<=n:
        pl1 = []
        for j in range(len(pl)):
            if pl[j]%p!=0 or j<=i:
                pl1.append(pl[j])
            else:
                D[pl[j]] = p
        pl = pl1
        i+=1
        p=pl[i]
    for p in pl:
        D[p] = p
    return D

D = sieve_of_eratosthenes(1000000)

N = int(input())
A = list(map(int,input().split()))

F = set([])
flag = True
for a in A:
    b = a
    fact = set([])
    while b>1:
        fact.add(D[b])
        b//=D[b]
    if len(F & fact)>0:
        flag=False
        break
    F = F | fact

if flag:
    print("pairwise coprime")
else:
    if gcdl(A)==1:
        print("setwise coprime")
    else:
        print("not coprime")

### FIXED CODE ###

def max(a,b):
    if a>b:
        return a
    else:
        return b

def min(a,b):
    if a>b:
        return b
    else:
        return a

def gcd(a,b):
    a,b = max(a,b),min(a,b)
    while a%b!=0:
        a,b = b,a%b
    return b

from collections import defaultdict
def factorize(n,dd):
    #print(int(n**0.5))
    for i in range(2,int(n**0.5)+1):
        flag=True
        while n%i==0 and n>0:
            if flag:
                if dd[i]>0:
                    return False
                else:
                    flag=False
            dd[i]+=1
            n//=i
    if n>1:
        if dd[n]>0:
            return False
        dd[n]+=1
    #print(dd)
    return True

def gcdl(A):
    if len(A)==2:
        return gcd(A[0],A[1])
    elif len(A)==1:
        return A[0]
    else:
        return gcd(gcdl(A[:len(A)//2]),gcdl(A[len(A)//2:]))

import sys

sys.setrecursionlimit(500000)
def input():
    return sys.stdin.readline()[:-1]

def main():
    N = int(input())

    A = list(map(int,input().split()))

    B = [a for a in A if a!=1]

    if len(B)<=1:
        print("pairwise coprime")
    else:
        N = len(B)
        if N>78498:
            if len(B)!=len(A):
                print("setwise coprime")
            else:
                print("not coprime")
        else:
            dd = defaultdict(int)
            flag=True
            for b in B:
                if factorize(b,dd)==False:
                    flag=False
                    break
            if flag:
                print("pairwise coprime")
            else:
                if len(B)!=len(A):
                    print("setwise coprime")
                elif gcdl(B)==1:
                    print("setwise coprime")
                else:
                    print("not coprime")        
        
if __name__ == '__main__':
    main()
### BUGGY CODE ###


N,a,b = map(int,input().split())
Sum = pow(2, N, 10**9+7)-1
MOD = 10**9 + 7
def comb(n,k, mod):
    m = 1#分子
    l = 1#bunnbo
    for i in range(k):
        m *= (n-i)
        l *= (i + 1)
        m %= mod
    return m * pow(l, mod-2, mod) % mod

Sum = pow(2, N, 10**9+7) -1 - comb(N, a, MOD) - comb(N, b, MOD)
Sum = Sum % (10**9+7)
print(Sum)

### FIXED CODE ###


N,a,b = map(int,input().split())
MOD = 10**9 + 7
def comb(n,k, mod):
    m = 1#分子
    l = 1#bunnbo
    for i in range(k):
        m *= n - i
        l *= (i + 1)
        m %= mod
        l %= mod
    return m * pow(l, mod-2, mod) % mod

Sum = pow(2, N, 10**9+7) -1 - comb(N, a, MOD) - comb(N, b, MOD)
Sum = Sum % (10**9+7)
print(Sum)
### BUGGY CODE ###

import numpy as np
n, k, q = map(int, input().split())
point = np.array([k for _ in range(n)])


def judge(point):
    ans = []
    for _ in range(q):
        a = int(input())
        point -= 1
        point[a-1] += 1
    if k > q:
        return(['Yes' for _ in range(n)])
    for i in range(n):
        if point[i] > 0:
            ans.append('Yes')
        else:
            ans.append('No')
    return(ans)
            

ans = judge(point)
print(*ans)

### FIXED CODE ###

n, k, q = map(int, input().split())
def judge():
    val = {}
    for _ in range(q):
        a = int(input())
        val[a-1] = val.get(a-1,0) + 1
    #print(val)
    for i in range(n):
        if val.get(i,k-q) + (k - q) > 0:
            print('Yes')
        else:
            print('No')
if k > q:
    print(*['Yes' for _ in range(n)])
else:
    ans = judge()
### BUGGY CODE ###

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

ans = 1
for i in list:
    ans = ans * i

if ans>10**18:
    print(-1)
else:
    print(ans)


### FIXED CODE ###

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

ans = 1
flag = True
for i in range(n):
    ans *= list[i]
    if ans>10**18:
        flag = False
        ans = ans%(10**18)
    if list[i]==0:
        flag = True
        break

if flag:
    print(ans)
else:
    print(-1)
### BUGGY CODE ###

from collections import Counter
N = int(input())
List = list(map(str, input().split()))
Q = int(input())
x = [0] * Q
y = [0] * Q
for i in range(Q):
    x[i], y[i] = map(str, input().split())
    y[i]=int(y[i])

wa=0
for i in List:
    wa+=int(i)

for i in range(Q):
    c =Counter(List)
    num=c['{}'.format(x[i])]
    wa+=num*(y[i]-int(x[i]))
    List=[s.replace('{}'.format(x[i]), '{}'.format(str(y[i]))) for s in List]
    print(wa)

### FIXED CODE ###

from collections import Counter
N = int(input())
List = list(map(str, input().split()))
Q = int(input())
x = [0] * Q
y = [0] * Q
for i in range(Q):
    x[i], y[i] = map(str, input().split())
    y[i]=int(y[i])

wa=0
for i in List:
    wa+=int(i)
c =Counter(List)
for i in range(Q):
    num=c['{}'.format(x[i])]
    wa+=num*(y[i]-int(x[i]))
    c['{}'.format(x[i])]=0
    c['{}'.format(str(y[i]))]+=num
    print(wa)
### BUGGY CODE ###

# -*- coding: utf-8 -*-

N, M = map(int, input().split())
abM = [list(map(int, input().split())) for i in range(M)]

transit = []
for i in range(M):
    if abM[i][0] == 1:
        transit.append(abM[i][1])

for i in range(M):
    if abM[i][1] == N:
        if abM[i][0] in transit:
            print("POSSIBLE")
            exit()
        
print("IMPOSSIBLE")

### FIXED CODE ###

# -*- coding: utf-8 -*-

N, M = map(int, input().split())
abM = [list(map(int, input().split())) for i in range(M)]

transit = []
transit2 = []
for i in range(M):
    if abM[i][0] == 1:
        transit.append(abM[i][1])
    if abM[i][1] == N:
        transit2.append(abM[i][0])

# setで共通要素の集合を取ってみる
if len(set(transit) & set(transit2)) != 0:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
### BUGGY CODE ###

n,p=map(int,input().split())
if n==1:
	print(p)
	exit()
ans=1
for i in range(2,int(p**(1/n))+2):
	while p%(i**n)==0:
		if p%(i**n)==0:
			ans*=i
			p//=(i**n)
print(ans)


### FIXED CODE ###


n,p=map(int,input().split())
ans=[]
for i in range(2,int(p**0.5)+1):
	cnt=0
	while p%i==0:
		p//=i
		cnt+=1
	if cnt>0:
		ans.append([i,cnt])
ans.append([p,1])
ret=1
for i in range(len(ans)):
	ret*=pow(ans[i][0],(ans[i][1]//n))
print(ret)
### BUGGY CODE ###

import math

MOD = 10 ** 9 + 7


def comb(n, r):
    if (r < 0) or n < r:
        return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


def solve(N, K, A):
    A.sort()
    ans = 0

    for i in range(1, N):
        now = comb(i, K - 1)
        ans += A[i] * now

    A.sort(reverse=True)
    for i in range(1, N):
        now = comb(i, K - 1)
        ans += A[i] * (-now)

    return ans % MOD


# N = int(input())
# S = input()
N, K = map(int, input().split())
A = list(map(int, input().split()))

print(solve(N, K, A))


### FIXED CODE ###

MOD = 10 ** 9 + 7

def solve(N, K, A):
    A.sort()
    ans = 0
 
    for i in range(1, N):
        now = cmb(i, K - 1, MOD)
        ans += A[i] * now
 
    A.sort(reverse=True)
    for i in range(1, N):
        now = cmb(i, K - 1, MOD)
        ans += A[i] * (-now)
 
    return ans % MOD
 
 
# N = int(input())
# S = input()
N, K = map(int, input().split())
A = list(map(int, input().split()))

def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p

p = 10 ** 9 + 7
fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]
 
for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)


print(solve(N, K, A))
### BUGGY CODE ###

#import numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep='\n')

N = int(input())
A = list(map(int, input().split()))
A.sort()
maxA = A[-1]

fact = [1]
for i in range(1, maxA+10):
    fact.append(fact[-1] * i % MOD)
def rev(x):
    return pow(x, MOD-2, MOD)
def cmb(i, k):
    if(i < k): return 0
    return fact[i] * rev(fact[k]) * rev(fact[i-k]) % MOD

ans = [A[1], A[0]]
mcand = cmb(A[1], A[0])
for a in reversed(A):
    even = a%2==0
    div = a//2
    ind = bisect_left(A, div)
    cand1 = cmb(a, A[ind-1])
    cand2 = cmb(a, A[ind])
    # print(a, cand1, cand2)

    upd = False
    for i, can in enu([cand1, cand2]):
        if mcand < can:
            mcand = can
            ans = [a, A[ind-1+i]]
            upd = True
            # print('upd!', mcand)
    if not(upd):
        break

print(*ans)

### FIXED CODE ###

# import numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial, gcd
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10 ** 7)
enu = enumerate
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep="\n")

N = int(input())
A = list(map(int, input().split()))

fact = [1]
for i in range(1, N + 10):
    fact.append(fact[-1] * i % MOD)


def rev(x):
    return pow(x, MOD - 2, MOD)


def cmb(i, k):
    if i < k:
        return 0
    return fact[i] * rev(fact[k]) * rev(fact[i - k]) % MOD


A.sort()
if N == 2:
    print(A[1], A[0])
    exit()

mv = A[-1]
vm = mv // 2
bli = bisect_left(A, vm)
if bli == N - 1:
    print(mv, A[bli - 1])
elif bli == 0:
    print(mv, A[bli])
else:
    if vm - A[bli - 1] < A[bli] - vm:
        print(mv, A[bli - 1])
    else:
        print(mv, A[bli])
### BUGGY CODE ###

n = input()
p = list(int(i) for i in input().split())
count = 1
for i in range(1,len(p)):
  if(p[i] <= sorted(p[0:i])[0]):
    count += 1

print(count) 


### FIXED CODE ###

n = input()
p = list(int(i) for i in input().split())
count = 1
min_num = min(p[0:1])
for i in range(1,len(p)):
  if(p[i] <= min_num):
    count += 1
    min_num = p[i]

print(count)