Harryxun/stf_run huggingface dataset:
import math
import collections

N = int(input())
S = input()


def bit_add(A,a,w): #リストAのa番目にwを足す
    ind = a

    while len(A) > ind:
        A[ind] += w
        lsb = ind & (-ind)
        # print(ind)
        ind += lsb

    return

def bit_sum(A, a):  # リストAのa番目までの和を取る
    s = 0
    ind = a
    while ind != 0:
        s += A[ind]
        lsb = ind & (-ind)
        ind -= lsb

    return s
# cs = set(list(S))
li = {}
for c in "abcdefghijklmnopqrstuvwxyz":
    li[c] = [0] * (N + 1)

for i in range(1,N + 1):
    char = S[i - 1]
    bit_add(li[char],i,1)

# li → 1 スタート
# S → 0スタート
Q = int(input())
queries = [input().split() for _ in range(Q)]
for query in queries:
    a,b,c = query
    a = int(a)
    b = int(b)
    if a == 1: # 書き換え
        i = b

        c_org = S[i - 1] # 元の文字
        # li[c_org][i] -= 1
        S[i - 1] = c
        bit_add(li[c_org], i,  -1)#元の文字をbiマイナス
        bit_add(li[c], i, 1) #新たな文字をbiプラス

    if a == 2:
        ans = 0
        l = b
        r = int(c)
        for c in "abcdefghijklmnopqrstuvwxyz":
            temp = li[c]
            r_sum = bit_sum(temp,r)
            l_sum = bit_sum(temp,l - 1)
            diff = r_sum-l_sum
            if diff > 0: # ある文字
                ans += 1
        print(ans)




### FIXED CODE ###

import math
import collections

N = int(input())
S = input()

S = list(S)
def bit_add(A,a,w): #リストAのa番目にwを足す
    ind = a

    while len(A) > ind:
        A[ind] += w
        lsb = ind & (-ind)
        # print(ind)
        ind += lsb

    return

def bit_sum(A, a):  # リストAのa番目までの和を取る
    s = 0
    ind = a
    while ind != 0:
        s += A[ind]
        lsb = ind & (-ind)
        ind -= lsb

    return s
# cs = set(list(S))
li = {}
for c in "abcdefghijklmnopqrstuvwxyz":
    li[c] = [0] * (N + 1)

for i in range(1,N + 1):
    char = S[i - 1]
    bit_add(li[char],i,1)

# li → 1 スタート
# S → 0スタート
Q = int(input())
queries = [input().split() for _ in range(Q)]
for query in queries:
    a,b,c = query
    a = int(a)
    b = int(b)
    if a == 1: # 書き換え
        i = b

        c_org = S[i - 1] # 元の文字
        # li[c_org][i] -= 1
        S[i - 1] = c
        bit_add(li[c_org], i,  -1)#元の文字をbiマイナス
        bit_add(li[c], i, 1) #新たな文字をbiプラス

    if a == 2:
        ans = 0
        l = b
        r = int(c)
        for c in "abcdefghijklmnopqrstuvwxyz":
            temp = li[c]
            r_sum = bit_sum(temp,r)
            l_sum = bit_sum(temp,l - 1)
            diff = r_sum-l_sum
            if diff > 0: # ある文字
                ans += 1
        print(ans)
from sys import stdin

def main():
    readline = stdin.readline
    n = int(readline())
    s = tuple(readline().strip() for _ in range(n))

    plus, minus = [], []
    for c in s:
        if 2 * c.count('(') - len(c) > 0:
            plus.append(c)
        else:
            minus.append(c)

    plus.sort(key = lambda x: x.count(')'))
    minus.sort(key = lambda x: x.count('('), reverse = True)
    plus.extend(minus)
    sum = 0
    for v in plus:
        for vv in v:
            sum = sum + (1 if vv == '(' else -1)
            if sum < 0 : return print('No')
    if sum != 0:
        return print('No')

    return print('Yes')

if __name__ == '__main__':
    main()


### FIXED CODE ###

s = input()
t = input()

def main():
    if len(s) < 1 and len(s) > 10:
        print('No')
        return

    if (s.isalpha() == False or s.islower() == False):
        print('No')
        return

    if (t[-1].isalpha() == False or t[-1].islower() == False):
        print('No')
        return

    if len(t) == len(s) + 1 and t[:-1] == s:
        print('Yes')
    else:
        print('No')
    return

main()
nokori = a - b
ans = c - nokori
if ans < 0:
    ans = 0
print(ans)


### FIXED CODE ###

a, b, c = list(map(int, input().split()))

nokori = a - b
ans = c - nokori
if ans < 0:
    ans = 0
print(ans)
n,m = map(int,input().split())
a = list(int(input())for i in range(M))
mod = 10**9+7
b = [0] * (n-1)
b[0] = 1
b[1] = 1
for i in a:
    b[i] = -1

for i in range(2,n+1):
    if b[i] == -1:
        continue
    if b[i-1] != -1:
        b[i] += b[i-1]
    if b[i-2] != -1:
        b[i] += b[i-2]

print(b[-1]%mod)

### FIXED CODE ###

n,m=map(int,input().split())
a=[int(input()) for i in range(m)]
mod=10**9+7
b=[0]*(n+1)
b[0]=1
b[1]=1

for i in a:
    b[i]=-1

for i in range(2,n+1):
    if b[i]==-1:
        continue
    if b[i-1]!=-1:
        b[i]+=b[i-1]
    if b[i-2]!=-1:
        b[i]+=b[i-2]
        
print(b[-1]%mod)
hoge = input()

N = int(hoge[0])
K = int(hoge[2])
Q = int(hoge[4])

A = [0] * Q

for i in range(Q):
	A[i] = int(input())

point = [K] * N

for i in range(Q):
	point = [point[i] - 1 for j in range(N)]
	point[A[i]] = point[A[i]] + 1

for i in range(N):
	if point[i] > 0:
		print("Yes")
	else:
		print("No")

### FIXED CODE ###

I = input()
I = I.split(" ")
N = int(I[0])
K = int(I[1])
Q = int(I[2])

A = [0] * Q

for i in range(Q):
	A[i] = int(input())

point = [0] * N

for i in range(Q):
	point[A[i]-1] = point[A[i]-1] + 1

for i in range(N):
	if Q - point[i] < K:
		print("Yes")
	else:
		print("No")
import math

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

max_k = math.gcd(A_arr[0], A_arr[1])
if N > 2:
    for i in range(2, N):
        max_k = math.gcd(max_k, A_arr[i])
else:
    pass

print(max_k)

### FIXED CODE ###

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

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

max_k = gcd(A_arr[0], A_arr[1])
if N > 2:
    for i in range(2, N):
        max_k = gcd(max_k, A_arr[i])
else:
    pass

print(max_k)
def solve():
  N = int(input())
  k = 1
  while N>pow(26,k):
    N -= pow(26,k)
    k += 1
  ans = ''
  N -= 1
  for i in range(k,1,-1):
    ans += chr(ord('a')+N//pow(26,i-1))
    N%=pow(26,i-1)
  ans += chr(ord('a')+N%pow(26,i))
  return ans
print(solve())

### FIXED CODE ###

N = int(input())
lis = [0,26]
num = 26
n = 1
while lis[-1]<N:
    num *= 26
    lis.append(lis[-1]+num)
    n += 1
c = N-lis[-2]-1
ans = ''
for i in range(n):
    ans = chr(c%26+ord('a')) + ans
    c //= 26
print(ans)
n = int(input())
lis = input().split()
count = 0
for i in range(n):
  if lis[i] == 'Y':
    print('Four')
    break
  else:
    if(count == n-1)
    print('Three')
    count++


### FIXED CODE ###

n = int(input())
lis = input().split()
for i in range(n):
  if lis[i] == 'Y':
    print('Four')
    break
  else:
    if i == n-1:
    	print('Three')
# N個のスペース区切りの数値を取得
N = int(input())
A = [int(N) for N in input().split()]


# 奇数番目と偶数番目に出てくる数字の頻度順にそれぞれソートして、
odd = []
even = []

for i in range(N):
    if i%2 == 0:
        odd.append(A[i])
    else:
        even.append(A[i])

import collections
c_odd = collections.Counter(odd)
c_even = collections.Counter(even)
#print(c_odd.most_common()[0][0], c_even.most_common()[0][0])



# 最頻な数字が一致してない場合はそれぞれの最頻値以外の合計値、
if c_odd.most_common()[0][0] != c_even.most_common()[0][0] :
    print(len(set(odd))-1 + len(set(even))-1)
    exit()


# 一致してる場合は片方が最頻を諦めた場合の合計値を両パターン求めて小さい方
if c_odd.most_common()[0][0] == c_even.most_common()[0][0] :
    # 最頻を諦める ＝ 2番めに頻出な数値を採用
    temp_odd_retire = N//2 - c_odd.most_common()[1][1] #個数
    temp_even_retire = N//2 - c_even.most_common()[1][1] #個数
    #print('temps are ', temp_odd_retire, temp_even_retire)

    # oddを諦めたほうが良い場合
    if temp_odd_retire < temp_even_retire:
        print(temp_odd_retire + N//2 - c_even.most_common()[0][1])
    # even()
    else:
        print(temp_even_retire + N//2 - c_odd.most_common()[0][1])
    exit()

print('unexpected!')



### FIXED CODE ###

# N個のスペース区切りの数値を取得
N = int(input())
A = [int(N) for N in input().split()]


# 奇数番目と偶数番目に出てくる数字の頻度順にそれぞれソートして、
odd = []
even = []

for i in range(N):
    if i%2 == 0:
        odd.append(A[i])
    else:
        even.append(A[i])

import collections
c_odd = collections.Counter(odd)
c_even = collections.Counter(even)
#print(c_odd.most_common()[0][0], c_even.most_common()[0][0])



# 最頻な数字が一致してない場合はそれぞれの最頻値以外の合計値、
if c_odd.most_common()[0][0] != c_even.most_common()[0][0] :
    #print(len(set(odd))-1 + len(set(even))-1)
    print(N - c_odd.most_common()[0][1] - c_even.most_common()[0][1])
    exit()


# 一致してる場合は片方が最頻を諦めた場合の合計値を両パターン求めて小さい方
if c_odd.most_common()[0][0] == c_even.most_common()[0][0] :

    # 偶数と奇数の数列が完全一致のパターンでないかチェック
    if len(c_odd.most_common()) == 1 and len(c_even.most_common()) == 1:
        print(N//2)

    # oddが1種類しかない場合
    elif len(c_odd.most_common()) == 1:
        print(N//2 - c_even.most_common()[1][1])
    # evenが1種類しかない場合
    elif len(c_even.most_common()) == 1:
        print(N//2 - c_odd.most_common()[1][1])
    #両方が2種類以上で構成されている場合
    else:
        ans = N - max(c_odd.most_common()[0][1]+c_even.most_common()[1][1], c_odd.most_common()[1][1]+c_even.most_common()[0][1] )
        print(ans)

'''
        # 最頻を諦める ＝ 2番めに頻出な数値を採用
        temp_odd_retire = N//2 - c_odd.most_common()[1][1] #個数
        temp_even_retire = N//2 - c_even.most_common()[1][1] #個数
        #print('temps are ', temp_odd_retire, temp_even_retire)

        # oddを諦めたほうが良い場合
        if temp_odd_retire < temp_even_retire:
            print(temp_odd_retire + N//2 - c_even.most_common()[0][1])
        # even()
        else:
            print(temp_even_retire + N//2 - c_odd.most_common()[0][1])
        exit()
'''
import os
import statistics

def quickSort(arr):
  left = []
  right = []
  if len(arr) <= 1:
   return arr
  median = int(statistics.median(arr))
  medianFlg = 0
  for element in arr:
   if element < median:
    left.append(element)
   elif element > median:
    right.append(element)
   else:
    medianFlg += 1
  left = quickSort(left)
  right = quickSort(right)
  return left + [median] * medianFlg + right

def binary_search1(list,target):
 result = -1
 left = 0
 right = len(list) - 1
 while left <= right:
  center = (left + right)//2
  if list[center] >= target:
   if list[center-1] < target:
    result = center
    break
   else: right = center - 1
  elif list[center] < target:
   if center==N-1:
    result = N
    break
   else:
    left = center + 1
 if result == -1:
  return 0
 else:
  return str(result)

def binary_search2(list,target):
 result = -1
 left = 0
 right = len(list) - 1
 while left <= right:
  center = (left + right)//2
  if list[center] <= target:
   if list[center+1] > target:
    result = N-center-1
    break
   else:  left = center + 1
  elif list[center] > target:
   if center==0:
    result = N-center
    break
   else:
    right =center - 1
 if result == -1:
  return 0
 else:
  return str(result)

N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
A=quickSort(A)
C=quickSort(C)
K=0
for i in range(N):
 L=int(binary_search1(A,B[i]))
 M=int(binary_search2(C,B[i]))
 K+=L*M
print(K)


### FIXED CODE ###

import bisect
N=int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
A.sort()
C.sort()
d=0
for i in B:
 d+=bisect.bisect_right(A,i-0.1)*(N-bisect.bisect_left(C,i+0.1))
print(d)
n = int(input())
l = list(range(1,n+1))
sum = (n*(n-1))//2
print(sum)

### FIXED CODE ###

n = int(input())
sum = (n*(n-1))//2
print(sum)
a,b=int(input().split())

print(max(a+b,a-b,a*b))

### FIXED CODE ###

a,b=input().split()
a=int(a)
b=int(b)

print(max(a+b,a-b,a*b))
n = int(input())
A = list(map(int,input().split()))
m = int(input())
B = list(map(int,input().split()))

def solve(x,y):
    if y<0:    return False
    elif y==0:  return True
    elif x==n:  return False
    elif solve(x+1,y-A[x]):  return True
    else: return solve(x+1,y)
    
for i in range(m):
    if solve(0,B[i]): print("yes") 
    else: print("no")



### FIXED CODE ###

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

T = [[0]*2001 for i in range(n)]

T[0][0] = 1
T[0][A[0]] = 1
for i in range(1,n):
    for j in range(2001):
        T[i][j] = T[i-1][j]
        if (j - A[i] >=0) and (T[i-1][j-A[i]] == 1):
            T[i][j] = 1
    
for i in range(m):
    if T[n-1][B[i]] == 1: print("yes")
    else: print("no")
n = int(input())
a = list(map(int, input().split()))
b = set(a)
d = [0,0,0]
index = 0
if len(b) != 3 and n % 3 != 0:
    print("No")
    exit()
for i in list(b):
    for j in a:
        if i == j:
            d[index] += 1
    index += 1
if d[0] == d[1] and d[1] == d[2]:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
temp = a[0] ^ a[1]
for i in range(2,n):
    temp = temp ^ a[i]
if temp == 0:
    print("Yes")
else:
    print("No")
h,w,k=map(int,input().split())
mod=10**9+7
fib=[1,1]
for i in range(6):
  fib.append(fib[-2]+fib[-1])
print(fib)
dp=[[0]*w for i in range(h+1)]
dp[0][0]=1
for i in range(h):
  for j in range(w):
    if j==0:
      dp[i+1][j]=(dp[i][j]*fib[j]*fib[w-j-1]+dp[i][j+1]*fib[j]*fib[w-j-2])%(mod)
    elif j==w-1:
      dp[i+1][j]=(dp[i][j-1]*fib[j-1]*fib[w-j-1]+dp[i][j]*fib[j]*fib[w-j-1])%(mod)
    else:
      dp[i+1][j]=(dp[i][j-1]*fib[j-1]*fib[w-j-1]+dp[i][j]*fib[j]*fib[w-j-1]+dp[i][j+1]*fib[j]*fib[w-j-2])%(mod)
print(dp[h][k-1])

### FIXED CODE ###

h,w,k=map(int,input().split())
mod=10**9+7
fib=[1,1]
for i in range(6):
  fib.append(fib[-2]+fib[-1])
dp=[[0]*w for i in range(h+1)]
dp[0][0]=1
for i in range(h):
  for j in range(w):
    if w==1:
      dp[i+1][j]=dp[i][j]
    elif j==0:
      dp[i+1][j]=(dp[i][j]*fib[j]*fib[w-j-1]+dp[i][j+1]*fib[j]*fib[w-j-2])%(mod)
    elif j==w-1:
      dp[i+1][j]=(dp[i][j-1]*fib[j-1]*fib[w-j-1]+dp[i][j]*fib[j]*fib[w-j-1])%(mod)
    else:
      dp[i+1][j]=(dp[i][j-1]*fib[j-1]*fib[w-j-1]+dp[i][j]*fib[j]*fib[w-j-1]+dp[i][j+1]*fib[j]*fib[w-j-2])%(mod)
print(dp[h][k-1])
from functools import reduce
import math

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

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

    print(algorithm(N, A))


def algorithm(N, A):
    gcdList = [0] * N
    for i in range(N):
        copy_A = A.copy()
        copy_A.pop(i)
        gcdList[i] = gcd_list(copy_A)

    return max(gcdList)




problem()


### FIXED CODE ###

from functools import reduce
import fractions


def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

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

    print(algorithm(N, A))


def algorithm(N, A):
    if N == 0:
        return 0
    if N == 1:
        return A[0]
    if N == 2:
        return max(A[0],A[1])

    L_i = 0
    R_i = [0] * N
    R_i[N - 1] = A[N - 1]
    R_i[N-2] = fractions.gcd(A[N-1], A[N-2])
    
    for i in range(3,N):
        R_i[N - i] = fractions.gcd(R_i[N - i + 1], A[N - i])

    maxGCD = R_i[1]
    for i in range(1, N-1):
        L_i = fractions.gcd(L_i, A[i - 1])
        tmp = fractions.gcd(L_i, R_i[i+1])
        if tmp > maxGCD:
            maxGCD = tmp

    L_i = gcd_list(A[:N-1])
    if L_i > maxGCD:
        maxGCD = L_i
    return maxGCD

problem()
N=input()
R=input()
Naibu = int(R) + 100*(10-int(N))
if int(N)<=9:
    print(Naibu)
else:
    print(R)

### FIXED CODE ###

N=input().split()

Naibu = int(N[1]) + 100*(10-int(N[0]))
if int(N[0])<=9:
    print(Naibu)
else:
    print(N[1])
N,M=map(int,input().split())
S=list(input())
T=list(input())

def gcd(x,y):
  if x==0:
    return y
  else:
    return gcd(y%x,x)

k=N*M//gcd(N,M)
X=[0]*k
for i,s in enumerate(S):
  X[i*k//N]=s
  
for i,t in enumerate(T):
  if X[i*k//M]==t or X[i*k//M]==0:
    pass
  else:
    print(-1)
    exit()
    
print(k)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10000)
N,M=map(int,input().split())
S=list(input())
T=list(input())

def gcd(x,y):
  if x==0:
    return y
  else:
    return gcd(y%x,x)

k=N*M//gcd(N,M)
X=[0]*N
for i,s in enumerate(S):
  X[i]=s
  
for i,t in enumerate(T):
  if (i*k//M)%(k//N)!=0:
    pass
  elif (i*k//M)%(k//N)==0 and X[(i*k//M)//(k//N)]==t:
    pass
  else:
    print(-1)
    exit()
    
print(k)
from collections import defaultdict
from numba import njit, b1, i4, i8, f8

@njit(cache = True)
def get_prime_factors(x):
    return [2, 3]

@njit
def main():
    df = {"2":0, "3":0}
    
    
    for ai in a:
        primes = get_prime_factors(ai)
        for prime in primes:
            df[prime] += 1
    if df.values():
        val = max(df.values())
        if val == 1:
            print("pairwise coprime")
        elif val == n:
            print("not coprime")
        else:
            print("setwise coprime")
    else:
        print("pairwise coprime")

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


### FIXED CODE ###

from collections import defaultdict


def get_prime_factors(x):
    out = set()
    if x < 1:
        return out
    while not x%2:
        out.add(2)
        x //= 2
    i = 3
    while i*i <= x:
        if not x%i:
            out.add(i)
            x //= i
        else:
            i += 2
    if x != 1:
        out.add(x)
    return out


def main():
    n = int(input())
    a = list(map(int, input().split()))
    df = defaultdict(lambda : 0)
    for ai in a:
        primes = get_prime_factors(ai)
        for prime in primes:
            df[prime] += 1
    if df.values():
        val = max(df.values())
        if val == 1:
            print("pairwise coprime")
        elif val == n:
            print("not coprime")
        else:
            print("setwise coprime")
    else:
        print("pairwise coprime")

if __name__ == "__main__":
    main()
A＝int(input())
B=int(input())
C=6-A-B
print(C)

### FIXED CODE ###

A=int(input())
B=int(input())
C=6-A-B
print(C)
N = list(i for i in input())
L = len(N)

if L == 1:
  answer = int(N)
else:
  if N[0] == '9' and len(set(N)) == 1:
    answer = 9*L
  else:
    if N[0] != '9' and '9' in N and len(set(N)) == 2:
      answer = 9*(L-1) + int(N[0])
    else:
      answer = 9*(L-1) + int(N[0]) - 1

print(answer)

### FIXED CODE ###

N = list(i for i in input())
L = len(N)

if L == 1:
  answer = int(N[0])
else:
  if N[0] == '9' and len(set(N)) == 1:
    answer = 9*L
  else:
    if N[0] != '9' and '9' in N and len(set(N)) == 2:
      answer = 9*(L-1) + int(N[0])
    else:
      answer = 9*(L-1) + int(N[0]) - 1

print(answer)
from collections import Counter
from math import log2

def find(x):
    return 2**(int(log2(x))+1)-x

n = int(input())
a = list(map(int,input().split()))
a.sort(reverse = True)
c = Counter(a)
ans = 0

for i in range(n):
    f = find(a[i])
    if f == a[i]:
        if c[f] > 1:
            c[f] -= 2
            ans += 1
    elif c[f] > 0:
        c[f] -= 1
        c[a[i]] -= 1
        ans += 1
print(ans)

### FIXED CODE ###

from collections import Counter
from math import log2

def find(x):
    f = 2**(int(log2(x))+1)-x
    if f <= x:
        return f
    return 0

n = int(input())
a = list(map(int,input().split()))
a.sort(reverse = True)
c = Counter(a)
ans = 0

for i in range(n):
    f = find(a[i])
    if f == a[i]:
        m = c[a[i]]//2
    else:
        m = min(c[a[i]],c[f])
    c[a[i]] -= m
    c[f] -= m
    ans += m
print(ans)
s=str(input())
def isPalin(l,r):
  if l >= r:
    return True
  if s[l]!=s[r]:
    return False:
  return isPalin(l+1,r-1)
n = len(s)
if isPalin(0,n-1) and isPalin(0,n//2-1) and isPalin(n//2+1,n-1):
  print('Yes')
else:
  print('No')

### FIXED CODE ###

s=str(input())
def isPalin(l,r):
  if l >= r:
    return True
  if s[l]!=s[r]:
    return False
  return isPalin(l+1,r-1)
n = len(s)
if isPalin(0,n-1) and isPalin(0,n//2-1) and isPalin(n//2+1,n-1):
  print('Yes')
else:
  print('No')
def main ():
    N = int(input())
    A = list(map(int,input(). split ()))
    if 0 in A:
        print(0)
        return
    prod = 1
    for a in A:
        prod *= a
        if prod > 1000000000000000000:
        print(-1):
            return
    print(prod)
main ()


### FIXED CODE ###

def main ():
    N = int(input())
    A = list(map(int,input(). split ()))
    if 0 in A:
        print(0)
        return
    prod = 1
    for a in A:
        prod *= a
        if prod > 1000000000000000000:
            print(-1)
            return
    print(prod)
main ()
print(1 - int(input())

### FIXED CODE ###

print(1 - (int(input())))
from fractions import gcd
N = int(input())
array = list(map(int,input().split()))
gcd_arr = [array[0]]

for i in range(N-1):
  gcd_arr.append(gcd(gcd_arr[-1],array[i+1]))

gcd_arr.reverse()

for i in range(N):
  if gcd_arr[i+1] > gcd_arr[i]:
    break
    
array.pop(N-i-1)

new_gcd = array[0]
for i in range(N-2):
  new_gcd = gcd(new_gcd,array[i+1])

print(new_gcd)


### FIXED CODE ###

from fractions import gcd
N = int(input())
array = list(map(int,input().split()))
all_gcd = [0]*N
#calc from start to end
gcd_L = [array[0]]
for i in range(N-1):
  gcd_L.append(gcd(gcd_L[-1],array[i+1]))
  
#calc from end to start
gcd_R = [array[-1]]
for j in range(N-1,0,-1):
  gcd_R.append(gcd(gcd_R[-1],array[j-1]))
  
gcd_arr = []
  
for idx in range(N):
  if idx==0:
    gcd_arr.append(gcd_R[-2])
  elif idx==N-1:
    gcd_arr.append(gcd_L[-2])
  else:
    gcd_arr.append(gcd(gcd_L[idx-1],gcd_R[N-1-idx-1]))
print(max(gcd_arr))
import numpy as np
n = int(input())
*A, = map(int, input().split())
A = np.array(A)
B = np.identity(n)
B += np.roll(B, -1, 0)
print(*map(int, np.linalg.solve(B, 2*A)))

### FIXED CODE ###

n = int(input())
*A, = map(int, input().split())
X = []
p = sum(A[::2])
q = sum(A[1::2])
for a in A:
    X += [p-q]
    p, q = q+a, p-a
print(*X)
import os
from sys import stdin

seq = list(map(int, stdin.readline().split()))
for i in range(len(seq)):
  if seq[i]==0:
    print(i+1)
    return


### FIXED CODE ###

from sys import stdin

seq = list(map(int, stdin.readline().split()))
for i in range(5):
  if seq[i]==0:
    print(i+1)
    break
n = input()
i = n % 10
if(n == 3):
  print("bon")
elif(n == 0 or 1 or 6 or 8):
  print("pon")
else:
  print("hon")

### FIXED CODE ###

n = int(input())
i = n % 10
if(i == 3):
  print("bon")
elif(i == 0 or i == 1 or i == 6 or i == 8):
  print("pon")
else:
  print("hon")
print(A * B)

### FIXED CODE ###

A, B = list(map(int, input().split()))
print(A*B)
a, b  = map(int, input().split())

for i in range(10000):
  if i == a * 0.08 and i ==  b * 0.1:
    print(i)
  else:
    print('-1')
    


### FIXED CODE ###

s = input()
if s == 'AAA' or s == 'BBB':
  print('No')
else:
  print('Yes')
r,g,b,n = map(int,input().split())
lis=[r,g,b]
lis.sort()
cnt=0
for i in range(n//lis[2] + 1):
  for l in range((n-i*lis[2])//lis[1]+1):
    for m in range((n-i*lis[2]-l*lis[1])//lis[0]+1):
      if i*lis[2]+l*lis[1]+m*lis[0] = n:
        cnt+=1
print(cnt)


### FIXED CODE ###

b,r,g,n=map(int,input().split())
ans=0
for i in range(3000//r+1):
    for j in range(3000//g+1):
        if n-j*g-i*r>=0 and (n-j*g-i*r)%b==0:
            ans+=1
print(ans)
a,b,c = map(int,input().split())
n = a-b
print(n%b)

### FIXED CODE ###

a,b,c = [int(input()) for i in range(3)]
n = a-b
print(n%c)