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

import math
A, B, K = map(int, input().split())

if A > K:
    A = A - K
    print(A, end=" ")
    print(B)
    exit(0)

if K > A:
    K = K - A
    A = 0
    if K >= B:
        K = K - B
        B = 0
    
    
for i in range(K):
    if A >= 1:
        A -= 1
    elif B >= 1:
        B -= 1
    if A == 0 and B == 0:
        break

print(A, end=" ")
print(B)

### FIXED CODE ###

import math
A, B, K = map(int, input().split())

if A >= K:
    A = A - K
    print(A, end=" ")
    print(B)
    exit(0)

if K > A:
    K = K - A
    A = 0
    if K >= B:
        B = 0
        print(A, end=" ")
        print(B)
        exit(0)
    if B > K:
        B = B - K
        print(A, end=" ")
        print(B)
        exit(0)
### BUGGY CODE ###

n=int(input())
a=list(map(int,input().split()))
b=[-1]*(n+1)
base=0
for i in range(n):
    if b[a[i]]==-1:
        c=a.count(a[i])
        b[a[i]]=c
        base+=c*(c-1)//2
for i in range(n):
    d=b[a[i]]
    print(base-d+1)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
a0=[ai for ai in a]
a0.sort()
b=[-1]*(n+1)
base=0
i=0
while i < n:
    t=a0[i]
    c=1
    while i < n-1 and a0[i]==a0[i+1]:
        c+=1
        i+=1
    b[t]=c
    base+=c*(c-1)//2
    i+=1
for i in range(n):
    d=b[a[i]]
    print(base-d+1)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
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 II(): return int(sys.stdin.readline())
def SI(): return input()

def main():
    N = II()
    C = []
    for _ in range(N):
        c = II()
        if len(C) == 0 or c != C[-1]:
            C.append(c)
    global ans
    ans = 0
    dp = [1] + [0] * N
    from collections import defaultdict
    idxs = defaultdict(list)
    for i, c in enumerate(C):
        ret = dp[i]
        if c in idxs.keys():
            for j in idxs[c]:
                ret += dp[j]
        dp[i + 1] = ret % MOD
        idxs[c].append(i)

    ans = dp[len(C)]

    return ans % MOD

print(main())

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
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 II(): return int(sys.stdin.readline())
def SI(): return input()

def main():
    N = II()
    C = []
    for _ in range(N):
        c = II()
        if len(C) == 0 or c != C[-1]:
            C.append(c)
    global ans
    ans = 0
    dp = [1] + [0] * N
    from collections import defaultdict
    cnt_clr = defaultdict(int)
    for i, c in enumerate(C):
        ret = dp[i]
        ret += cnt_clr[c]
        cnt_clr[c] = ret
        dp[i + 1] = ret % MOD

    ans = dp[len(C)]

    return ans % MOD

print(main())
### BUGGY CODE ###

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

#----------
N = int(input().strip())
A_list = list(input().strip())
#----------

count = N
for i_leader in range(len(A_list)):
    ahead_list = A_list[:i_leader]
    behind_list = A_list[i_leader+1:]
    
    turn_W_to_E = len( [ i for i in ahead_list if i == "W"] )
    turn_E_to_W = len( [ i for i in behind_list if i == "E"] )
    turn_member = turn_W_to_E + turn_E_to_W
    
    if turn_member < count:
        count = turn_member

print(count)


### FIXED CODE ###

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

#----------
N = int(input().strip())
A_list = list(input().strip())
#----------
W_member_sum_0_to_N = [0]*len(A_list)
E_member_sum_N_to_0 = [0]*len(A_list)

cnt=0
for i in range(len(A_list)):
    if A_list[i] == "W":
        cnt += 1
    W_member_sum_0_to_N[i] += cnt

cnt=0
for i in range(len(A_list)-1,-1,-1):
    if A_list[i] == "E":
        cnt += 1
    E_member_sum_N_to_0[i] += cnt
        

count = N
for i_leader in range(len(A_list)):
    if i_leader == 0:
        turn_member = E_member_sum_N_to_0[i_leader+1]
    elif i_leader == len(A_list)-1:
        turn_member = W_member_sum_0_to_N[i_leader-1]
    else:
        turn_member = W_member_sum_0_to_N[i_leader-1] + E_member_sum_N_to_0[i_leader+1]

    if turn_member < count:
        count = turn_member


print(count)
### BUGGY CODE ###

N = int(input())
L = list(map(int,input().split()))
L = sorted(L, reverse =True)
counter = 0
for i in range(N):
  for j in range(N-1-i):
    for k in range(N -2 -i -j):
      a = L[i]
      b = L[i+j+1]
      c = L[i+j+k+2]
      if c <= a-b:
        break
      elif b < a + c:
        counter += 1
    
print(counter)

### FIXED CODE ###

import bisect
N = int(input())
List = list(map(int,input().split()))
List.sort()
ans = 0
for i in range(N-1):
  for j in range(i+1, N):
    ans += bisect.bisect_left(List,List[i]+List[j])-(j+1)
print(ans)
### BUGGY CODE ###

import collections
n = int(input())
l = list(str(input()) for _ in range(n))
d = [{} for _ in range(n)]

for m, a in enumerate(l):
    for p in range(10):
        d[m][a[p]] = a.count(a[p])
cnt = 0
dellist = lambda items, indexes: [item for index, item in enumerate(items) if index not in indexes]
A=["a","b","c","d","e","f","g","h"]
r=[0,4,5]

for i in d:
    pp=[i==k for k in d]
    kk = [x for x, _ in enumerate(pp) if _]
    d = dellist(d, kk)
    cnt += (len(kk)-1)*len(kk)/2
# for i, j in enumerate(d):
#     for k in range(i+1, len(d)):
#         if j == d[k]:
#             cnt += 1

print(int(cnt))


### FIXED CODE ###

N = int(input())
s = [input() for i in [0]*N]
words = {}
cnt = 0
for i in s:
    i = "".join(sorted(i))
    time = words.get(i,0)
    cnt += time
    words[i] = time + 1
print(cnt)
### BUGGY CODE ###

n = int(input())
nums = [int(i) for i in input().split()]
mod = 10 ** 9 + 7

def gcd(x, y): #GCD
    # greatest_common_divisor
    if x < y:
        x, y = y, x
    if y == 0:
        return 0
    if x % y == 0:
        return y
    return gcd(y, x % y)

def lcm(x, y): #LCM
    # lowest_common_multiple
    return x * y // gcd(x, y)

LCM = 1
for num in nums:
    LCM = lcm(num, LCM)

# ans = 0
# for num in nums:
#     ans += (LCM // num) % mod
# print(ans % mod)
ans = 0
for num in nums:
    ans += LCM * pow(num, mod - 2, mod)
    ans %= mod

print(ans % mod)

### FIXED CODE ###

mod=10**9+7
n=int(input())
a=list(map(int,input().split()))
def gcd(a,b):
  while b:a,b=b,a%b
  return a
def lcm(a,b):return a*b//gcd(a,b)
l=a[0]
for i in range(1,n):
  l=lcm(l,a[i])
ans=0
l%=mod
for i in range(n):
  ans+=l*pow(a[i],mod-2,mod)
  ans%=mod
print(ans)
### BUGGY CODE ###

import sys
#input = sys.stdin.readline
sys.setrecursionlimit(10**9)

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

dp = [[0]*(N+1) for i in range(N+1)]

flag = [[0]*(N+1) for i in range(N+1)]

cA = [0]*(N+1)
for i in range(1,N+1) :
    cA[i] = cA[i-1] + A[i-1]

def f(left, right) :
    if flag[left][right] :
        return dp[left][right]
    elif left == right :
        return 0
    else :
        res = float("inf")
        for i in range(left, right) :
            res = min(res, f(left, i) + f(i+1, right))
        res += cA[right+1] - cA[left]
        dp[left][right] = res
        return res

ans = f(0,N-1)

print(ans)

#print(cA)

### FIXED CODE ###

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

dp = [[10**18]*N for i in range(N)]

cA = [0]*(N+1)
for i in range(1,N+1) :
    cA[i] = cA[i-1] + A[i-1]

    dp[i-1][i-1] = 0

for d in range(1,N) :
    for i in range(N-d) :
        for cut in range(i, i+d) :
            dp[i][i+d] = min(dp[i][i+d], dp[i][cut] + dp[cut+1][i+d] + cA[i+d+1] - cA[i])

ans = dp[0][N-1]

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

n, m, q = map(int, input().split())

arr = [[0 for j in range(n)] for i in range(n)]
arr_sum = [[0 for j in range(n)] for i in range(n)]
arr_sum2 = [[0 for j in range(n)] for i in range(n)]

for i in range(m):
    l, r = map(int, input().split())
    arr[l-1][r-1] += 1

for i in range(n):
    for j in range(n):
        if i <= j:
            arr_sum[i][j] = sum(arr[i][:j+1])

for i in range(n):
    for j in range(n):
        if i <= j:
            for k in range(i,j+1):
                arr_sum2[i][j] += arr_sum[k][j]


ans_arr = []
for k in range(q):
    p, q = map(int, input().split())
    ans = arr_sum2[p-1][q-1]
    ans_arr.append(ans)

for i in ans_arr:
    print(i)

### FIXED CODE ###

n, m, q = map(int, input().split())

arr = [[0 for j in range(n)] for i in range(n)]
arr_sum = []
arr_sum2 = []

for i in range(m):
    l, r = map(int, input().split())
    arr[l-1][r-1] += 1


for i in range(n):
    s = 0
    arr_tmp = []
    for j in range(n):
            s += arr[i][j]
            arr_tmp.append(s)
    arr_sum.append(arr_tmp)


for j in range(n):
    s = 0
    arr_tmp2 = []
    for i in range(n-1,-1,-1):
            s += arr_sum[i][j]
            arr_tmp2.append(s)
    arr_sum2.append(arr_tmp2)

arr_sum3 = [[0 for j in range(n)] for i in range(n)]
for i in range(n):
    for j in range(n):
        arr_sum3[i][j] = arr_sum2[j][n-i-1]

ans_arr = []
for k in range(q):
    p, q = map(int, input().split())
    ans = arr_sum3[p-1][q-1]
    ans_arr.append(ans)

for i in ans_arr:
    print(i)
### BUGGY CODE ###

n = int(input())
a = {}
for i in range(n):
  s = input()
  a[s] = a.get(s,0) + 1
b = sorted([i for i in a.keys() if a[i]==max(a.values())])
[print(i) for i in b]

### FIXED CODE ###

n = int(input())
a = {}
for i in range(n):
  s = input()
  a[s] = a.get(s,0) + 1
max_a = max(a.values())
b = sorted([i for i in a.keys() if a[i]==max_a])
[print(i) for i in b]
### BUGGY CODE ###

N = int(input())
A = list(map(int, input().split()))
a = [0]*(N+1)
ans = [0]*(N)

for i in range(1,N+1):
    a[i] = i

for i in range(N):
    pairs = zip(A, a)
    sortedpairs = sorted(pairs, key=lambda x: x[0])

for i in range(N):
    ans[i] = sortedpairs[i][1]+1

#print(ans)
print(' '.join(map(str, ans)))

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
a = [0]*(N+1)
ans = [0]*(N)

for i in range(1,N+1):
    a[i] = i


pairs = zip(A, a)
sortedpairs = sorted(pairs, key=lambda x: x[0])

for i in range(N):
    ans[i] = sortedpairs[i][1]+1

#print(ans)
print(' '.join(map(str, ans)))
### BUGGY CODE ###

from collections import deque
N,Q = (int(x) for x in input().split())
connected = [[] for _ in range(N)]
for _ in range(N-1):
    a,b = (int(x) for x in input().split())
    connected[a-1].append(b)
    connected[b-1].append(a)
counter = [0] * N
for _ in range(Q):
    p,x = (int(y) for y in input().split())
    counter[p-1] += x
ans = counter
q = deque([(1,0)])
searched = [0] * N
while q:
    a,p = q.popleft()
    if searched[a-1] == 0:
        if p != 0:
            ans[a-1] += ans[p-1]
        searched[a-1] = 1
        for child in connected[a-1]:
            q.append((child,a))
print(*ans)

### FIXED CODE ###

from collections import deque
N,Q = (int(x) for x in input().split())
connected = [[] for _ in range(N)]
for _ in range(N-1):
    a,b = (int(x) for x in input().split())
    connected[a-1].append(b)
    connected[b-1].append(a)
counter = [0] * N
for _ in range(Q):
    p,x = (int(y) for y in input().split())
    counter[p-1] += x
ans = counter
q = deque([(1,0)])
searched = [0] * N
while q:
    a,p = q.popleft()
    if p != 0:
        ans[a-1] += ans[p-1]
    searched[a-1] = 1
    for child in connected[a-1]:
        if searched[child-1] == 0:
            q.append((child,a))
print(*ans)
### BUGGY CODE ###

from bisect import bisect_left

X,Y,Z,K=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))

if X*Y*Z <= 10**5:
  D = sorted([A[i]+B[j]+C[k] for i in range(X) for j in range(Y) for k in range(Z)],reverse=True)
  for i in range(K):
    print(D[i])
  
else:
  A = sorted(A)
  D = sorted([B[i]+C[j] for i in range(Y) for j in range(Z)])

  thr = K//2
  s = A[-1]+D[0]
  prev_idx=0
  selected = [A[-1] + D[i] for i in range(len(D))]
  for i in range(1,X):
    r = s - A[-1-i]
    if r<=0:break
    idx = bisect_left(D,r,prev_idx,len(D)-1)
    if idx == len(D):break
    selected.extend([A[-1-i] + D[j] for j in range(idx,len(D))])
    prec_idx = idx

  selected = sorted(selected,reverse=True)
  print(len(selected))

  for i in range(K):
    print(selected[i])

### FIXED CODE ###

from bisect import bisect_left

X,Y,Z,K=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))

if X*Y*Z <= 50000:
  D = sorted([A[i]+B[j]+C[k] for i in range(X) for j in range(Y) for k in range(Z)],reverse=True)
  for i in range(K):
    print(D[i])
  
else:
  A = sorted(A)
  D = sorted([B[i]+C[j] for i in range(Y) for j in range(Z)])

  thr = K
  s = A[-1]+D[max(0,len(D)-thr)]
  prev_idx=0
  selected = [A[-1] + D[i] for i in range(max(0,len(D)-thr),len(D))]
  
  for i in range(1,X):
    r = s - A[-1-i]
    if r<=0:break
    idx = bisect_left(D,r,prev_idx,len(D)-1)
    if idx == len(D):break
    selected.extend([A[-1-i] + D[j] for j in range(idx,len(D))])
    prec_idx = idx

  selected = sorted(selected,reverse=True)

  for i in range(K):
    print(selected[i])
### BUGGY CODE ###

N, P = map(int, input().split())
S = input()
print(sum(int(int(S[i:j+1])%P==0) for i in range(N) for j in range(i, N)))

### FIXED CODE ###

N, P = map(int, input().split())
S = input()
total = 0
if P == 2:
  for idx, right_value in enumerate(S, 1):
    if int(int(right_value)%2==0):
      total += idx
elif P == 5:
  valid_options = (0, 5)
  for idx, right_value in enumerate(S, 1):
    if int(int(right_value) in valid_options):
      total += idx
else:
  histo_modsuffix = [0]*P
  previous = 0
  for i, val in enumerate(reversed(S)):
    scale = pow(10, i, P)
    new_val = (previous + scale*int(val))%P
    histo_modsuffix[new_val] += 1
    previous = new_val
  for val in histo_modsuffix:
    total += val*(val-1)//2
  total += histo_modsuffix[0] # when right hand side is at far end
print(total)
### BUGGY CODE ###

import bisect
import array

n, m = map(int, input().split())
a = map(int, input().split())
a = array.array("L", sorted(list(a)))
for _ in range(m):  # O(m*n)
    max_num = a[-1]  # O(1)
    index = bisect.bisect_left(a, max_num // 2)  # O(log n)
    a[index + 1:] = a[index:-1]
    a[index] = max_num // 2
print(sum(a))

### FIXED CODE ###

class heap():
    def __init__(self, maxcom=True):
        if maxcom:
            self.compare = lambda x, y: x > y
        else:
            self.compare = lambda x, y: x < y

    def heappush(self, x, heap):
        heap.append(x)
        length = len(heap)
        pointer = length
        while True:
            if pointer == 1:
                break
            if self.compare(heap[pointer - 1], heap[(pointer >> 1) - 1]):
                heap[pointer - 1], heap[(pointer >> 1) - 1] = heap[(pointer >> 1) - 1], heap[pointer - 1]
                pointer = pointer >> 1
            else:
                break

    def heapreplace(self, function, heap):
        heap[0] = function(heap[0])
        pointer = 1
        length = len(heap)
        while True:
            if (pointer << 1) > length:
                break
            elif (pointer << 1) + 1 > length :
                if self.compare(heap[(pointer << 1) - 1], heap[pointer - 1]):
                    heap[(pointer << 1) - 1], heap[pointer - 1] = heap[pointer - 1], heap[(pointer << 1) - 1]
                else:
                    break
            else:
                if self.compare(heap[(pointer << 1) - 1], heap[pointer << 1]):
                    next_pointer = pointer << 1
                else:
                    next_pointer = (pointer << 1) + 1
                if self.compare(heap[next_pointer - 1], heap[pointer - 1]):
                    heap[next_pointer - 1], heap[pointer - 1] = heap[pointer - 1], heap[next_pointer - 1]
                    pointer=next_pointer
                else:
                    break


n, m = map(int, input().split())
a = map(int, input().split())
heapq = []
heapc=heap(True)
for i in a:
    heapc.heappush(i,heapq)
for _ in range(m):
    heapc.heapreplace(lambda x:x>>1,heapq)
print(sum(heapq))
### BUGGY CODE ###

if __name__ == '__main__':
    N = int(input())
    L = sorted(list(map(int, input().split())))
    res = 0
    for i, li in enumerate(L[:-2]):
        for j, lj in enumerate(L[i+1:-1]):
            for k, lk in enumerate(L[i+j+2:]):
                if lk-lj >= li:
                    res += k
                    break
            else:
                res += k + 1
    print(res)


### FIXED CODE ###

import bisect


if __name__ == '__main__':
    N = int(input())
    L = sorted(list(map(int, input().split())))
    ans = 0
    for i in range(N-2):
        for j in range(i+1, N-1):
            ans += bisect.bisect_left(L, L[i]+L[j])-j-1
    print(ans)
### BUGGY CODE ###

def f(n):
  ans=1
  if n%2==1:
    a=2
    b=n//2+1
    c=n+2
  else:
    a=1
    b=n//2
    c=n+1
  for s in range(a,b+1):
    ans*=s*(c-s)
  ans=ans%(10**9+7)
  return ans
print(f(int(input())))

### FIXED CODE ###

from math import factorial;print(factorial(int(input()))%(10**9+7))
### BUGGY CODE ###

n = int(input())
sis = []
for i in range(n):
  si = input()
  sis.append(si)
s_one = list(set(sis))
if len(s_one) == 1:
  print(s_one[0])
  quit()
s_max = []
m = 0
for so in s_one:
  c = sis.count(so)
  if c > m:
    m = c
    s_max = []
    s_max.append(so)
  elif c == m:
    s_max.append(so)
s_max2 = sorted(s_max)
for sm in s_max2:
  print(sm)


### FIXED CODE ###

from collections import Counter
n = int(input())
s = []
for i in range(n):
  si = input()
  s.append(si)
  
C = Counter(s)
s_num = C.values()
m = max(s_num)
s_max = []
for k, v in C.items():
  if v == m:
    s_max.append(k)
s_max = sorted(s_max)
for sj in s_max:
  print(sj)
### BUGGY CODE ###

import copy
N, K = map(int, input().split())
a = list(map(int, input().split()))
b = copy.deepcopy(a)
for i in range(K-1, N, 1):
  for j in range(1, K):
    b[i] *= a[i-j]
  if i >= K and b[i] > b[i-1]:
    print("Yes")
  if i >= K and b[i] <= b[i-1]:
    print("No")

### FIXED CODE ###

N, K = map(int, input().split())
a = list(map(int, input().split()))

for i in range(K, N):
  if a[i] > a[i-K]:
    print("Yes")
  else:
    print("No")
### BUGGY CODE ###

import math

N = int(input())
A = list(map(int, input().split()))
tt = 0
#ans = list()
ann = 0
memo = dict()

def comb(m, n):
    return math.factorial(m) // (math.factorial(n) * math.factorial(m - n))
def A_count(n):
    if n in memo:
        return memo[n]
    h = A.count(i)
    memo[n] = A.count(i)
    return h

B = set(A)
for i in B:
    f = A_count(i)
    if f>=2:
        tt = tt + comb(f, 2)

for i in range(N):
    f = A_count(A[i])
    if f>=3:
        ann = (tt - comb(f, 2) + comb(f-1, 2))
    elif f==2:
        ann = tt - comb(f, 2)
    else:
        ann = tt
    print(ann)

#for i in ans:
#    print(i)

### FIXED CODE ###

def main():
    import math
    import collections
    N = int(input())
    A = list(map(int, input().split()))
    tt = 0
    #ans = list()
    ann = 0

    def comb(m, n):
        #return math.factorial(m) // (math.factorial(n) * math.factorial(m - n))
        return ((m - 1 + 1) / 1) * (m - 2 + 1) / 2

    '''
    def A_count(n):
        if n in memo:
            return memo[n]
        h = A.count(i)
        memo[n] = A.count(i)
        return h
    '''

    C = collections.Counter(A)
    for i in C.values():
        if i>=2:
            tt = tt + comb(i, 2)

    for i in A:
        f = C[i] #A_count(A[i])
        if f>=3:
            ann = (tt - comb(f, 2) + comb(f-1, 2))
        elif f==2:
            ann = tt - comb(f, 2)
        else:
            ann = tt
        print(int(ann))

    #for i in ans:
    #    print(i)


if __name__ == '__main__':
    main()
### BUGGY CODE ###

import sys

N,W = map(int, sys.stdin.buffer.readline().split())
dp = [0 for _ in range(W+1)]
for _ in range(N):
	w,v = map(int, sys.stdin.buffer.readline().split())
	for i in range(W,0,-1):
		if i-w>=0:
			dp[i] = max(dp[i],dp[i-w]+v)
	
print(dp[W])

### FIXED CODE ###

import sys
input = sys.stdin.readline
def main():
	N,W = map(int, input().split())
	dp = [0 for _ in range(W+1)]
	for _ in range(N):
		w,v = map(int, input().split())
		for i in range(W,0,-1):
			if i>=w:
				a = dp[i]
				b = dp[i-w]+v
				if a>b:
					dp[i] = a
				else:
					dp[i] = b
		
	print(dp[-1])

if __name__ == '__main__':
	main()
### BUGGY CODE ###

N,K=(int(i) for i in input().split())
h = [int(i) for i in input().split()]
c = [0]*N
for i in range(1,N):
    jumpmax = min(i,K)
    c[i] = min([abs(h[i]-h[i-j])+c[i-j] for j in range(1,jumpmax+1)])
print(c[N-1])

### FIXED CODE ###

N,K=(int(i) for i in input().split())
h = [int(i) for i in input().split()]
c = [0]*N
for i in range(1,N):
    jumpmax = min(i,K)
    c[i] = min([abs(h[i]-h[i-j])+c[i-j] for j in range(1,jumpmax+1)])
print(c[N-1])
### BUGGY CODE ###

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

d = {}
s = set([])
def divisor(n):
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            s.add(i)
            s.add(n // i)

for i in range(2):
    divisor(A[i])

for num in A:
    for key in s:
        if num % key == 0:
            if key not in d:
                d[key] = 1
            else:
                d[key] += 1

ans = 1
for key, val in d.items():
    if val >= N - 1:
        ans = max(ans, key)

print(ans)

### FIXED CODE ###

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

def ABC125gcd(x, y):
    if min(x, y) == 0:
        return max(x, y)
    else:
        return ABC125gcd(y, x % y)

L = [0] * N
R = [0] * N

for i in range(1, N):
    L[i] = ABC125gcd(L[i - 1], A[i - 1])
    R[N - 1 - i] = ABC125gcd(R[N - i], A[N - i])

ans = 1
for i in range(N):
    ans = max(ans, ABC125gcd(L[i], R[i]))
print(ans)
### BUGGY CODE ###

#D
n, m = list(map(int, input().split()))
alist = list(map(int, input().split()))
for i in range(m) :
    b, c = list(map(int, input().split()))
    alist += [c] * min(n, b)
alist.sort()
print(sum(alist[-n:]))

### FIXED CODE ###

from operator import itemgetter

n, m = map(int, input().split())
aa = list(map(int, input().split()))
bcbc = [list(map(int, input().split())) for _ in range(m)]
bcbc.extend([[1, a] for a in aa])
bcbc.sort(key=itemgetter(1), reverse=True)

count = 0
s = 0
for b, c in bcbc :
    if count + b >= n :
        b = n - count
    count += b
    s += b*c
    if count == n :
        break
print(s)
### BUGGY CODE ###

r, g, b, n = map(int, input().split())
ans = 0

for i in range(int(n/b)+1):
    for j in range(int(n/g)+1):
        for k in range(int(n/r)+1):
            cheak = r*k + g*j + b*i
            if cheak == n:
                ans += 1
            elif cheak > n:
                break
print(ans)

### FIXED CODE ###

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

r, g, b, n = map(int, read().split())
cnt = 0
for i in range(n + 1):
    for j in range(n + 1):
        check = n - (r * i + g * j)
        if check >= 0:
            if check % b == 0:
                cnt += 1
        else:
            break
print(cnt)
### BUGGY CODE ###

import math
import sys
from collections import Counter
readline = sys.stdin.readline


def main():
    cnt = 0
    n = int(readline().rstrip())
    L = sorted(list(map(int, readline().rstrip().split())))
    for a in range(0, n - 2):
        for b in range(a + 1, n - 1):
            k = L[a] + L[b]
            l = L[b + 1: len(L)]
            l.append(k)
            l.sort()
            cnt += l.index(k)
    print(cnt)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import math
import sys
from collections import Counter
import bisect
readline = sys.stdin.readline


def main():
    cnt = 0
    n = int(readline().rstrip())
    L = sorted(list(map(int, readline().rstrip().split())))
    for a in range(0, n - 2):
        for b in range(a + 1, n - 1):
            k = L[a] + L[b]
            index = bisect.bisect_left(L, k)
            cnt += index - b - 1
    print(cnt)


if __name__ == '__main__':
    main()