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

N = int(input())
A = list(map(int, input().split()))
tmp = A[0]
for i in range(1, N):
  if i % 2 == 0:
    tmp = tmp + A[i]
  else:
    tmp = tmp - A[i]
X = [tmp]*N
print_str = str(tmp)
for i in range(0, N-1):
  X[i+1] = (A[i] - X[i] // 2) * 2
  print_str = print_str + " " + str(X[i+1])
print(print_str)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
tmp = A[0]

for i in range(1, N):
  if i % 2 == 0:
    tmp = tmp + A[i]
  else:
    tmp = tmp - A[i]
X = [tmp]*N
for i in range(0, N-1):
  X[i+1] = (A[i] - X[i] // 2) * 2
print(" ".join(list(map(str, X))))
### BUGGY CODE ###

R,G,B,N = map(int,input().split())

r = 0
count = 0
r_max = N // R
g_max = N // G

while r <= r_max:
    
    g = 0
    while g <= g_max:
        b = (N-r*R-g*G)/B
        if b.is_integer() and b >= 0:
            count += 1

        g += 1
    
    r += 1

print(count)

### FIXED CODE ###

R,G,B,N = map(int,input().split())

count = 0
for r in range(0,N+1,R):
    for g in range(r,N+1,G):
        b = (N-g)/B
        if b.is_integer() and b >= 0:
            count += 1

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

import math

N=int(input())
A = list(map(int,input().split()))
cnt=[]
B=[]
for i in range(1,N+1):
	cnt.append(A.count(i))
	
for i in range(1,N+1):
	B.append((cnt[i-1]*(cnt[i-1]-1))//2)
	if cnt[i-1]==0:
		B[i-1]=0
ans=0
for i in range(1,N+1):
	ans+=B[i-1]

for i in range(0,N):
	point=A[i]
	deff=(cnt[point-1]*(cnt[point-1]-1))//2-((cnt[point-1]-1)*(cnt[point-1]-2))//2
	print(ans-deff)

### FIXED CODE ###

import math

N=int(input())
A = list(map(int,input().split()))
cnt=[0]*(N+1)
for i in range(0,N):
	cnt[A[i]-1]+=1
ans=0
for i in range(0,N+1):
	if cnt[i]==0:
		ans+=0
	else:
		ans+=cnt[i]*(cnt[i]-1)//2

for i in range(0,N):
	point=A[i]
	deff=(cnt[point-1]*(cnt[point-1]-1))//2-((cnt[point-1]-1)*(cnt[point-1]-2))//2
	print(ans-deff)
### BUGGY CODE ###

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

### FIXED CODE ###

r, g, b, n = map(int, input().split())
ans = 0
for i in range(n + 1):
    for j in range(n + 1):
        if i * r + j * g == n:
            ans += 1
        elif (n - (i * r + j * g)) >= 0 and (n - (i * r + j * g)) % b == 0:
            ans += 1
print(ans)
### BUGGY CODE ###

n = int(input())
s = input()
ans=0
for i in range(n-2):
    a = s[i]
    for j in range(i+1, n-1):
        b = s[j]
        for k in range(j+1, n):
            if 2*j != i+k:
                c = s[k]
                if a!=b and b!=c and c!=a:
                    ans+=1
print(ans)

### FIXED CODE ###

import bisect

n = int(input())
s = input()
r = []
b = []
g = []
for i,c in enumerate(s):
    if c == 'R':
        r.append(i)
    elif c == 'B':
        b.append(i)
    else:
        g.append(i)
g_leng = len(g)
r_leng = len(r)
b_leng = len(b)
ans = g_leng*r_leng*b_leng
subans = 0
for j in b:
    for i in r:
        g_ind = bisect.bisect_left(g, 2*j-i)
        if g_ind != g_leng and g[g_ind] == 2*j-i:
            subans+=1
        g_ind = bisect.bisect_left(g, 2*i-j)
        if g_ind != g_leng and g[g_ind] == 2*i-j:
            subans+=1
        g_ind = bisect.bisect_left(g, (i + j) // 2)
        if g_ind != g_leng and g[g_ind] == (i + j) / 2:
            subans += 1
print(ans-subans)
### BUGGY CODE ###

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

print(ans)


### FIXED CODE ###

n=int(input())
p =list(map(int,input().split()))
ans = 0
x = p[0]
for i in range(n):
    if x >= p[i]:
        ans +=1
        x = p[i]

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

from collections import deque
import numpy as np
n,k = map(int,input().split())
a = list(map(int,input().split()))
roop_find = deque([0])
i = 0
count = 0
for _ in range(n):
    if a[i]-1 in roop_find:
        break
    else:
        roop_find.append(a[i]-1)
        i = a[i] - 1
        count += 1
b = roop_find.index(a[i]-1)

if k < b:
    print(roop_find[k]+1)
else:
    k-=b
    e = k % (count+1-b)
    print(roop_find[b+e]+1)


### FIXED CODE ###

n,k = map(int,input().split())
a = list(map(int,input().split()))
pos = 0
visit = [0] * n
move = []
loop = []
while visit[pos] != 2:
    if visit[pos] == 0:
        move.append(pos)
    else:
        loop.append(pos)
    visit[pos] += 1
    pos = a[pos] - 1
if len(move) > k:
    print(move[k]+1)
else:
    print(loop[(k-(len(move)-len(loop)))%len(loop)]+1)
### BUGGY CODE ###

list_S = list(input())
k = int(input())
set_ANS = set(list_S)

for i in range(len(list_S)-1):
    c = list_S[i]
    for j in range(i+1, len(list_S)):
        c += list_S[j]
        set_ANS.add(c)

list_ANS = list(set_ANS)
list_ANS.sort()

print(list_ANS[k-1])

### FIXED CODE ###

list_S = list(input())
k = int(input())
set_ANS = set()
list_Alph = list(set(list_S))
cnt = 0
list_Alph.sort()

for c in list_Alph:
    q = [i for i, x in enumerate(list_S) if x == c]
    list_M = []
    for i in q:
        l = "".join(list_S[i:])
        list_M.append(l)
    list_M.sort()
    for s in list_M:
        m = list(s)
        for j in range(1,len(m)+1):
            b = "".join(m[:j])
            if b not in set_ANS:
                set_ANS.add(b)
                cnt += 1
                if cnt == k:
                    print(b)
                    exit()
### BUGGY CODE ###

s = input()

mod = 1000000007
length = len(s)
ans = list([0]*13 for i in range(length+1))
ans[0][0] = 1

for i in range(length):
    for j in range(13):
        x = j*10 % 13 - 1
        if s[i] == '?':
            for k in range(10):
                x = (x + 1) % 13
                ans[i+1][x] += ans[i][j]
        else:
            x = (x + int(s[i]) + 1) % 13
            ans[i+1][x] += ans[i][j]

print(ans[length][5] % mod)


### FIXED CODE ###

MOD = 1000000007;

s = [int(x) if x!="?" else -1 for x in input()]

n=len(s)

r=[0]*13

c=s[0]
if (c!=-1):
	r[c]=1
else:
	for i in range(10):r[i]=1

for i in range(1,n):
	dp=[0]*26
	for j in range(13):dp[j*10%13]+=(r[j]%MOD)
	dp[13:26]=dp[0:13]
	c=s[i]
	r=[0]*13
	if (c==-1):
		w=sum(dp[4:14])
		for j in range(13):
				r[j]+=w
				w=w+dp[j+1]-dp[4+j]
	else:
		for j in range(13):
			r[j]+=dp[13-c+j]
print (r[5]%MOD)
### BUGGY CODE ###

S = input()
S_len = len(S)
while True:
    if "01"in S:
        S =S.replace("01","")
    elif "10" in S:
        S =S.replace("10","")
    else:
        break
print(S_len - len(S))

### FIXED CODE ###

S = list(input())
zero_num = S.count("0")
one_num = S.count("1")
print(len(S)-abs(zero_num - one_num))
### BUGGY CODE ###

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

max_sum = 0
for i in range(N-K+1):
    tmp_sum = sum(P[i:i+K])
    if tmp_sum > max_sum:
        max_sum = tmp_sum

max_E = (max_sum + K) / 2
print(max_E)

### FIXED CODE ###

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

# 期待値
E = [(p+1)/2 for p in P]
#print(E)

# 累積和
S = [0] * (N+1)
for i in range(N):
    S[i+1] = S[i] + E[i]
#print(S)

# 隣接K個を取り出して足す
max_E = 0
for i in range(N-K+1):
    tmp_E = S[i+K] - S[i]
    #print(tmp_E)
    if tmp_E > max_E:
        max_E = tmp_E

print(max_E)
### BUGGY CODE ###

n = int(input())
A = list(map(int, input().split()))
one = [0 for _ in range(60)]

for a in A:
    for i in range(60):
        if a & 1 << i:
            one[i] += 1
ans = 0
for j, a in enumerate(A):
    n -= 1
    if n == 0:
        break
    for i in range(60):
        if a & 1 << i:
            one[i] -= 1
    # print(one)

    for i in range(60):
        if a & 1 << i:
            ans += (1 << i) * (n - one[i])
        else:
            ans += (1 << i) * one[i]


print(ans % 1000000007)


### FIXED CODE ###

n = int(input())
A = list(map(int, input().split()))
one = [0 for _ in range(60)]

for a in A:
    for i in range(60):
        if a & 1 << i:
            one[i] += 1
ans = 0
for a in A:
    n -= 1
    if n == 0:
        break
    for i in range(60):
        if a & 1 << i:
            one[i] -= 1

    for i in range(60):
        if a & 1 << i:
            ans += (1 << i) * (n - one[i])
        else:
            ans += (1 << i) * one[i]

print(ans % 1000000007)
### BUGGY CODE ###

n, k = map(int,input().split())
l = list(map(int,input().split()))
#print(l)

x = 0
y = 0
for i in range(n-k+1):
    if x < sum(l[i:i+k]):
        x = sum(l[i:i+k])
        y = i
#print(x,y)

z = 0
#for j in range(y,y+k):
#    z += (l[j]+1)/2

print((sum(l[y:y+k]) + k)/2)

### FIXED CODE ###

from itertools import accumulate

n, k = map(int,input().split())
l = list(map(int,input().split()))
#print(l)

p = [0] + list(accumulate(l))

#print(p)

q = []
for i in range(n-k+1):
    q.append((p[i+k] - p[i] + k)/2)

print(max(q))
### BUGGY CODE ###

n,k = map(int,input().split())
h = list(map(int,input().split()))
h.sort(reverse=True)

if n > k:
    for i in range(k):
        h.pop(0)
    print(sum(h))
else:
    print(0)

### FIXED CODE ###

n,k = map(int,input().split())
h = list(map(int,input().split()))
h.sort(reverse=True)

if n > k:
    del h[:k]
    print(sum(h))
else:
    print(0)
### BUGGY CODE ###

s = input()
q = int(input())

for i in range(q):
    query = input()
    if query == '1':
        s = s[::-1]
    else:
        t,f,c = query.split()
        if f == '1':
            s = c + s
        elif f == '2':
            s = s + c
print(s)

### FIXED CODE ###

import sys
from collections import deque

# sys.stdin = open('test_cases/abc158d/in/01.txt', 'r')
# sys.stdin = open('input.txt', 'r')

s = deque([s for s in input()])
q = int(input())
rev = False

for query in sys.stdin:
    if query.strip() == '1': # sys.stdin does not remove line breaks. (vs. input() removes line breaks)
        if rev:
            rev = False
        else:
            rev = True
    else:
        t,f,c = query.split()
        if f == '1':
            if rev:
                s.append(c)
            else:
                s.appendleft(c)
        elif f == '2':
            if rev:
                s.appendleft(c)
            else:
                s.append(c)
if rev == True:
    s.reverse()
print(''.join(s))
### BUGGY CODE ###

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

bit = A
for a in range(A+1,B+1):
  bit = bit ^ a

print(bit)


### FIXED CODE ###

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

def getXOR(x):
  if x%4 == 0:
    return x
  elif x%4 == 1:
    return 1
  elif x%4 == 2:
    return x+1
  else:
    return 0


print(getXOR(A-1)^getXOR(B))
### BUGGY CODE ###

s = input()

ans = 0
mods = {}
x = int(s)
s = [int(a) for a in s]
for i in range(len(s)+1):
    if i != 0:
        x -= s[i-1] * 10**(len(s)-i)
    a = x%2019
    if a in mods.keys():
        mods[a] += 1
    else:
        mods[a] = 1

for k in mods.keys():
    counts = mods[k]
    ans += counts // 2
print(ans)

### FIXED CODE ###

from collections import Counter
s = input()

ans = 0
mods = [0]
s = [int(a) for a in s[::-1]]
x = 0
for i in range(len(s)):
    x += s[i] * pow(10, i, 2019)
    mods.append(x%2019)

mods = Counter(mods)

for k in mods.keys():
    counts = mods[k]
    ans += counts * (counts-1) // 2
print(ans)
### BUGGY CODE ###

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

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

way = [[0 for j in range(n)] for i in range(n)]




for i in range(m):
    a,b  = map(int, input().split())
    way[a-1][b-1] += 1
    way[b-1][a-1] += 1
    
#print(way)
goodcount = 0

for i in range(n): #i本目を調べてる
    good = 1
    for j in range(n): #j本目と比べてる
        #print("!", i,j)
        if i != j and way[i][j] != 0:
            #print(height[i], height[j])
            if height[i] <= height[j]:
                good = 0
                
    if good == 1:
        goodcount += 1
        #print(i)
        
print(goodcount)


### FIXED CODE ###

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

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

good = [1 for j in range(n)] 


for i in range(m):
    a,b  = map(int, input().split())
    
    if height[a-1] >= height[b-1]:
        good[b-1] = 0
    if height[a-1] <= height[b-1]:
        good[a-1] = 0

ans = good.count(1)
print(ans)
### BUGGY CODE ###

N, X = map(int, input().split())
items = []
for i in range(N):
    b, l, u = map(int, input().split())
    items.append((b, l, u, u * (X - b), - b * l))

items = sorted(items, key=lambda x: -(x[3] - x[4]))


def f(num):
    cnt = num // X
    mod = num % X
    point = 0
    for i in range(cnt):
        point += items[i][3]
    for i in range(cnt, N):
        point += items[i][4]

    if mod == 0:
        if point >= 0:
            return True
        else:
            return False
    else:
        tmp = -float("inf")
        for i in range(N):
            b, l, u, d1, d2 = items[i]
            if mod >= b:
                mul = u * (mod - b)
            else:
                mul = l * (mod - b)

            if i < cnt:
                tmp = max(tmp, point - d1 + mul + items[cnt][3] - items[cnt][4])
            else:
                tmp = max(tmp, point - d2 + mul)
        if tmp >= 0:
            return True
        else:
            return False

ok = N * X + 1
ng = - 1
while (ok - ng) > 1:
    mid = (ok + ng) // 2
    if f(mid):
        ok = mid
    else:
        ng = mid
print(ok)


### FIXED CODE ###

N, X = map(int, input().split())
items = []
for i in range(N):
    b, l, u = map(int, input().split())
    items.append((b, l, u, u * (X - b), - b * l))

items = sorted(items, key=lambda x: -(x[3] - x[4]))


def f(num):
    cnt = num // X
    mod = num % X
    point = 0
    for i in range(cnt):
        point += items[i][3]
    for i in range(cnt, N):
        point += items[i][4]

    if mod == 0:
        if point >= 0:
            return True
        else:
            return False
    else:
        tmp = -float("inf")
        for i in range(N):
            b, l, u, d1, d2 = items[i]
            if mod >= b:
                mul = u * (mod - b)
            else:
                mul = l * (mod - b)

            if i < cnt:
                tmp = max(tmp, point - d1 + mul + items[cnt][3] - items[cnt][4])
            else:
                tmp = max(tmp, point - d2 + mul)
        if tmp >= 0:
            return True
        else:
            return False

ok = N * X + 1
ng = - 1
while (ok - ng) > 1:
    mid = (ok + ng) // 2
    if f(mid):
        ok = mid
    else:
        ng = mid
print(ok)
### BUGGY CODE ###

import sys
N=int(input())
S=input()

for k in reversed(range(1,N//2+1)):
  for i in range(N-2*k+1):
    S1=S[i:i+k]
    for j in range(i+k,N-k+1):
      S2=S[j:j+k]
      #print(k,S1,S2)
      if S1==S2:
        print(k)
        sys.exit(0)
print(0)

### FIXED CODE ###

import sys
N=int(input())
S=input()

def z_alg(S):
  N=len(S)
  Z=[N]+[0]*(N-1)
  i,j=1,0
  while i<N:
    while i+j<N and S[j]==S[i+j]:
      j+=1
    if not j:
      i+=1
      continue
    Z[i]=j
    k=1
    while N-i>k and k<j-Z[k]:
      Z[i+k]=Z[k]
      k+=1
    i+=k
    j-=k
  return Z

answer=0
for i in range(N):
  zlist=z_alg(S[i:])
  #print(i,S[i:],zlist)
  for j in range(N-i):
    if j>=zlist[j] and answer<zlist[j]:
      answer=zlist[j]
      
print(answer)
### BUGGY CODE ###

#13:19
n = int(input())
s = input()
t = []
for i in range(n):
  t.append(ord(s[i])-97)
q = int(input())
scale = 19
seg = [[0 for _ in range(2**(scale+1))] for _ in range(26)]
for i in range(n):
  tmp = int(i) + 2 ** scale
  x = t[i]
  while tmp != 0:
    seg[x][tmp] += 1
    tmp //= 2
#print(seg)
raw = []
for _ in range(q):
  d,a,b = input().split()
  d = int(d)
  if d == 1:
    a = int(a) - 1
    b = ord(b) - 97
  else:
    a = int(a) - 2
    b = int(b) - 1
  raw.append([d,a,b])
for p in range(q):
  d,a,b = raw[p]
  if d == 1:
    tmp = int(a)
    c = t[tmp]
    tmp += 2**scale
    while tmp != 0:
      seg[c][tmp] -= 1
      tmp //= 2
    tmp = int(a)
    t[tmp] = b
    tmp += 2**scale
    while tmp != 0:
      seg[b][tmp] += 1
      tmp //= 2
  else:
    ans = 0
    for d in range(26):
      l = 0
      r = 0
      if a == -1:
        l = 0
      else:
        tmp = a + 2**scale
        l += seg[d][tmp]
        while tmp != 1:
          if tmp % 2 == 1:
            l += seg[d][tmp-1]
          tmp //= 2
      tmp = b + 2**scale
      r += seg[d][tmp]
      while tmp != 1:
        if tmp % 2 == 1:
          r += seg[d][tmp-1]
        tmp //= 2
      if r > l:
        ans += 1
      #print(d,r,l)
    print(ans)
#print(t)

### FIXED CODE ###

#13:19
n = int(input())
s = input()
t = []
for i in range(n):
  t.append(ord(s[i])-97)
q = int(input())
scale = 19
seg = [[0 for _ in range(2**(scale+1))] for _ in range(26)]
for i in range(n):
  tmp = int(i) + 2 ** scale
  x = t[i]
  while tmp != 0:
    seg[x][tmp] += 1
    tmp //= 2
#print(seg)
raw = []
for _ in range(q):
  d,a,b = input().split()
  d = int(d)
  if d == 1:
    a = int(a) - 1
    b = ord(b) - 97
  else:
    a = int(a) - 2
    b = int(b) - 1
  raw.append([d,a,b])
for p in range(q):
  d,a,b = raw[p]
  if d == 1:
    tmp = int(a)
    c = t[tmp]
    tmp += 2**scale
    while tmp != 0:
      seg[c][tmp] -= 1
      tmp >>= 1
    tmp = int(a)
    t[tmp] = b
    tmp += 2**scale
    while tmp != 0:
      seg[b][tmp] += 1
      tmp >>= 1
  else:
    ans = 0
    for d in range(26):
      l = 0
      r = 0
      if a == -1:
        l = 0
      else:
        tmp = a + 2**scale
        l += seg[d][tmp]
        while tmp != 1:
          if tmp & 1:
            l += seg[d][tmp-1]
          tmp >>= 1
      tmp = b + 2**scale
      r += seg[d][tmp]
      while tmp != 1:
        if tmp & 1:
          r += seg[d][tmp-1]
        tmp >>= 1
      if r > l:
        ans += 1
      #print(d,r,l)
    print(ans)
#print(t)
### BUGGY CODE ###

L,R=map(int,input().split())

x=[]
a=1
for i in range(L,R):
    for j in range(L+1,R+1):
        y=((i*j)%2019)
        x.append(y)
        if x==0:
            break

print(min(x))

### FIXED CODE ###

L,R=map(int,input().split())

x=[]
a=0
for i in range(L,R):
    for j in range(L+1,R+1):
        y=((i*j)%2019)
        x.append(y)
        if y==0:
            break
    if y==0:
            break

print(min(x))
### BUGGY CODE ###

def fib(n):
    if n == 0 or n == 1:
        return 1
    else :
        return fib(n - 1) + fib(n - 2)

def main():
    print( fib( int( input() ) ) )

if __name__ == '__main__':
    main()



### FIXED CODE ###

class fibNum():
    def __init__(self):
        self.arr = [1, 1]
    def fib(self, n):
        return_num = 1
        if n > 1:
            if len(self.arr) <= n:
                self.arr.append( self.fib(n-1) + self.fib(n-2) )
            return_num = self.arr[n]
        return return_num

def main():
    n = int( input() )
    fn = fibNum()
    print( fn.fib(n) )

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

n=int(input())
S=input()
R=[]
G=[]
B=[]
for i in range(n):
    if S[i]=='R':
        R.append(i+1)
    elif S[i]=='G':
        G.append(i+1)
    else:
        B.append(i+1)
r=len(R)
g=len(G)
b=len(B)

c=0
for i in R:
    for j in B:
        min_n=min(i,j)
        max_n=max(i,j)
        d=abs(i-j)
        if max_n+d in G:
            c+=1
        if (i+j)%2==0 and (i+j)//2 in G:
            c+=1
        if min_n-d in G:
            c+=1

print(r*g*b-c)

### FIXED CODE ###

n=int(input())
S=input()
R=[]
G=[]
B=[]
for i in range(n):
	if S[i]=='R':
		R.append(i)
	elif S[i]=='G':
		G.append(i)
	else:
		B.append(i)
r=len(R)
g=len(G)
b=len(B)

c=0
for i in range(n):
	for j in range(i+1,n):
		k=2*j-i
		if k<n:
			if len(set([S[i],S[j],S[k]]))==3:
				c+=1

print(r*g*b-c)
### BUGGY CODE ###

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

Q = [list(input().split()) for _ in range(N)]
direction = 0
count = 0
for q in Q:
    if q[0] == "1":
        direction = abs(direction*1 - 1)
        count += 1
    else:
        if (direction == 0 and q[1] == "1") or (direction == 1 and q[1] == "2"):
            S.insert(0, q[2])
        elif (direction == 0 and q[1] == "2") or (direction == 1 and q[1] == "1"):
            S.append(q[2])

if count % 2  == 1:
    print("".join(S[::-1]))
else:
    print("".join(S))

### FIXED CODE ###

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

Q = [list(input().split()) for _ in range(N)]

count = 0
c = 0

ans_append = []
ans_insert = []

for q in Q:
    if q[0] == "1":
        count += 1
        c = count % 2
    else:
        if (c == 0 and q[1] == "1") or (c == 1 and q[1] == "2"):
            ans_insert.append(q[2])
        elif (c == 0 and q[1] == "2") or (c == 1 and q[1] == "1"):
            ans_append.append(q[2])


if count % 2  == 1:
    ans = ans_append[::-1] + S[::-1] + ans_insert
    print("".join(ans))
else:
    ans = ans_insert[::-1] + S + ans_append
    print("".join(ans))
### BUGGY CODE ###

import sys
input = sys.stdin.readline

def divisors(n):
    lst = []; i = 1
    while i ** 2 <= n:
        q, r = divmod(n, i)
        if r == 0:
            lst.append(i)
            if i != q: lst.append(q)
        i += 1
    return lst

N = int(input())
*A, = map(int, input().split())
A = sorted(A)
cnt = [0] * (10**6 + 1)
for a in A: cnt[a] += 1
ans = 0
for a in A:
    if cnt[a] > 1: continue
    for i in divisors(a):
        if i == a: continue
        if cnt[i] >= 1: break
    else:
        ans += 1
print(ans)


### FIXED CODE ###

from collections import Counter

N = int(input())
*A, = map(int, input().split())
A = sorted(A)
max_A = A[-1]
cnt = Counter(A)
admissible = [True] * (max_A + 1)
checked = [False] * (max_A + 1)
ans = 0
for a in A:
    if not admissible[a] or checked[a]: continue
    ans += 1
    i = 2
    while a * i <= max_A:
        admissible[a * i] = False
        i += 1
    checked[a] = True
    if cnt[a] > 1: ans -= 1
print(ans)
### BUGGY CODE ###

n,m,q = map(int, input().split())
m_start = []
m_end = []
for i in range(m):
  s,e = map(int, input().split())
  m_start .append(s)
  m_end.append(e)
for i in range(q):
  s,e = map(int, input().split())
  cnt = 0
  for j in range(m):
    if m_start[j] >= s and m_end[j] <= e : cnt += 1
  else:
    print(cnt)

### FIXED CODE ###

n,m,q = map(int, input().split())
mmap = [ [ 0 for j in range(n+1) ] for i in range(n+1) ]
for i in range(m):
  s,e = map(int, input().split())
  mmap[s][e] += 1
for i in range(n+1):
  for j in range(1,n+1):
    mmap[i][j] = mmap[i][j] + mmap[i][j-1]
for j in range(n+1):
  for i in range(n-1,0,-1):
    mmap[i][j] = mmap[i][j] + mmap[i+1][j]
for i in range(q):
  s,e = map(int, input().split())
  print(mmap[s][e])
### BUGGY CODE ###

n,t = map(int,input().split())
ab = [list(map(int,input().split())) for _ in range(n)]
ab.sort() # 食べるのが早い順にソート

# ナップザック問題に落とし込む
dp = [[0 for i in range(t+1)]for j in range(n+1)]

for i in range(n):
    ti,vi = ab[i]
    for j in range(t+1):
        # 食べたほうがよい(t秒以内かつ満足度が上がるならば)
        if j + ti <= t:
            dp[i+1][j+ti] = max(dp[i+1][j+ti],dp[i][j]+vi)
        # 食べなかった場合の最高値を更新
        dp[i+1][j] = max(dp[i][j],dp[i+1][j])

ma = 0

for i in range(n):
    # 最後にi番目の皿を食べることができる
    ma = max(ma,dp[i][t-1]+ab[i][1])

print(ma)

### FIXED CODE ###

N, W = map(int, input().split())
items = sorted([list(map(int, input().split())) for i in range(N)])

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

# dpテーブルを埋める
for i in range(N):
    wi, vi = items[i]
    for j in range(W + 1):
        if j + wi <= W:
            dp[i + 1][j + wi] = max(dp[i + 1][j + wi], dp[i][j] + vi)
        dp[i + 1][j] = max(dp[i][j], dp[i + 1][j])


ans = 0
# 最後に入れる商品は、残り容量１の時に入れるとしてしまってよい
for i, (wi, vi) in enumerate(items):
    ans = max(ans, dp[i][W - 1] + vi)

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

inp = input()
inp = input()
 
def mp(nums):
  n = 1
  for num in nums:
    n *=num
  return n
 
limit = 10**18
num = mp([int(x) for x in inp.split(" ")])
 
if num > limit:
  print(-1)
else:
  print(num)

### FIXED CODE ###

inp = input()
inp = input()
 
def mp(nums):
  if 0 in nums:
    print(0)
    return
  n = 1
  limit = 10**18
  for num in nums:
    n *=num
    if n > limit:
      print(-1)
      return
  print(n)
 
mp([int(x) for x in inp.split(" ")])