peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
n = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
ans = A[0] + sum(2 * a for a in A[1:n//2])
if n % 2 == 1:
  ans += A[n//2]
print(ans)
# Judge status: Wrong Answer
N,M= map(int,input().split())
s=[]
c=[]
ans=-1
for i in range(M):
    s_i,c_i=input().split()
    s.append(int(s_i))
    c.append(c_i)
for i in reversed(range(int("1"+"0"*(N-1)),int("9"*N)+1)):
    ans_bool=True
    for j in range(M):
        ans_bool=ans_bool and str(i)[s[j]-1]==str(c[j])
    if ans_bool:
        ans=i
        
print(ans)
# Judge status: Wrong Answer
s = str(input()).lower()
s.translate(str.maketrans({'a': 'x', 'b': 'x', 'c': 'x', 'd': 'x', 'e': 'x', 'f': 'x', 'g': 'x', 'h': 'x', 'i': 'x', 'j': 'x', 'k': 'x', 'l': 'x', 'm': 'x', 'n': 'x', 'o': 'x', 'p': 'x', 'q': 'x', 'r': 'x', 's': 'x', 't': 'x', 'u': 'x', 'v': 'x', 'w': 'x', 'y': 'x', 'z': 'x'}))
print(s)
# Judge status: Wrong Answer
N=int(input())
A=list(map(int,input().split()))
a=0
b=0
for num in A:
    if num%2==1:
        a+=1
    elif num%4==0:
        b+=1

if N==3:
    if a==3 or (a>=1 and b==0):
        print('No')
    else:
        print('Yes')
else:
    if a<b:
        print('Yes')
    else:
        print('No')
# Judge status: Accepted
import collections
n = int(input())
li = [input() for _ in range(n)] #n行に１つずつ入力されるmojiretu
ans = 'Yes'
lw = li[0][0]
for s in li:
    if lw != s[0]:
        ans = 'No'
        break
    else:
        lw = s[-1]

c = collections.Counter(li)
if c.most_common()[0][1] != 1:
    ans = 'No'
print(ans)
# Judge status: Wrong Answer
N=input()
i=0
while i<=len(N):
  print("x" ,end='')
  i+=1
# Judge status: Accepted
# coding: utf-8
# Your code here!
N,K = map(int, input().split())
p=list(map(int, input().split()))

P=sorted(p)
print(sum(P[:K]))
# Judge status: Accepted
n = int(input())
v = list(map(int,input().split()))
v.sort()

vlast = (v[0]+v[1]) / 2
for i in range(2, n):
    vlast = (vlast + v[i])/2
print(vlast)
# Judge status: Accepted
M = 10**9+7
def comb(n, r):
    x = 1
    y = 1
    for i in range(r):
        x *= n - i
        x %= M
        y *= (i + 1)
        y %= M 
    return x * pow(y, M-2, M) % M

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

print((pow(2, n, M) - comb(n, a) - comb(n, b) - 1 ) % M)
# Judge status: Accepted
N = int(input())
li = [int(zz) for zz in input().split()]

count = 1
ans = 0
ind = 0
while ind < N:
    if li[ind] == count:
        count += 1
        ans += 1
    ind += 1

if ans != 0:
    print(N-ans)
else:
    print(-1)
# Judge status: Accepted
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
As = list(mapint())
from collections import Counter
c = Counter(As)

ans = 0
for num, c in c.most_common():
    if c>num:
        ans += c-num
    elif c<num:
        ans += c

print(ans)
# Judge status: Wrong Answer
n,a,b=map(int,input().split())
p=10**9+7
sub=((n*(n+1))/2)%p
sub=(sub*(n-1)/3)%p
sub1=(a*(a-1)/2)%p
sub2=(b*(b-1)/2)%p
print(int((sub-sub1-sub2)%p))
# Judge status: Accepted
s = list(input())
a = ""
ans = 0
for c in s:
    if c in ("A", "C", "G", "T"):
        a += c
    else:
        ans = max(ans, len(a))
        a = ""
print(max(ans, len(a)))
# Judge status: Accepted
s,t = map(str, input().split())
a,b = map(int, input().split())
u = input()

if s == u:
  a -= 1
else:
  b -= 1

print(a,b)
# Judge status: Accepted
# 127 A

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

if a >= 13:
    print(b)
elif a >= 6:
    print(int(b/2))
else:
    print(0)
# Judge status: Wrong Answer
a = input()
a = [int(i)for i in a.split(" ")]
print((a[0] == 5 or a[0] == 7) and (a[1] == 5 or a[1] == 7) and (sum(a) == 17))
# Judge status: Accepted
# coding: utf-8
 
 
def main():
 
    in_ninzu = int(input())
    
    # '/'で割ると小数点付きの表示になるので’//’で商を求めると整数になる
    in_candy = in_ninzu * (in_ninzu + 1) // 2
    
    print(in_candy)
  
    return 0
 
 
if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
N=int(input())
A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())
min=min(A, B, C, D, E)
print(-(-N//min))
# Judge status: Wrong Answer
a,b,c,k = map(int, input().split())
over = 10**18
if a == b == c:
    print(0)
    exit()
for i in range(k):
    x = b+c
    y = a+c
    z = a+b
    a = x
    b = y
    c = z
    if abs(a) > over or abs(b) > over  or abs(c) > over:
        print("unfair")
        exit()
print(a-b)
# Judge status: Accepted
n=int(input())
A=list(map(int,input().split()))
B=[0,0,0,0,0,0,0,0]
red=int(0)
for i in range(n):
    now=int(A[i]/400)
    if now<8:
        B[now]=1
    else:
        red+=1

ans=B.count(1)
if ans==0:
    ans=1
    red-=1
print("{} {}".format(ans,ans+red))
# Judge status: Accepted
x, y, z = map(int, input().split())

ans = 0
x -= z
ans += x // (y + z)
print(ans)
# Judge status: Accepted
X =input()
X=int(X)
point =0
while X>=5:
    if X>=500:
        X-=500
        point+=1000
    elif 5<=X<500:
        X-=5
        point+=5

print(point)
# Judge status: Accepted
x = int(input())
if x <= 6:
    print(1)
elif x <= 11:
    print(2)
else:
    ans = x//11
    a = x%11
    if a == 0:
        print(ans*2)
    elif a <= 6:
        print(ans*2+1)
    else:
        print(ans*2+2)
# Judge status: Wrong Answer
import sys
a1=sys.stdin.readline()
a2=list(a1)
a3 = [i for i in a1]
b=[ord(x) for x in a3]
b.sort()
if b[0]==b[1] and b[2]==b[3] and b[0]!=b[3]:
    print("Yes")
else:
    print('No')
# Judge status: Wrong Answer
from itertools import combinations

n, x, y = map(int, input().split())

cnt = [0] * n
for i, j in combinations(range(n), 2):
    dist = min(abs(j - i), abs(i - x) + abs(j - y) + 1,
               abs(i - y) + abs(j - x) + 1)
    cnt[dist] += 1

for i in range(1, n):
    print(cnt[i])
# Judge status: Accepted
from collections import Counter

def main():
    S = input()
    T = input()

    s = Counter(S)
    t = Counter(T)

    a = sorted(list(s.values()))
    b = sorted(list(t.values()))

    print("Yes" if a == b else "No")


if __name__ == "__main__":
    main()
# Judge status: Accepted
a = int(input())
x,y = map(int,input().split())
flag = True
for i in range(x, y+1):
    if i % a == 0:
        flag = True
        break;
    else:
        flag = False
if flag:
    print('OK')
else:
    print('NG')
# Judge status: Wrong Answer
n=[int(input()) for _ in range(5)]
try:
  m=10-min([i%10 for i in n if i%10!=0])
  n=[i if i%10==0 else i+(10-i%10) for i in n]
  print(sum(n)-m)
except:
  print(0)
# Judge status: Wrong Answer
# coding: utf-8
# Your code here!

k,n = map(int,input().split())
num_list = list(map(int, input().split()))
min_num = num_list[0]+num_list[-1]

for i in range(0,int(len(num_list)/2)):
    res = num_list[-1]-k
    #print(num_list)
    num_list.pop(-1)
    #print(num_list)
    num_list.insert(0, res)
    #print(num_list)
    sum_num = abs(num_list[0])+abs(num_list[-1])
    #print("sum_num")
    #print(sum_num)
    
    if sum_num < min_num:
        min_num = sum_num

print(min_num)
# Judge status: Accepted
from math import floor
n = int(input())
s = ""
if n == 0:
    print(0)
    exit()
while n:
    s += str(n%2)
    n = n//2
    n *= (-1)
    # print(n)
    # if n == -1:
    #     break
print(s[::-1])
# Judge status: Accepted
N , M = map(int,input().split())
if N % 2 != 0:
    start = 1
    end = N
    for i in range(M):
        print(start,end)
        start += 1
        end -= 1
else:
    start = 1
    end = N
    judge = True
    for i in range(M):
        print(start,end)
        start += 1
        end -= 1
        if (end - start) <= N // 2 and judge:
            start += 1
            judge = False
# Judge status: Wrong Answer
a=input()
b=input().split()
sum=0
for i in range(len(b)-1) :
  sum+=min(int(b[i]),int(b[i+1]))
sum+=int(b[-1])

print(sum)
# Judge status: Accepted
n = int(input())
A = list(map(int,input().split()))
import fractions
ans = A[0]

for i in range(1,n):
    ans = fractions.gcd(ans,A[i])
print(ans)
# Judge status: Accepted
def readints():
    return list(map(int, input().split()))


n = int(input())
p = readints()
# print(sorted(p))
q = sorted(p)

sum = 0
for i in range(n):
    if p[i] != q[i]:
        sum += 1
print("YES" if sum <= 2 else "NO")
# Judge status: Wrong Answer
N, K = map(int, input().split())
A = list(map(int, input().split()))

a_min = min(A)

pos = 0
ans = 0

for pos in range(N):
    if A[pos] != a_min:
        for i in range(pos, min(pos+K-1, N)):
            A[i] = a_min
        ans += 1

print(ans)
# Judge status: Accepted
N = int(input())
a = 1/2*N*(N+1)
print(int(a))
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
b=a

s=0
for i in range(n-1):
  if b[i]>a[i+1]:
    s+=(a[i]-a[i+1])
    b[i+1]=b[i]
print(s)
# Judge status: Accepted
x = input()
y = int(x)
if y < 100:
    print(0)
else:
    ans = 0
    c = int(x[:len(x)-2])
    for i in range(1,c+1):
        if 100*i <= y and y <= 105*i:
            ans = 1
            break
    print(ans)
# Judge status: Wrong Answer
n, m, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))

x.sort()
y.sort()

for z in range(x[n-1], y[0]):
    if X < z and z <= Y:
        print("No War")
        exit()
print("War")
# Judge status: Accepted
a = int(input())

print(a + (a*a) + (a*a*a))
# Judge status: Wrong Answer
from sys import stdin
from sys import setrecursionlimit
setrecursionlimit(10 ** 7)

a,b = map(int,stdin.readline().rstrip().split())

if b <= a:
    print("unsafe")
else:
    print("safe")
# Judge status: Accepted
x,y = map(int,input().split())
count = 1
while True:
    if x * 2 <= y:
        count+=1
        x*=2
    else:
        break
print(count)
# Judge status: Accepted
#!/usr/bin/env python3

N = int(input())
A = list(map(int, input().split()))
Q = int(input())
BC = [map(int, input().split()) for i in range(Q)]

D = {}
for i in range(1, 10**5+1):
    D[i] = 0

for a in A:
    D[a] += 1

ret = sum(A)

for b, c in BC:
    sa = c - b
    #minus = b * D[b]
    #cnt = D[b]
    plus = sa * D[b]
    D[c] += D[b]
    D[b] = 0
    ret += plus
    print(ret)
# Judge status: Wrong Answer
n = int(input())
a = [int(input())-1 for _ in range(n)]
c = a[0]
cnt = 2
while 1:
    c = a[c]
    if c == 1:
        print(cnt)
        break
    elif c == 0:
        print(-1)
        break
    else:
        cnt += 1
# Judge status: Wrong Answer
h = int(input())
w = int(input())
n = int(input())
if(h >= w):
    print(n // h)
else:
    print(n // w)
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))


def is_approve(a:list):
  ans = False
  for num in a:
    if num % 2 == 1 :
      ans = True
    elif num % 3 == 0 or num % 5 == 0:
      ans = True
    else:
      ans = False
      break
  return ans

if is_approve(a):
  print('APPROVED')
else:
  print('DENIED')
# Judge status: Wrong Answer
from collections import Counter
n = int(input())
s = [str(sorted(input())) for i in range(n)]
print(s)
c = Counter(s)
print(c)
l = sum((v*(v-1)/2) for v in c.values())
print(l)
# Judge status: Wrong Answer
n, m = map(int, input().split())
lr = []

for i in range(m):
    lr.append(list(map(int, input().split())))

lmax = 0
mmin = 10**5

for i in range(m):
    lmax = max(lmax, lr[i][0])
    mmin = min(mmin, lr[i][1])

print(mmin - lmax + 1)
# Judge status: Wrong Answer
from string import ascii_lowercase
N = int(input())
def base(n):
    l = []
    p = int(n / 26)
    q = n % 26 - 1
    if p != 0:
        l = [*l, *base(p)]
    return [*l, ascii_lowercase[q]]
print(''.join(base(N)))
# Judge status: Accepted
s = input()
print( s.rfind('Z') - s.find('A')+1)
# Judge status: Wrong Answer
n = int(input())
ai = [int(i) for i in input().split()]

li = [0]*(10**6+1)

for i in range(1,n):
    if ai[i] >= 2*10**5:
        continue
    li[ai[i]-i+5*10**5] += 1

ans = 0
exit()

for i in range(1,n):
    #print(i)
    ans += li[-ai[i-1]-(i-1)+5*10**5]
    if i == n:
        #print(i,i,i)
        break
    if ai[i] < 2*10**5:
        li[ai[i]-i+5*10**5] -= 1
        
print(ans)
# Judge status: Wrong Answer
import sys
x = int(input())
if x%2 == 0:
    print(-1)
    sys.exit()
y = 7
i = 1
while y%x != 0:
    if i == 100:
        print(-1)
        sys.exit
    i = i + 1
    y = y*10 + 7
print(i)
# Judge status: Accepted
import numpy as np
n,m = list(map(int, input().split()))
x = list(map(int, input().split()))
x.sort()
x = np.array(x)
diff = x[1:]-x[:-1]
low = np.argsort(diff)[::-1][n-1:]
print(sum(diff[low]))
# Judge status: Accepted
import itertools
L,R = map(int,input().split())
if 2019 <= (R - L) + 1:
  print(0)
  exit()
  
lst = list(range(L,R+1))
md = [x * y % 2019 for x,y in itertools.combinations(lst,2)]
md.sort()
print(md[0])
# Judge status: Accepted
A, B, C = map(int, input().split())
print(max(C - (A - B), 0))
# Judge status: Wrong Answer
n = int(input())
d = []
z = 0

for i in range(n):
  d1, d2 = map(int, input().split())
  z = z+1 if d1==d2 else 0
  d.append(z)

print(max(d))
# Judge status: Wrong Answer
N = int(input())
P = list(map(int, input().split()))

ans = 0
min_v = N
for i in range(0, N):
    if P[i] > min_v:
        continue
    for j in range(0, i+1):
        if P[i] > P[j]:
            break

        if i == j:
            ans += 1
            min_v = i

print (ans)
# Judge status: Accepted
n = int(input())
w = list(map(int, input().split()))
difference = []
for i in range(n):
    s1 = w[0:i+1]
    s2 = w[i+1:n]
    s = abs(sum(s1)-sum(s2))
    difference.append(s)
print(min(difference))
# Judge status: Accepted
n, *AB = map(int, open(0).read().split())
c = 0
for a, b in zip(AB[::2][::-1], AB[1::2][::-1]):
    a += c
    t = a % b
    if t != 0:
        t = b - t
    c += t
print(c)
# Judge status: Wrong Answer
import numpy as np
N = int(input())
A = np.array([list(map(int, input().split())) for _ in range(2)])

U = A[0][1:]
D = A[1][:-1]
i = -1
for i in range(N - 1):
    sum_U = U[i:].sum()
    sum_D = D[i:].sum()
    if sum_U < sum_D:
        break
ans = A[0][0] + A[1][N - 1] + U[:i].sum() + D[i:].sum()
print(ans)
# Judge status: Accepted
s=input()
n=len(s)
print(max([n-i for i in range(2,n,2)if s[:(n-i)//2]==s[(n-i)//2:-i]]))
# Judge status: Wrong Answer
N=int(input())
A=list(map(int,input().split()))

cnt = 0
flag = 0

for i in range(N-1):
  #print(A[i+1]-A[i])
  if A[i+1]-A[i] >= 0:
    if flag == 1:
      cnt +=0
    elif flag == -1:
      cnt +=1
      flag = 0
    elif flag ==0:
      flag = 1
  elif A[i+1]-A[i] <= 0:
    if flag == 1:
      cnt +=1
      flag =0
    elif flag ==-1:
      cnt +=1
    elif flag ==0:
      flag = -1
      
    
print(cnt+1)
# Judge status: Wrong Answer
def divisor(x):
  ret=[]
  for i in range(1,x+1):
    if x%i==0:
      ret.append(i)
  return len(ret)

ans=0
n=int(input())
for i in range(1,n+1):
  if divisor(i)==8:
    ans+=1
print(ans)
# Judge status: Wrong Answer
que=[1,2,3,4,5,6,7,8,9]
k=int(input())
for i in range(k-1):
  q=que.pop(0)
  #print("q",q)
  m=q%10
  #print("m",m,"que",que)
  if m==0:
    que.append(m*10)
    que.append(m*10+1)
  elif m==9:
    que.append(m*10+8)
    que.append(m*10+9)
  else:
    que.append(m*10+m-1)
    que.append(m*10+m)
    que.append(m*10+m+1)
print(que[0])
# Judge status: Accepted
n=int(input())
cnt=[10000]*26
for i in range(n):
    tmp=[0]*26
    S=input()
    for j in range(len(S)):
        tmp[ord(S[j])-97]+=1
    for j in range(26):
        cnt[j]=min(tmp[j],cnt[j])
li=[]
for i in range(26):
    for j in range(cnt[i]):
        li.append(chr(i+97))
print(''.join(li))
# Judge status: Accepted
import sys
N = int(input())
array = list(map(int,input().split()))

result = sum(array)
for I in range(len(array)):
    tmp = abs(sum(array[0:I]) - sum(array[I:]))
    if result > tmp: result = tmp
print(result)
# Judge status: Accepted
from math import ceil
S=int(input())

if S<=10**9:
  d=0
  c=S
else:
  d=ceil (S/(10**9))
  c=10**9*d-S

print(0,0,10**9,1,c,d)
# Judge status: Accepted
A, B, C = map(int, input().split())
K = int(input())

k = 0
while True:
    if A < B:
        break
    else:
        B *= 2
        k += 1

while True:
    if B < C:
        break
    else:
        C *= 2
        k += 1

if k <= K:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
a, b = map(int, input().split())

x = a + a-1
y = b + b-1
z = a + b 
print(max(x,y,z))
# Judge status: Accepted
print('{:.10f}'.format((float(input())/3)**3))
# Judge status: Accepted
a,b,c=map(int,input().split())
d,e,f=map(int,input().split())
g,h,i=map(int,input().split())
if a+e==b+d:
  if b+f==c+e:
    if d+h==e+g:
      if e+i==f+h:
        print('Yes')
        exit()
print('No')
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline


def main():
    X = int(input().rstrip())
    f = 0
    for a in range(73):
        for b in range(64):
            i = a ** 5 - (-b) ** 5
            if i == X:
                print(a, -b)
                f = 1
                break

        if f:
            break


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
c=[]
for i in range(3):
    c.append(list(map(int,input().split())))
for i in range(2):
    if c[i+1][0]-c[i][0]==c[i+1][1]-c[i][1] and c[i+1][1]-c[i][1]==c[i+1][2]-c[i][2]:
        flg=0
    else:
        flg=1
if flg==0:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N = int(input())
tuplea = tuple(map(int, input().split()))
ans = 0
for n in range(N):
    if tuplea[n]%2 == 1:
        pass
    else:
        if tuplea[n]%3 == 0 or tuplea[n]%5 == 0:
            pass
        else:
            ans = 1
if ans == 0:
    print('APPROVED')   
else:
    print('DENIED')
# Judge status: Wrong Answer
n = int(input())
xy = []
for i in range(n):
  arrat = [int(i) for i in input().split()]
  xy.append(arrat)

ans = 0
for i in range(n):
  for j in range(i+1,n):
    ans += ((xy[i][0]-xy[j][0])**2+(xy[i][1]-xy[j][1])**2)**0.5
    
ans /= (n*(n-1)//2)
print(ans*2)
# Judge status: Wrong Answer
# B - 1 21
a,b = map(int,input().split())
x = a*len(str(b))+b
ans = 'No'
for y in range(1000):
    if x==y*y:
        ans = 'Yes'
        break
print(ans)
# Judge status: Accepted
n,a,b =map(int,input().split())
def f(x):
    sum = 0
    for i in str(x):
        sum += int(i)
    return sum
data = []
for i in range(1,n+1):
    if a <= f(i) <= b:
        data.append(i)
print(sum(data))
# Judge status: Accepted
a = list(map(int,list(input())))[::-1]
a.append(0)
ans = 0
for i in range(len(a)):
  if a[i] >= 6 or (a[i] == 5 and a[i+1] >= 5):
    a[i] = 10-a[i]
    a[i+1] += 1
print(sum(a))
# Judge status: Accepted
x, y = map(int, input().split())
flag = True
for animal in range(1, x + 1):
    if y == animal * 4 + (x - animal) * 2 or y == animal * 2 + (x - animal) * 4:
        print ("Yes")
        flag = False
        break
if flag:
    print("No")
# Judge status: Accepted
a, b, c, d = map(int, input().split())

while True:
    c -= b
    if c <= 0:
        print('Yes')
        exit()
    a -= d
    if a <= 0:
        print('No')
        exit()
# Judge status: Accepted
N, K = map(int,input().split())
while True:
    if N%K == 0:
        print(0)
        break
    else:
        N=N%K
        N = min(N,abs(N-K))
        print(N)
        break
# Judge status: Accepted
N = int(input())
A = [int(input()) for _ in range(N)]
A.append(0)

ans = 0
for i in range(N):
    ans += A[i]//2
    if A[i]&1 and A[i+1]:
        A[i+1] -= 1
        ans += 1

print(ans)
# Judge status: Accepted
import sys
from collections import defaultdict

def solve():
    input = sys.stdin.readline
    N = int(input())
    C = defaultdict(int)
    for _ in range(N):
        s = input().strip("\n")
        C[s] += 1
    P = ["AC", "WA", "TLE", "RE"]

    for p in P:
        print(p + " x " + str(C[p]))
    return 0

if __name__ == "__main__":
    solve()
# Judge status: Accepted
N = int(input())
if N % 2 == 0:
    print(N // 2)
else:
    print((N + 1) // 2)
# Judge status: Wrong Answer
x, y = map(int, input().split())
a = y - 2*x
if a > x:
    print("No")
elif a < 0:
    print("No")
elif a % 2 == 0:
    print("Yes")
# Judge status: Accepted
import sys
import math as mt
import collections as cc
I=lambda:list(map(int,input().split()))
n,=I()
x=100
i=0
while x<n:
    i+=1
    temp=x*0.01
    x+=mt.floor(temp)
    
    
print(i)
# Judge status: Wrong Answer
N=int(input())
count=1
size=1
p=list(map(int,input().split()))
q=[p[0]]
for i in range (1,N):
  if p[i]!=p[i-1]:
    q.append(p[i])
    size+=1
j=0
while True:
  if j>=size-2:
    break
  while (q[j]-q[j+1])*(q[j+1]-q[j+2])>=0:
    if j>=size-3:
      break
    j+=1    
  count+=1
  j+=2
print(count)
# Judge status: Accepted
N, M = map(int, input().split())
X = sorted(list(map(int,input().split())))

diff = [0]*(M-1)
for i in range(M-1):
  diff[i] = X[i+1] - X[i]

diff = sorted(diff)
print(sum(diff[0:max(M-N, 0)]))
# Judge status: Accepted

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

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

for i in range(N-K):

    if A[i] < A[i+K]:
        print ("Yes")
    else:
        print ("No")
# Judge status: Accepted
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
BC = [list(map(int, input().split())) for i in range(M)]

# Cについて大きい順にソート
BC.sort(key=lambda x: x[1], reverse=True)

temp = []
for i in range(M):
        # CiをBi個追加
    temp += [BC[i][1]] * BC[i][0]
    if len(temp) > N:
        break

A += temp
A.sort(reverse=True)

print(sum(A[:N]))
# Judge status: Accepted
X = int(input())

count = 1
while True:
  if 100*count <= X <= 105*count:
    print(1)
    exit()
  elif X < 100*count:
    print(0)
    exit()
  count += 1
# Judge status: Accepted
n, y = map(int,input().split())
y = y//1000
for i in range(n+1):
    for j in range (n+1-i):
        k = n - i - j
        if 10*i + 5* j + 1 * k == y:
            print(str(i) +' '+str(j)+' '+str(k))
            exit()
print('-1 -1 -1')
# Judge status: Accepted
a,b=map(int,input().split())
s=list(input())
if s.count('-')==1 and len(s)==a+b+1 and s[a]=='-':
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
import math
X, Y = map(int, input().split())

print(int(math.log2(Y//X))+1)
# Judge status: Accepted
def main():
    N = input()
    t = 0
    l = []
    for i in N:
        t += int(i)
        l.append(t)
    n = len(N)
    for i, v in enumerate(N):
        if int(v) > 0:
            t = max(l[i] - 1 + 9*(n - i - 1), t)
    return t
print(main())
# Judge status: Accepted
n, m = map(int, input().split())
a = []
b = []
for i in range(n):
    a.append(list(input()))

for i in range(m):
    b.append(list(input()))


def ext(x, y):
    global a
    res = [[0 for _ in range(m)] for __ in range(m)]

    for i in range(m):
        for j in range(m):
            res[i][j] = a[i+x][j+y]

    return res


ans = "No"
for i in range(0, n - m + 1):
    for j in range(0, n - m + 1):
        if (ext(i, j) == b):
            ans = "Yes"

print(ans)
# Judge status: Wrong Answer
from math import comb
mod = 10**9 + 7
s = 1729
ans = 0
n = 1
while s - 2*n - 1 >= 0:
    ans += comb(s-2*n-1, n-1)
    ans %= mod
    n += 1
print(ans)
# Judge status: Wrong Answer
n,k=map(int,input().split())
r,s,p = map(int,input().split())
t=input()

def score(c):
	if c=="r":
		return p
	elif c=="s":
		return r
	else:
		return s

ans = 0
for i in range(n):
	if i < k:
		ans+=score(t[i])
	else:
		if t[i] == t[i-k]:
			if i >= 2*k and t[i]==t[i-2*k]:
				ans+=score(t[i])
		else:
			ans+=score(t[i])
print(ans)
# Judge status: Accepted
N, A, B = map(int, input().split())
S = list(input())

answer = 0
b_list = 0
for idx, moji in enumerate(S):
    if moji == "a" and answer < A + B:
        answer += 1
        print("Yes")
        continue
    elif moji == "b":
        b_list += 1
        if answer < A + B and b_list <= B:
            answer += 1
            print("Yes")
            continue
    print("No")
# Judge status: Accepted
# import bisect
# from collections import Counter, deque
# import copy
# from heapq import heappush, heappop, heapify
from fractions import gcd
# import itertools
# from operator import attrgetter, itemgetter
# import math

import sys

# import numpy as np

ipti = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


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

    ans = a[0]

    for i in range(1, n):
        ans = gcd(ans, a[i])

    print(ans)

if __name__ == '__main__':
    main()