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

from collections import Counter

prime = {2: True, 3: True, 5: True, 7: True, 11: True, 13: True, 17: True, 19: True, 23: True, 29: True, 31: True, 37: True, 41: True, 43: True, 47: True, 53: True, 59: True, 61: True, 67: True, 71: True, 73: True, 79: True, 83: True, 89: True, 97: True, 101: True, 103: True, 107: True, 109: True, 113: True, 127: True, 131: True, 137: True, 139: True, 149: True, 151: True, 157: True, 163: True, 167: True, 173: True, 179: True, 181: True, 191: True, 193: True, 197: True, 199: True, 211: True, 223: True, 227: True, 229: True, 233: True, 239: True, 241: True, 251: True, 257: True, 263: True, 269: True, 271: True, 277: True, 281: True, 283: True, 293: True, 307: True, 311: True, 313: True, 317: True, 331: True, 337: True, 347: True, 349: True, 353: True, 359: True, 367: True, 373: True, 379: True, 383: True, 389: True, 397: True, 401: True, 409: True, 419: True, 421: True, 431: True, 433: True, 439: True, 443: True, 449: True, 457: True, 461: True, 463: True, 467: True, 479: True,
         487: True, 491: True, 499: True, 503: True, 509: True, 521: True, 523: True, 541: True, 547: True, 557: True, 563: True, 569: True, 571: True, 577: True, 587: True, 593: True, 599: True, 601: True, 607: True, 613: True, 617: True, 619: True, 631: True, 641: True, 643: True, 647: True, 653: True, 659: True, 661: True, 673: True, 677: True, 683: True, 691: True, 701: True, 709: True, 719: True, 727: True, 733: True, 739: True, 743: True, 751: True, 757: True, 761: True, 769: True, 773: True, 787: True, 797: True, 809: True, 811: True, 821: True, 823: True, 827: True, 829: True, 839: True, 853: True, 857: True, 859: True, 863: True, 877: True, 881: True, 883: True, 887: True, 907: True, 911: True, 919: True, 929: True, 937: True, 941: True, 947: True, 953: True, 967: True, 971: True, 977: True, 983: True, 991: True, 997: True, 1009: True, 1013: True, 1019: True, 1021: True, 1031: True, 1033: True, 1039: True, 1049: True, 1051: True, 1061: True, 1063: True, 1069: True}


def make_divisors(n):

    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            if i != n and i in c:
                return False

            tmp = n // i
            if i != tmp:
                if tmp != n and tmp in c:
                    return False
    return True


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

c = Counter(A)

# 1がある時
if 1 in c:
    if c[1] >= 2:
        print(0)
    else:
        print(1)
    exit(0)

ans = 0
for a in A:
    # 同じ数が複数ある
    if c[a] >= 2:
        continue

    # 素数の時
    if a in prime:
        ans += 1
        continue

    # 小さい数の倍数であるか
    for i in [2, 3, 5, 7, 11, 13]:
        if i in c:
            if a % i == 0:
                break
    else:
        # 約数を取得
        if make_divisors(a):
            ans += 1

print(ans)


### FIXED CODE ###

from collections import Counter

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

c = Counter(A)
p = [True]*(10**6+1)

for k, v in c.items():
    t = k*2
    while t <= 10**6:
        p[t] = False
        t += k

ans = 0
for a in A:
    if c[a] == 1 and p[a]:
        ans += 1
print(ans)
### BUGGY CODE ###

import numpy as np

n = int(input())
A, B = np.zeros(n), np.zeros(n)
for i in range(n):
    a, b = map(int, input().split())
    A[i] = a
    B[i] = b

ans = 0
A = A[::-1]
B = B[::-1]

for i in range(n):
    if A[i] % B[i] == 0:
        pass
    else:
        temp = B[i]*((A[i]//B[i])+1) - A[i]
        ans += temp
        A += temp
print(int(ans))

### FIXED CODE ###

n = int(input())
A, B = [], []
for _ in range(n):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
ans = 0
for i in range(n-1, -1, -1):
    if (A[i]+ans) % B[i] == 0:
        continue
    else:
        ans += B[i] - (A[i]+ans) % B[i]
print(ans)
### BUGGY CODE ###

N, K = map(int, input().split())
p = list(map(int, input().split()))
result = [sum(p[i:i+K]) for i in range(N-K+1)]
print((max(result)+K)/2)


### FIXED CODE ###

N, K = map(int, input().split())
p = list(map(int, input().split()))
a = [0] * (N+1)
for i in range(N):
    a[i+1] = a[i] + p[i]
result = [a[i+K] - a[i] for i in range(N-K+1)]
print((max(result)+K)/2)
### BUGGY CODE ###

def main():
    import sys
    def input(): return sys.stdin.readline().rstrip()
    n = int(input())
    A = list(map(int, input().split()))
    q = int(input())
    import numpy as np
    A = np.array(A)
    ans = sum(A)
    for i in range(q):
        b,c = map(int, input().split())
        A[A==b] = c
        print(sum(A))

if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    import sys
    def input(): return sys.stdin.readline().rstrip()
    n = int(input())
    A = list(map(int, input().split()))
    q = int(input())
    import numpy as np
    A.sort()
    ans = sum(A)
    from bisect import bisect_left,bisect_right
    from collections import Counter
    count = Counter(A)
    for i in range(q):
        b,c = map(int, input().split())
        k = count[b]
        if k != 0:
            count[c] += count.pop(b)
        ans += (c-b)* k
        print(ans)


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

N=int(input())
A = list(map(int,input().split()))
B = []
for i in range(1,N+1):
    count = 0
    for j in A:
        if i == j:
            count += 1
    print(count)






### FIXED CODE ###

num = int(input())
table = list(map(int, input().split()))
table2 = []
for i in range(num):
    table2.append(0)
 
for j in range(len(table)):
    table2[table[j]-1] += 1
 
for k in table2:
    print(k)
### BUGGY CODE ###

import sys
input=sys.stdin.readline
N,M=map(int,input().split())
from collections import defaultdict
OUT=defaultdict(set)
IN=defaultdict(set)
start={i for i in range(N)}
for i in range(N+M-1):
    a,b=map(int,input().split())
    start-={b-1}
    OUT[a-1]|={(i,b-1)}
    IN[b-1]|={i}
P=[0]*N
while len(start)>0:
    now=start.pop()
    for b,nex in OUT[now]:
        if len(IN[nex])==1:
            start|={nex}
            P[nex]=now+1
        IN[nex]-={b}
    OUT[now]=set()
for p in P:
    print(p)

### FIXED CODE ###

import sys
input=sys.stdin.readline
N,M=map(int,input().split())
from collections import defaultdict
OUT=defaultdict(set)
IN=defaultdict(int)
for i in range(N+M-1):
    a,b=map(int,input().split())
    OUT[a-1]|={b-1}
    IN[b-1]+=1
P=[0]*N
start={i for i in range(N) if IN[i]==0}
while len(start)>0:
    now=start.pop()
    for nex in OUT[now]:
        IN[nex]-=1
        if IN[nex]==0:
            start|={nex}
            P[nex]=now+1
[print(p) for p in P]
### BUGGY CODE ###

n, k  = map(int, input().split())
H = list(map(int, input().split()))

memo = [10**9 for _ in range(n)]
memo[0] = 0
for i in range(1, n):
  for j in range(1, k+1):
    if i - j >= 0:
      memo[i] = min(memo[i], memo[i-j] + abs(H[i] - H[i-j]))
print(memo[-1])

### FIXED CODE ###

n, k = map(int, input().split())
H = list(map(int, input().split()))

DP = [10 ** 9] * n
DP[0] = 0

for i in range(1, n):
    j = 1
    while i - j >= 0 and j <= k:
        DP[i] = min(DP[i], DP[i-j] + abs(H[i] - H[i-j]))
        j += 1
print(DP[-1])
### BUGGY CODE ###

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

dp=[float("inf")]*N
dp[0]=0
for i in range(1,N):
  for k in range(1,K+1):
    if i-k<0: break
    dp[i]=min(dp[i],dp[i-k]+abs(h[i]-h[i-k]))

print(dp[N-1])

### FIXED CODE ###

import numpy as np
#https://yottagin.com/?p=1650

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

#dp=[float("inf")]*N
#dp[0]=0
#dp=[0]
dp=np.zeros(N,dtype=int)
h=np.array(h)

for i in range(1,N):
  start=max(0,i-K)
  #start~i-1
  dp[i]=min(dp[start:i]+np.abs(h[i]-h[start:i]))
  #tmp=float("inf")
  #for k in range(1,K+1):
    #if i-k<0: break
    #dp[i]=min(dp[i],dp[i-k]+abs(h[i]-h[i-k]))
    #tmp=min(tmp,dp[i-k]+abs(h[i]-h[i-k]))
  #dp[i]=tmp
  #dp+=[tmp]

print(dp[N-1])
### BUGGY CODE ###

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

L = sorted(L)
ans = 0
for i in range(N-2):
#    k = i + 2
    for j in range(i+1, N-1):
        for k in range(j+1,N):
#        if L[i]+L[j] <= L[k]: break
#        if L[i]+L[k] <= L[j]: break
#        if L[j]+L[k] <= L[i]: break
            if L[i]+L[j] <= L[k]: break
#            if L[i]+L[k] <= L[j]: break
#            if L[j]+L[k] <= L[i]: break


            ans += 1
#        k += 1

print(ans)


### FIXED CODE ###

#!/usr/bin/env python3
import bisect
N = int(input())
L = sorted(list(map(int, input().split())))
ans = 0
for i in range(len(L)):
    for j in range(i+1, len(L)):
        b_i = bisect.bisect_left(L, L[i]+L[j]) # a+bより小さい数
        ans += b_i - (j+1)
print(ans)
### BUGGY CODE ###

n = int(input())
i = 1
while i <= n:
 if i % 3 == 0:
  print(' {}'.format(i))
  continue
 elif i % 10 == 3:
  print(' {}'.format(i))
  continue

### FIXED CODE ###

n = int(input())
i = 1
for i in range(1, n + 1):
 if i % 3 == 0:
  print(' {0}'.format(i), end = '')
 else:
  st = str(i)
  for x in range(0, len(st)):
   if st[x] == '3':
    print(' {0}'.format(i), end = '')
    break
print()
### BUGGY CODE ###

def binary_search(*, ok, ng, func):
    while abs(ok - ng) > 1:
        mid = (ok + ng) // 2
        if func(mid):
            ok = mid
        else:
            ng = mid
    return ok


def main():
    from bisect import bisect_left, bisect_right

    INF = 10 ** 18 + 1

    def count(x):
        # a*b<=x
        # a>=0
        #   b<=x//a
        # a<0
        #   (-a)*b>=(-x)
        #   (-a)*b<(-x)
        #   (-a)*b<=(-x-1)
        #   b<=(-x-1)//(-a)

        cnt = 0
        for i in range(n):
            # A[i] < 0
            key = (-x - 1) // (-A[i])
            cnt += N - bisect_right(A, key)
            if A[i] * A[i] <= x:
                cnt -= 1

        if x >= 0:
            cnt += (z - n) * (N - 1)

        for i in range(z, N):
            # A[i] > 0
            key = x // A[i]
            cnt += bisect_right(A, key)
            if A[i] * A[i] <= x:
                cnt -= 1

        return cnt // 2

    N, K = map(int, input().split())
    *A, = sorted(map(int, input().split()))

    n = bisect_left(a=A, x=0)  # [0,n)=>負
    z = bisect_left(a=A, x=1)  # [n,z)=>0

    ans = binary_search(ok=INF, ng=-INF, func=lambda x: count(x) >= K)

    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

# https://maspypy.com/atcoder-%E5%8F%82%E5%8A%A0%E6%84%9F%E6%83%B3-2019-02-16abc-155#toc3
# https://atcoder.jp/contests/abc155/submissions/10152895
# 写経


# 条件を満たす要素を抽出
# ndarray[条件式]

def binary_search(*, ok, ng, func):
    while abs(ok - ng) > 1:
        mid = (ok + ng) // 2
        if func(mid):
            ok = mid
        else:
            ng = mid
    return ok


def main():
    import sys
    import numpy as np

    inf = 10 ** 18 + 1
    input = sys.stdin.readline

    N, K = map(int, input().split())
    A = np.array(input().split(), dtype=np.int64)

    A.sort()

    zero = A[A == 0]
    pos = A[A > 0]
    neg = A[A < 0]

    def count(x):
        """
        定数cに対して Ai*Aj<=c となる(i,j)の数え上げ
        順序制約 i<j -> 順序制約のない(i,j)からi==jの場合の個数を引いて2で割る
        iを固定して a=Ai とする
        a=0
            ax=0(<=c?),解なしまたは任意のx
        a>0
            ax<=c
            <-> x<=c/a
            <-> x<=c//a
        a<0
            ax<=c
            <-> (-a)x>=(-c)

            否定をとり,aの対候補全体=Nから引く

            (-a)x<(-c)
            <-> (-a)x<=(-c-1)
            <-> x<=(-c-1)//(-a)
        """
        cnt = 0
        if x >= 0:
            cnt += zero.size * N  # (a:=0)*v<=x
        cnt += np.searchsorted(a=A, v=x // pos, side='right').sum()  # (a:>0)*v<=x
        cnt += (N - np.searchsorted(a=A, v=(-x - 1) // (-neg), side='right')).sum()  # (a:<0)*v<=x
        cnt -= ((A * A) <= x).sum()  # i==j
        assert cnt % 2 == 0
        return cnt // 2

    ans = binary_search(
        ng=-inf,
        ok=inf,
        func=lambda x: count(x) >= K
    )

    print(ans)


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

N,K,Q = [int(i) for i in input().split(' ')]
pointList = [K for _ in range(N)]

for _ in range(Q):
    answer = int(input())
    i = 0
    for point in pointList:
        if answer-1 != i:
            pointList[i] = point-1
        i += 1
for point in pointList:
    if point <= 0:
        print('No')
    else:
        print('Yes')

### FIXED CODE ###

N,K,Q = [int(i) for i in input().split(' ')]
pointList = [K-Q for _ in range(N)]

for _ in range(Q):
    answer = int(input())
    pointList[answer-1] += 1
    
for point in pointList:
    if point <= 0:
        print('No')
    else:
        print('Yes')
### BUGGY CODE ###

import sys
readline = sys.stdin.readline

N, M, K = map(int, readline().split())
P = 998244353
def mod_prod(a,b):
    return a * b % P

def mod_fact(a):
    ret = 1
    for i in range(a):
        ret = ret * (i + 1) % P
    return ret

def mod_pow(a, n):
    ret = 1
    while n > 0:
        if n % 2 == 1:
            ret = ret * a % P
        a = a * a % P
        n = n // 2
    return ret

def mod_div(a, b):
    b_inv = mod_pow(b, P - 2)
    return a * b_inv % P

def mod_comb(a,b):
    ret = 1
    b = min(b, a - b)
    for i in range(b):
        ret *= a - i
        ret %= P
    ret = mod_div(ret, mod_fact(b))
    return ret

ans = 0
_n = N - 1
for k in range(K + 1):
    a = N - k
    # N-1 Comb k
    if k == 0:
        comb = 1
    elif k == 1:
        comb = _n
    else:
        comb = comb * mod_div((_n - k + 1), k) % P
    b = M * mod_pow(M-1, a-1) % P
    b = b * comb % P
    ans += b
    ans %= P


print(ans)

### FIXED CODE ###

import sys
readline = sys.stdin.readline

N, M, K = map(int, readline().split())
P = 998244353
def mod_prod(a,b):
    return a * b % P

def mod_fact(a):
    ret = 1
    for i in range(a):
        ret = ret * (i + 1) % P
    return ret

def mod_pow(a, n):
    ret = 1
    while n > 0:
        if n % 2 == 1:
            ret = ret * a % P
        a = a * a % P
        n = n // 2
    return ret

def mod_div(a, b):
    b_inv = mod_pow(b, P - 2)
    return a * b_inv % P

def mod_comb(a,b):
    ret = 1
    b = min(b, a - b)
    for i in range(b):
        ret *= a - i
        ret %= P
    ret = mod_div(ret, mod_fact(b))
    return ret

ans = 0
_n = N - 1
for k in range(K + 1):
    a = N - k
    # N-1 Comb k
    if k == 0:
        comb = 1
    elif k == 1:
        comb = _n
    else:
        comb = comb * mod_div((_n - k + 1), k) % P
    b = M * mod_pow(M-1, a-1) % P
    b = b * comb % P
    ans += b
    ans %= P


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

import copy
n,m = map(int,input().split())
h = [int(x) for x in input().split()]
p = []
for i in range(m):
    p.append([int(x) for x in input().split()])
h2 = copy.copy(h)
p2 = copy.copy(p)
g = []
for i in range(len(h)):
    j = i + 1
    c = False
    for pt in p2:
        if not (j in pt):
            continue
        gp = copy.copy(pt)
        lh = h[gp.pop(pt.index(j)) - 1]
        rh = h[gp.pop() - 1]
        if lh <= rh:
            c = True
            break
    if not c:
        g.append(j)
print(len(g))

### FIXED CODE ###

import copy
n,m = map(int,input().split())
ht = [x for x in input().split()]
hl = {x + 1 : int(ht[x]) for x in range(len(ht))}
mx = {h:0 for h in hl}
for i in range(m):
    l,r = map(int,input().split())
    mx[l] = max(mx[l],hl[r])
    mx[r] = max(mx[r],hl[l])
cnt = 0
for h in hl:
    if mx[h] < hl[h]:
        cnt += 1
print(cnt)
### BUGGY CODE ###

import sys
from io import StringIO
import unittest


def input():
    return sys.stdin.readline().rstrip()


def resolve():
    N = int(input())
    S = input()

    R = S[0]
    for i in range(1, N):
        if S[i] != R[-1]:
            R += S[i]
    print(len(R))


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """10
aabbbbaaca"""
        output = """5"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """5
aaaaa"""
        output = """1"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """20
xxzaffeeeeddfkkkkllq"""
        output = """10"""
        self.assertIO(input, output)


if __name__ == "__main__":
    resolve()


### FIXED CODE ###

import sys
from io import StringIO
import unittest


def input():
    return sys.stdin.readline().rstrip()


def resolve():
    N = int(input())
    S = input()

    R = S[0]
    for i in range(1, N):
        if S[i] != R[-1]:
            R += S[i]
    print(len(R))


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """10
aabbbbaaca"""
        output = """5"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """5
aaaaa"""
        output = """1"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """20
xxzaffeeeeddfkkkkllq"""
        output = """10"""
        self.assertIO(input, output)


if __name__ == "__main__":
    resolve()
### BUGGY CODE ###

S = input()
count = [0] * 2019
N = len(S)
mod = 0

for i in range(N):
    mod = int(S[-i:]) % 2019
    count[mod] += 1

answer = count.pop(0)

for k in range(2018):
    if count[k] > 1:
        answer = answer + count[k]*(count[k] - 1)/2

print(int(answer))

### FIXED CODE ###

S = list(map(int, list(input())))

pops = 0
digi = 1
cnt = [0] * 2019
cnt[0] = 1

while S:
    s = S.pop()

    pops = (pops + s * digi) % 2019
    digi = (10 * digi) % 2019

    cnt[pops] += 1

ans = 0

for i in range(2019):
    ans += cnt[i] * (cnt[i] - 1) // 2

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

import copy

N=int(input())

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

ans=copy.copy(li)

for n in range(N):
  x=li[n]
  ans.pop(x-1)
  ans.insert(x-1,n+1)

print(*ans)

### FIXED CODE ###

import copy

N=int(input())

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

ans=copy.copy(li)

ans=sorted(range(N), key=lambda k: li[k])

for n in range(N):
  ans[n]+=1
      
print(*ans)
### BUGGY CODE ###

n = int(input())
p = list(map(int, input().split()))
m =[0] * n
m[0] = p[0]
for i in range(1, n):
  q = sorted(p[:i+1])
  m[i] = q[0]
ans = 0
for i in range(n):
  if p[i] == m[i]:
    ans += 1
print(ans)

### FIXED CODE ###

n = int(input())
p = list(map(int, input().split()))
m =[0] * n
m[0] = p[0]
mi = m[0]
for i in range(1, n):
    mi = min(mi, p[i])
    m[i] = mi
ans = 0
for i in range(n):
  if p[i] == m[i]:
    ans += 1
print(ans)
### BUGGY CODE ###

S = list(input())
Q = int(input())

for _ in range(Q):
    q = input().split()
    if q[0] == '1':
        S.reverse()
    elif q[1] == '1':
        S.insert(0, q[2])
    else:
        S.append(q[2])

print(''.join(S))


### FIXED CODE ###

def string():
    s = input()
    q = int(input())
    l = ''
    r = ''
    re = False
    for _ in range(q):
        t = input().split()
        if t[0] == '1':
            re = not re
        else:
            if re:
                if t[1] == '1':
                    r = r + t[2]
                else:
                    l = t[2] + l
            else:
                if t[1] == '1':
                    l = t[2] + l
                else:
                    r = r + t[2]
    s = l + s + r
    if re:
        s = s[::-1]
    print(s)
string()
### BUGGY CODE ###

# coding: utf-8
# Your code here!

n, m = map(int,input().split())
joblist = []
for i in range(n):
    a,b = map(int,input().split())
    joblist.append([a,b])
joblist.sort(key=lambda x :x[0])
kouho = []

ans =0

for i in range(1,m+1):
    count=0
    if joblist:
        for j,job in enumerate(joblist):
            if job[0]==i:
                
                kouho.append(job[1])
                
                
            if job[0]!=i:
                if count:
                    for _ in range(count-1):
                        joblist.pop(0)
        if kouho:
            kouho.sort(reverse=True)
            ans += kouho.pop(0)

print(ans)
    

### FIXED CODE ###

import heapq

n, m = map(int,input().split())
joblist = {}
for i in range(n):
    a,b = map(int,input().split())
    if a in joblist:
        joblist[a].append(-1*b)
    else:
        joblist[a] = [-1*b]

kouho = []
 
ans =0
 
for i in range(1,m+1):
    if i in joblist:
        for j in joblist[i]:
            heapq.heappush(kouho,j)
    if kouho:
        ans += heapq.heappop(kouho)
 
print(-1*ans)
### BUGGY CODE ###

def main():
    n = int(input())
    h = [i for i in map(int, input().split())]

    ans = 0
    flag = False
    for i in range(n, 2, -1):
        for j in range(n+1-i):
            if sorted(h[j:j+i], reverse=True) == h[j:j+i]:
                ans = i-1
                flag = True
                break
        if flag is True:
            break

    print(ans)


if __name__ == "__main__":
    main()


### FIXED CODE ###

def main():
    N = int(input())
    H = list(map(int, input().split()))

    if N == 1:
        print(0)
        quit()

    start = 0
    moves = []
    for i in range(N-1):
        if H[i] >= H[i+1]:
            continue
        moves.append(i - start)
        start = i + 1

    if H[N-2] >= H[N-1]:
        moves.append(i - start + 1)
    print(max(moves))


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

def main():
    n = int(input())
    a_list = [int(i) for i in input().split()]

    b_list = list()
    for i in range(n):
        b_list.append(a_list[i])
        b_list.reverse()

    print(' '.join([str(i) for i in b_list]))


if __name__ == "__main__":
    main()

### FIXED CODE ###

def main():
    n = int(input())
    a_list = [int(i) for i in input().split()]

    b_list = [-1 for i in range(512345)]
    left = 212345
    right = left+1
    for i in range(n):
        if (i+1)%2 == n%2:
            b_list[left] = a_list[i]
            left -= 1
        else:
            b_list[right] = a_list[i]
            right += 1

    print(' '.join([str(i) for i in b_list[left+1:right]]))

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

from functools import reduce
MOD = 10**9+7
n = int(input())
A = list(map(int, input().split()))


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


def lcm(a, b):
    return (a*b)//gcd(a, b)


x = reduce(lcm, A)

ans = 0
for a in A:
    ans += x//a
    ans %= MOD
print(ans)


### FIXED CODE ###

from collections import defaultdict
MOD = 10**9+7
n = int(input())
A = list(map(int, input().split()))


def factorization(n):
    retval = []
    tmp = n
    for i in range(2, int(-(-n**.5//1))+1):
        if tmp % i == 0:
            cnt = 0
            while tmp % i == 0:
                cnt += 1
                tmp //= i
            retval.append((i, cnt))
    if tmp != 1:
        retval.append((tmp, 1))
    return retval


x = defaultdict(int)
for a in A:
    for p, q in factorization(a):
        if x[p] < q:
            x[p] = q

mod_x = 1
for p, q in x.items():
    mod_x *= pow(p, q, MOD)
mod_x %= MOD

B = [mod_x*pow(a, MOD-2, MOD) % MOD for a in A]
print(sum(B) % MOD)