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

def compare(a, A):
    R=0
    for i in range(0, len(A)):
        if(a==A[i]):
            R+=1
        elif(a<A[i]):
            break
    return R

def result(R,a):
    if(R==a):
        return 0
    elif(a<R):
        return R-a
    return R

N = int(input())

a = list(map(int, input().split()))
a.sort()

R=0
T=1
R+=result(compare(a[0],a),a[0])

for i in range(1, N):
    if(a[i] != a[i-1]):
        R+=result(compare(a[i],a[T:]),a[i])
        T+=compare(a[i],a)


print(R)


### FIXED CODE ###

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

a.sort()
a.append(0)

T=[]
j=0
t=0
s=0
for i in range(N):
    j+=1
    if a[i] != a[i+1]:
        if j-s > a[i]:
            t+=(j-s)-a[i]
        elif j-s < a[i]:
            t += j-s
        s=j

print(t)
### BUGGY CODE ###


def main():
  n=int(input())
  s=input()
  ans=0
  for i in range(n):
    Z=[0]*n
    j=i+1
    while j<n:
      k=0
      while i+k<j and j+k<n and s[i+k]==s[j+k]:
        k+=1
      Z[j]=k
      #if k>1:
      #  j+=k
      #else:
      j+=1
      #j+=max(k,1)
    t=max(Z)
    if ans<t:
      ans=t
  print(ans)


if __name__=='__main__':
  main()

### FIXED CODE ###

def main():
  n=int(input())
  s=input()
  dp=[[0]*(n+1) for i in range(n+1)]
  for i in range(n-1,-1,-1):
    for j in range(n-1,i,-1):
      if s[i]==s[j]:
        dp[i][j]=dp[i+1][j+1]+1
  #for i in dp:
  #  print(i)
  
  ans=0
  for i in range(n-1):
    for j in range(i+1,n):
      ans=max(ans,min(j-i,dp[i][j]))
  print(ans)      
        

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

def main():
    N, M = map(int, input().split())
    S = list(map(int, input().split())) + [0]
    T = list(map(int, input().split())) + [0]
    dp0 = [[0] * (M + 5) for _ in range(N + 5)]
    dp1 = [[0] * (M + 5) for _ in range(N + 5)]
    MOD = 10 ** 9 + 7
    dp0[0][0] = 1
    for i in range(N + 1):
        for j in range(M + 1):
            dp0[i+1][j] += dp0[i][j]
            dp1[i][j] += dp0[i][j]
            dp1[i][j+1] += dp1[i][j]
            if S[i] == T[j]:
                dp0[i+1][j+1] += dp1[i][j]

    ans = dp1[N][M] % MOD
    print(ans)



if __name__ == "__main__":
    main()

### FIXED CODE ###

def main():
    N, M = map(int, input().split())
    S = list(map(int, input().split())) + [0]
    T = list(map(int, input().split())) + [0]
    dp0 = [[0] * (M + 5) for _ in range(N + 5)]
    dp1 = [[0] * (M + 5) for _ in range(N + 5)]
    MOD = 10 ** 9 + 7
    dp0[0][0] = 1
    for i in range(N + 1):
        for j in range(M + 1):
            dp0[i+1][j] += dp0[i][j]
            dp0[i+1][j] %= MOD
            dp1[i][j] += dp0[i][j]
            dp1[i][j] %= MOD
            dp1[i][j+1] += dp1[i][j]
            dp1[i][j+1] %= MOD
            if S[i] == T[j]:
                dp0[i+1][j+1] += dp1[i][j]
                dp0[i+1][j+1] %= MOD

    ans = dp1[N][M] % MOD
    print(ans)



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

from itertools import combinations

N = int(input())

for h, n in combinations(range(1, 3501), 2):
    num = N * h * n
    denom = 4 * h * n - N * n - N * h
    if denom > 0 and num % denom == 0:
        w = num // denom
        break
print(h, n, w)


### FIXED CODE ###

N = int(input())

for h in range(1, 3501):
    for n in range(1, 3501):
        num = N * h * n
        denom = 4 * h * n - N * n - N * h
        if denom > 0 and num % denom == 0:
            w = num // denom
            break
    else:
        continue
    break
print(h, n, w)
### BUGGY CODE ###

n,k = map(int,input().split())
a = list(map(int,input().split()))
b = set(a)
syurui = []
ans = 0
for i in b:
    syurui.append(a.count(i))
syurui.sort()
if len(b) <= k:
    print(0)
else:
    for i in range(len(b)-k):
        ans += syurui[i]
    print(ans)


### FIXED CODE ###

n,k = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
ans = 0
key = a[0]
a_syurui = []
count = 1
for i in a[1:]:
    if key == i:
        count += 1
    else:
        a_syurui.append(count)
        count = 1
        key = i
a_syurui.append(count)
a_syurui.sort()
if len(a_syurui) <= k:
    print(0)
else:
    for i in range(len(a_syurui)-k):
        ans += a_syurui[i]
    print(ans)
### BUGGY CODE ###

def main():
    n=int(input())
    T=sorted(set(list(int(input()) for _ in  range(n))))
    k=T[-1]
    while 1:
        for t in T:
            if k%t>0:
                k += T[-1]
                break
        else: #for文がbreakしなければここを読む.
            print(k)
            break
main()

### FIXED CODE ###

from fractions import gcd
#from math import gcd
def lcm(a,b):
    return a*b//gcd(a,b)
def main():
    n=int(input())
    T=set(list(int(input()) for _ in  range(n)))
    ans=1
    for t in T:
        ans = lcm(t,ans)
    print(ans)
main()
### BUGGY CODE ###

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

key = set()
for i in range(0, N-2):
    for j in range(i+1, N-1):
        for k in range(j+1, N):
            key.add(S[i]+S[j]+S[k])

print(len(key))


### FIXED CODE ###

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

X = []
for i in range(10):
    X.append(str(i))

ans = 0
for i in X:
    if i in S:
        T = S[S.index(i) + 1:]
        for j in X:
            if j in T:
                U = T[T.index(j) + 1:]
                for k in X:
                    if k in U:
                        ans += 1

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

# def gen_is_prim(n):
#     is_prim = [i%2==1 for i in range(n+1)]
#     is_prim[1] = False; is_prim[2] = True
#     for i in range(3, n+1, 2):
#         if not is_prim[i]: continue
#         for j in range(i+i, n+1, i):
#             is_prim[j] = False
#     return is_prim

def gen_d_prim(n):
    D = [n+1 if i%2 else 2 for i in range(n+1)]
    D[0] = D[1] = 0
    for i in range(3, n+1, 2):
        if D[i] != n+1: continue
        for j in range(i, n+1, i): D[j] = i
    return D

def gcd_all(A):
    from math import gcd
    g = 0
    for a in A: g = gcd(g, a)
    return g

def is_pairwise():
    # MAX_A = 10**6 + 1
    # C = [0] * MAX_A
    # for a in A: C[a] += 1
    # if sum(C[2::2]) > 1: return False
    # for i in range(3, MAX_A, 2):
    #     if sum(C[i::i]) > 1: return False
    # return True

    MAX_A = 10**6
    D = gen_d_prim(MAX_A)
    C = [0] * (MAX_A + 1)
    pre = set()
    for a in A:
        now = set()
        while a != 1:
            now.add(D[a])
            a //= D[a]
        # print('pre {}'.format(pre))
        # print('now {}'.format(now))
        # print('now & pre {}'.format(now & pre))
        if len(now & pre) > 0: return False
        pre = pre | now
    return True

def solve():
    if is_pairwise(): return 0
    if gcd_all(A) == 1: return 1
    return 2

    # if gcd_all(A) > 1: return 2
    # if is_pairwise(): return 0
    # return 1


n = int(input())
A = [*map(int, input().split())]
print(['pairwise','setwise','not'][solve()], 'coprime')


### FIXED CODE ###

n = int(input())
A = [*map(int, input().split())]
def solve():
    MAX_A = 10**6 + 1
    C = [0] * MAX_A
    for a in A: C[a] += 1
    pairwise = True
    for i in range(2, MAX_A):
        if sum(C[i:MAX_A:i]) > 1: pairwise = False
    if pairwise: return 'pairwise'
    from math import gcd
    g = 0
    for a in A: g = gcd(g, a)
    if g == 1: return 'setwise'
    return 'not'
print(solve(), 'coprime')
### BUGGY CODE ###

import numpy as np
from collections import Counter
N = int(input())
A = list(map(int,input().split()))
c = Counter(A)

NMAX=2*10**5

tmp = np.zeros((NMAX+1))
for n in c:
    tmp[n] = c[n]

l1= tmp*(tmp-1)//2
tmp -=1
l2= tmp*(tmp-1)//2

for a in A:
    sum = 0
    for i in c:
        if a ==i:
            sum += l2[i]
        else:
            sum += l1[i]
    print(int(sum))



### FIXED CODE ###

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

import collections 
c=collections.Counter(A)
sum=0
for i in c:
  sum+=c[i]*(c[i]-1)//2  
for a in A:
  print(sum - c[a]*(c[a]-1)//2 + (c[a]-1)*(c[a]-2)//2)
### BUGGY CODE ###

n = int(input())
s = list(input().strip())

min = -1

for i in range(n-1):
    turn = s[0:i].count("W") + s[i+1:n].count("E")
    if min == -1 or min >= turn:
        min = turn
        
    

print(min)


### FIXED CODE ###

n = int(input())
s = list(input().strip())

min = -1

for i in range(n):
    if i == 0:
        turn = s[i+1:n].count("E")
    else:
        if s[i-1] == "W" and s[i] == "W":
            turn += 1
        elif s[i-1] == "W" and s[i] == "E":
            next
        elif s[i-1] =="E" and s[i] =="W":
            next
        else:
            turn -=1
    if min == -1 or min >= turn:
        min = turn
        
    

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

# import bisect
# import copy
# import fractions
# import math
# import numpy as np
# from collections import Counter, deque
# from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product

def resolve():
    N, M = map(int,input().split())
    A = [int(input()) for _ in range(M)]


    dp = [0]*(N+1)
    dp[0]=1

    for i in range(N):
        if not i+1 in A:
            dp[i + 1] += dp[i]
        if i < N - 1 and not i+2 in A:
            dp[i + 2] += dp[i]
    print(dp[N]%(10**9+7))



resolve()

### FIXED CODE ###

# import bisect
# import copy
# import fractions
# import math
# import numpy as np
# from collections import Counter, deque
# from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product

def resolve():

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


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

    for i in range(2,N+1):
        dp[i]=(dp[i-1]+dp[i-2])%(10**9+7)*dp[i]

    print(dp[N])

resolve()
### BUGGY CODE ###

N , K = map(int,input().split())
Lum = [a for a in map(int,input().split())]

K = min(K,20)
for i1 in range(K):
    B = [0]*N
    for i in range(N):
        l = max(0,i-Lum[i])
        r = min(N-1,i+Lum[i])
        B[l]+=1
        if r+1<N:
            B[r+1]-=1
    for i in range(1,N):
        B[i]+=B[i-1]
    Lum = B
    
Lum = [str(l) for l in Lum]
Lum=" ".join(Lum)
print(Lum)


### FIXED CODE ###

import numpy as np
from numba import jit 
N , K = map(int,input().split())
Lum = np.array(list(map(int,input().split())))

@jit("i8,i8,i8[:]")
def fn(N,K,A):
    K1 = min(K,41)
    for i1 in range(K1):
        B = np.zeros(N,dtype=np.int64)
        for i in range(N):
            l = max(0,i-A[i])
            r = min(N-1,i+A[i])
            B[l]+=1
            if r+1<N:
                B[r+1]-=1
        for i in range(1,N):
            B[i]+=B[i-1]
        A = B
    return A

Lum = list(fn(N,K,Lum))
Lum = [str(l) for l in Lum]
Lum=" ".join(Lum)
print(Lum)
### BUGGY CODE ###

import sys
input = sys.stdin.readline

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

l = 0
r = N
while r-l > 1:
    m = (r+l)//2
    ok = True
    dp = {}
    needreset = 10**15
    # これより長かったらdpにあろうがなかろうが存在しないものになる
    exception = set()
    pre = -1
    for a in A:
        ind = a
        while True:
            # 修正
            if needreset >= ind or ind in exception:
                if not ind in dp.keys():
                    dp[ind] = 0 if pre < a else 1
            else:
                dp[ind] = 0 if pre < a else 1
                exception.add(ind)
            # たす
            if dp[ind] != m:
                dp[ind] += 1
                break
            elif ind == 1:
                ok = False
                break
            else:
                # 繰り上がり
                dp[ind] = 1
                ind -= 1
        if not ok: break
        # 更新
        if pre > a:
            needreset = a
            exception = set()
        pre = a

    if ok:
        r = m
    else:
        l = m

print(r)

### FIXED CODE ###

import sys
input = sys.stdin.readline

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


def check(m):
    if m == 1:
        pre = -1
        for a in A:
            if pre >= a:
                return False
            pre = a
    else:
        dp = {}
        pre = 0
        #count = 0
        for a in A:
            if pre < a:
                pre = a
                continue
            todelete = []
            for b in dp.keys():
                if b > a:
                    todelete.append(b)
            ind = a
            while ind > 0:
                if ind in dp and dp[ind] >= m-1:
                    todelete.append(ind)
                else:
                    break
                ind -= 1
            # 更新
            if ind in dp:
                dp[ind] += 1
            else:
                dp[ind] = 1
            if ind == 0 or dp[ind] >= m:
                return False
            for d in todelete:
                del dp[d]
            pre = a
    #print(m, count)
    return True



def main():
    l = 0
    r = N
    while r-l > 1:
        m = (r+l)//2
        if check(m):
            r = m
        else:
            l = m
    print(r)


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

#!/usr/bin/env python3
n = int(input())
a = [int(input())-1 for _ in range(n)]
# -1をしたので、if a[s] == 1になったら終了
#print(a)
cnt = 0
visit = [0] #出発点は訪れてる
i = 0
while True:
    cnt += 1
    #print(visit)
    if a[i] in visit:#循環するのでbreak
        print(-1)
        exit(0)
    elif a[i] == 1: #ボタン２を押すので今までの回数を答える
        print(cnt)
        exit(0)
    else:# i を更新　visitに現在のボタンを追加する
        visit.append(a[i])
        i = a[i]

### FIXED CODE ###

#!/usr/bin/env python3
n = int(input())
a = [int(input())-1 for _ in range(n)]
# -1をしたので、if a[s] == 1になったら終了
#print(a)
cnt = 0
visit = [0] #出発点は訪れてる
i = 0 # bottom position a[i] = next_bottom
while cnt <= n:#無限ループになる理由がわからん in が最悪のケースでO(nlogn)
    cnt += 1
    #print(visit)
    """if a[i] in visit:#循環するのでbreak
        print(-1)
        exit(0)"""
    if a[i] == 1: #ボタン２を押すので今までの回数を答える
        print(cnt)
        exit(0)
    else:# i を更新　visitに現在のボタンを追加する
        #visit.append(a[i])
        i = a[i]
print(-1)
### BUGGY CODE ###

n = int(input())
a = list(map(int, input().split()))
q = int(input())
b = [0] * q
c = [0] * q
for i in range(q):
  b[i], c[i] = map(int, input().split())

num = []
for i in range(100001):
  num.append(a.count(i))

sum = sum(a)
for i in range(q):
  sum = sum + (c[i] - b[i]) * num[b[i]]
  print(sum)
  num[c[i]] += num[b[i]]
  num[b[i]] = 0

### FIXED CODE ###

from collections import Counter

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

counter = Counter(a)
sum_res = sum(a)

for _ in range(q):
  b, c = map(int, input().split())

  sum_res += (c - b) * counter[b]

  counter[c] += counter[b]
  counter[b] =0

  print(sum_res)
### BUGGY CODE ###

N = int(input())
strX = input()

decX = int(strX,2)
cnt = strX.count('1')

cnt_sp = cnt + 1
cnt_sm = cnt - 1


for i in range(0,N):
  if strX[i] == '0':
    wkstr = strX[:i] + '1' + strX[i+1:N+1]
    wkcnt = cnt_sp
  else:
    wkstr = strX[:i] + '0' + strX[i+1:N+1]
    wkcnt = cnt_sm
  
  if wkcnt == 0:
    Ans = 0
    pop = 0
  else:
    wkdec = int(wkstr,2)
    pop = wkdec % wkcnt
    Ans = 1
  
  while pop > 0:
    wkcnt = bin(pop).count('1')
    pop = pop % wkcnt
    Ans += 1
  
  print(Ans)


### FIXED CODE ###

N = int(input())
strX = input()

#10進数に変換
decX = int(strX,2)

#1の数をカウント
pop_c = strX.count('1')

# X % popcount+1
f_p = decX % (pop_c + 1)

# X % popcount-1(0になる時は0)
if pop_c == 1:
  f_m = 0
else:
  f_m = decX % (pop_c - 1)

for i in range(0,N):
  if strX[i] == '0':
    pop_a = (f_p + pow(2,(N-1-i),(pop_c + 1))) % (pop_c + 1) 
    Ans = 1
    
  elif pop_c == 1:
    pop_a = 0
    Ans = 0
    
  else:
    pop_a = f_m - (pow(2,(N-1-i),(pop_c - 1)))
    if pop_a < 0:
      pop_a = pop_a + pop_c - 1
    Ans = 1
  
  while pop_a > 0:
    wkpop = bin(pop_a).count('1')
    pop_a = pop_a % wkpop
    Ans += 1
  
  print(Ans)
### BUGGY CODE ###

import sys
import numpy as np

s = input()
t = input()



count = 0
s_len = len(s)
s_list = np.zeros(len(s))
t_list = []*len(t)

for i,k in enumerate(t):

  indexes = [j for j, x in enumerate(s) if x == k]
  if len(indexes) == 0:
    print(-1)
    sys.exit(0)
  else:
    t_list.insert(i,indexes)
    


pre = -1
for i in range(len(t)):
  
  high = [j  for j in t_list[i] if j > pre]
  if len(high) == 0:
    
    count += s_len - pre  + t_list[i][0]
    pre = t_list[i][0] 
  else:
    
    count += high[0] - pre 
    pre = high[0]

print(count)

### FIXED CODE ###

import sys
import numpy as np
import bisect
s = input()
t = input()



count = 0
s_len = len(s)
s_list = np.zeros(len(s))
t_list = []*len(t)
indexes = []

for i in range(26):
  
  indexes.append([j for j, x in enumerate(s) if x == chr(i + ord('a')) ])
  


for i,k in enumerate(t):

  index = indexes[ord(k)-ord('a')]
  
  if len(index) == 0:
    print(-1)
    sys.exit(0)
  else:
    t_list.insert(i,index)
    


pre = -1
for i in range(len(t)):
  
  #high = [j  for j in t_list[i] if j > pre]
  high = bisect.bisect_left(t_list[i], pre+1) 

  if high >= len(t_list[i]):
    
    count += s_len - pre  + t_list[i][0]
    pre = t_list[i][0] 
  else:
    
    count += t_list[i][high] - pre 
    pre = t_list[i][high]

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

import itertools
n=int(input())
count = 0
a=list(map(int, input().split(" ")))
for ia, ib, ic in itertools.combinations(a, 3):
  if max(ia, ib, ic) < (ia + ib + ic) - max(ia, ib, ic):
    count += 1
print(count)

### FIXED CODE ###

n = int(input())
import bisect
a = sorted(list(map(int, input().split(" "))))
ans = 0
for i in range(1, n-1):
  b = a[:i]
  c = a[i + 1:]
  #print(b, c)
  for j in b:
    ans += bisect.bisect(c, a[i]+j-0.1)
    #print(bisect.bisect(c, a[i]+j-0.1))
print(ans)
### BUGGY CODE ###

a,b=map(int,input().split())
c=list(map(int,input().split()))
d=[]
for i in range(a-b+1):
    d.append(sum(c[i:i+b]))
n=max(d)
print((n+b)/2)

### FIXED CODE ###

def cumsum(xs):
    result = [xs[0]]
    for x in xs[1:]:
        result.append(result[-1] + x)
    return result

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

if a==b:
    print((sum(c)+a)/2)
    exit()

d=[]

c=[(i+1)/2 for i in c]
n=cumsum(c)

m=[]
for i in range(0,a-b):
    m.append(n[i+b]-n[i])


print(max(m))
### BUGGY CODE ###

import collections
N,M = map(int,input().split())


s = []
count = 0
for _ in range(M):
  a,b = map(int,input().split())
  if M==1:
    print(b-a+1)
    exit()
  for i in range(a,b+1):
    s.append(i)
    k = collections.Counter(s)
    
for d in k.values():
    if d==M:
      count+=1
      
print(count)

### FIXED CODE ###

N,M = map(int,input().split())
right = N
left = 1
for _ in range(M):
  a,b = map(int,input().split())
  right = min(right,b) 
  left = max(left,a)

ans = right-left+1
print(max(0,ans))
### BUGGY CODE ###

import os
import sys

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7

N = int(sys.stdin.readline())
X = list(map(int, sys.stdin.readline().split()))
L = int(sys.stdin.readline())
Q = int(sys.stdin.readline())
AB = [list(map(int, sys.stdin.readline().split())) for _ in range(Q)]

N += 2
X = [X[0]] + X + [X[-1]]
X = np.array(X, dtype=int)
# dp[d][i]: i番のホテルから(2^d)日で何個右までいけるか
dp = np.zeros((N.bit_length() + 1, N), dtype=int)
dp[0] = np.searchsorted(X, X + L, side='right') - np.arange(N) - 1
for d in range(1, N.bit_length() + 1):
    dp[d] = dp[d - 1] + dp[d - 1][np.arange(N) + dp[d - 1]]


# dp = dp.T

def solve(l, r):
    ret = 0
    tmp = []
    while l + 1 < r:
        d = max(0, np.searchsorted(dp[:, l], r - l) - 1)
        ret += 2 ** d
        l += dp[d, l]
        tmp.append(d)
    if l < r:
        ret += 1
    return ret, tmp


for a, b in AB:
    r, c = solve(min(a, b), max(a, b))
    print(r)


### FIXED CODE ###

import os
import sys

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7

N = int(sys.stdin.readline())
X = list(map(int, sys.stdin.readline().split()))
L = int(sys.stdin.readline())
Q = int(sys.stdin.readline())
AB = [list(map(int, sys.stdin.readline().split())) for _ in range(Q)]

N += 2
X = [X[0]] + X + [X[-1]]
X = np.array(X, dtype=int)
# dp[d][i]: i番のホテルから(2^d)日で何個右までいけるか
dp = np.zeros((N.bit_length() + 1, N), dtype=int)
dp[0] = np.searchsorted(X, X + L, side="right") - 1
for d in range(1, N.bit_length() + 1):
    dp[d] = dp[d - 1][dp[d - 1]]
dp = dp.tolist()


def solve(l, r):
    ret = 0
    d = len(dp) - 1
    while l + 1 < r:
        while d > 0 and dp[d][l] >= r:
            d -= 1
        ret += 1 << d
        l = dp[d][l]
    if l < r:
        ret += 1
    return ret


ans = []
for a, b in AB:
    ans.append(solve(min(a, b), max(a, b)))
print(*ans, sep='\n')
### BUGGY CODE ###

import math
#素数列挙
def get_primes(limit):
    A = [i for i in range(2, limit+1)]
    P = []
    time = 0
    
    while True:
        prime = min(A)
        
        if prime > math.sqrt(limit):
            break
            
        P.append(prime)
            
        A = [i for i in A if i%prime!=0]

    P.extend(A)
          
    return P


def resolve():
    N = int(input())
    A = list(map(int,input().split()))
    sosus = set(get_primes(max(A)+1))
    dvd = set()






    for i in A:
        tmp=[]
        for j in sosus:
            if i % j ==0:
                tmp.append(j)
                while i % j ==0:
                    i //=j
            if i ==1:
                break
        sosus.difference_update(tmp)
        
        if i != 1:
            break
    else:
        print('pairwise coprime')
        return

    val = A[0]
    for i in A:
        val = math.gcd(i,val)

    if val ==1:
        print('setwise coprime')
    else:
        print('not coprime')

resolve()


### FIXED CODE ###


import math
#素数列挙
def get_primes(limit):
    A = [i for i in range(2, limit+1)]
    P = []
    time = 0
    
    while True:
        prime = min(A)
        
        if prime > math.sqrt(limit):
            break
            
        P.append(prime)
            
        A = [i for i in A if i%prime!=0]

    P.extend(A)
          
    return P


def resolve():
    N = int(input())
    A = list(map(int,input().split()))
    sosus = set(get_primes(max(A)+1))
    dvd = set()



    val = A[0]
    for i in A:
        val = math.gcd(i,val)

    if val ==1:
        pass
    else:
        print('not coprime')
        return

    for i in A:
        tmp=[]
        for j in sosus:
            if j>i:
                break
            if i % j ==0:
                tmp.append(j)
                while i % j ==0:
                    i //=j
            if i ==1:
                break
            if i in sosus:
                
                tmp.append(i)
                i = 1
                break
        sosus.difference_update(tmp)
        
        if i != 1:
            break
    else:
        print('pairwise coprime')
        return

    print('setwise coprime')

resolve()
### BUGGY CODE ###

import re

s = list(re.sub(r'[BC]+', 'B', input().strip().replace('BC', 'D')))
n = len(s)
#print(s)

end = n - 1

count = 0

if n >= 3:
  i = 0
  while i < end:
    if s[i] == 'A' and s[i + 1] == 'D':
      s[i] = 'D'
      s[i + 1] = 'A'
      count = count + 1

      j = i - 1
      while j >= 0 and s[j] == 'A':
        s[j] = 'D'
        s[j + 1] = 'A'
        count = count + 1
        j = j - 1

    i = i + 1

print(count)

### FIXED CODE ###

s = input().strip().replace('BC', 'D')
n = len(s)

count = 0
a_count = 0
for i in range(n):
  if s[i] == 'A':
    a_count += 1
  elif a_count > 0 and s[i] == 'D':
    count += a_count
  else:
    a_count = 0

print(count)