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

import bisect
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
B.sort()
C.sort()
ans = 0
for i in C:
    index = bisect.bisect_left(B,i)
    for j in range(index):
        index2 = bisect.bisect_left(A,B[j])
        ans += index2
print(ans)

### FIXED CODE ###

import bisect
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
B.sort()
C.sort()

mid_list = [0]*N
for i in range(N):
    index = bisect.bisect_left(A,B[i])
    if i == 0:
        mid_list[i] = index
    else:
        mid_list[i] = mid_list[i-1] + index

ans = 0
for i in range(N):
    index = bisect.bisect_left(B,C[i])
    if index == 0:
        continue
    ans += mid_list[index-1]

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

H,W=map(int, input().split())
Ch,Cw=map(int, input().split())
Dh,Dw=map(int, input().split())
A=[]
for i in range(H):
  d=list(input())
  A.append(d)
D=[[10**8]*W for i in range(H)]
dy=[-1,1,0,0,2,2,2,2,2,1,1,1,1,0,0,-1,-1,-1,-1,-2,-2,-2,-2,-2]
dx=[0,0,1,-1,0,1,2,-1,-2,1,2,-1,-2,2,-2,1,2,-1,-2,0,1,2,-1,-2]
from collections import deque
import sys
sys.setrecursionlimit(10**7) 
def bfs(y,x):
  q=deque()
  q.append((y,x))
  while len(q):
    y,x=q.popleft()
    for i in range(24):
      ny=y+dy[i]
      nx=x+dx[i]
      if 0<=ny<H and 0<=nx<W:
        if abs(ny-y)+abs(nx-x)==1:
          if A[ny][nx]=='.' and D[y][x]<D[ny][nx]:
            q.append((ny,nx))
            D[ny][nx]=D[y][x]
        else:
          if A[ny][nx]=='.':
            if D[ny][nx]==10**8:
              q.append((ny,nx))
              D[ny][nx]=D[y][x]+1
            elif D[ny][nx]>D[y][x]+1:
              q.append((ny,nx))
              D[ny][nx]=D[y][x]+1
D[Ch-1][Cw-1]=0
bfs(Ch-1,Cw-1)
if D[Dh-1][Dw-1]==10**8:
  print(-1)
else:
  print(D[Dh-1][Dw-1])

### FIXED CODE ###

H,W=map(int, input().split())
Ch,Cw=map(int, input().split())
Dh,Dw=map(int, input().split())
A=[]
for i in range(H):
  d=list(input())
  A.append(d)
D=[[10**8]*W for i in range(H)]
DD=[[-1]*W for i in range(H)]
dy=[-1,1,0,0]
dx=[0,0,1,-1,]
ey=[2,2,2,2,2,1,1,1,1,0,0,-1,-1,-1,-1,-2,-2,-2,-2,-2]
ex=[0,1,2,-1,-2,1,2,-1,-2,2,-2,1,2,-1,-2,0,1,2,-1,-2]
for h in range(H):
  for w in range(W):
    if A[h][w]=='#':
      D[h][w]=10**5
from collections import deque
import sys
sys.setrecursionlimit(10**7) 
def bfs(y,x):
  q=deque()
  q.append((y,x))
  
  while len(q):
    y,x=q.popleft()
    cnt=0
    for i in range(4):
      ny=y+dy[i]
      nx=x+dx[i]
      if 0<=ny<H and 0<=nx<W:
        if A[ny][nx]=='.' and D[y][x]<D[ny][nx]:
          q.appendleft((ny,nx))
          D[ny][nx]=D[y][x]
          DD[ny][nx]=1

    for i in range(20):
      my=y+ey[i]
      mx=x+ex[i]
      if 0<=my<H and 0<=mx<W:
        if A[my][mx]=='.' and D[my][mx]==10**8 and DD[my][mx]==-1:
          q.append((my,mx))
          D[my][mx]=D[y][x]+1
            
D[Ch-1][Cw-1]=0
bfs(Ch-1,Cw-1)
if D[Dh-1][Dw-1]==10**8:
  print(-1)
else:
  print(D[Dh-1][Dw-1])
### BUGGY CODE ###

import math
from math import gcd,pi,sqrt
INF = float("inf")

import sys
sys.setrecursionlimit(10**6)
import itertools
from collections import Counter,deque
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]

def main():
    n, x, y = i_map()
    p = [[INF]*n for i in range(n)]
    for i in range(n-1):
        p[i][i] = 0
        p[i][i+1] = p[i+1][i] = 1
    p[-1][-1] = 0

    x -= 1
    y -= 1
    p[x][y] = p[y][x] = 1

    for k in range(n):
        for i in range(n):
            for j in range(n):
                p[i][j] = min(p[i][j], p[i][k] + p[k][j])
    p = list(itertools.chain.from_iterable(p))
    for i in range(1,n):
        ans = p.count(i) // 2
        print(ans)









if __name__=="__main__":
    main()


### FIXED CODE ###

import math
from math import gcd,pi,sqrt
INF = float("inf")

import sys
sys.setrecursionlimit(10**6)
import itertools
from collections import Counter,deque
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]

def main():
    n, x, y = i_map()
    ans = [0] * n

    for fr in range(1, n+1):
        for to in range(fr+1, n+1):
            cost = min(to - fr, abs(x-fr) + abs(to - y) + 1)
            ans[cost] += 1
    print(*ans[1:], sep="\n")

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

n,q = map(int, input().split())
s = input()
lr = []
for _ in range(q):
    l,r = map(int, input().split())
    lr.append((l,r))


for l,r in lr:
    total = 0
    aflag = False
    for i in range(l-1,r):
        c = s[i]
        if aflag:
            if c == 'C':
                total += 1
            aflag = False
        else:
            if c == 'A':
                aflag = True
    print(total)


### FIXED CODE ###

n,q = map(int, input().split())
s = input()
lr = []
for _ in range(q):
    l,r = map(int, input().split())
    lr.append((l,r))

x = [0] * len(s)
cur = 0
for i in range(len(s)-1):
    if s[i] == 'A' and s[i+1] == 'C':
        cur += 1
    x[i+1] = cur

#print(x)
for l,r in lr:
    print(x[r-1] - x[l-1])
### BUGGY CODE ###

while 1:
	n = input()
	if n == 0: break
	xy = [map(int,raw_input().split()) for i in range(n)]
	ans = 0
	for i in range(n):
		x1,y1 = xy[i]
		for j in range(n-1,i,-1):
			x2,y2 = xy[j]
			dx,dy = x2-x1,y2-y1
			if [x1-dy,y1-dx] in xy and [x2+dy,y2-dx] in xy:
				ans = max(ans,dx**2+dy**2)
			if [x1-dy,y1+dx] in xy and [x2-dy,y2+dx] in xy:
				ans = max(ans,dx**2+dy**2)
	print ans

### FIXED CODE ###

while 1:
	n = input()
	if n == 0: break
	xy = [map(int,raw_input().split()) for i in range(n)]
	S = set(map(tuple,xy))
	ans = 0
	for i in range(n-1):
		x1,y1 = xy[i]
		for j in range(i+1,n):
			x2,y2 = xy[j]
			a = (x2-y2+y1,y2+x2-x1)
			b = (x1-y2+y1,y1+x2-x1)
			if a in S and b in S:
				ans = max(ans,(x1-x2)**2 + (y1-y2)**2)
	print ans
### BUGGY CODE ###

n = int(input())
s = input()

ans = 0
for i in range(n//2,-1,-1):
    for j in range(n - i - i + 1):
        if s[j:j+i] in s[j+i:]:
            ans = i
            break
    if ans != 0:
        break
print(ans)


### FIXED CODE ###

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


r = 0
ans = 0
for l in range(N):

    while True:
        # print(S.rfind(S[l:r+1]), S[l:r+1], l, r)
        
        if S.rfind(S[l:r+1]) >= r+1:
            r += 1
            ans = max(ans, r-l)
        else:
            break

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

import sys
N,K,Q =map(int,input().split())
F = {}
A = []
for l in sys.stdin:
    A.append(int(l))
for i in range(N):
    cnt = A.count(i+1)
    F[str('A'+ str(i+1))] = K - (Q - cnt)
for i in range(N) :
    if F[str('A'+ str(i+1))] >= 1 :
        print("Yes")
    else:
        print("No")

### FIXED CODE ###

N,K,Q=map(int,input().split())
L=[K]*N
for i in range(Q):
    A=int(input())
    L[A-1] += 1

for i in L:
    if i - Q > 0 :
        print("Yes")
    else :
        print("No")
### BUGGY CODE ###

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

x = list()
if n<=b:
  for i in range(n+1):
    y = int(a*i/b) - a*int(i/b)
    x.append(y)
else:
  for i in range(b):
    y = int(a*i/b) - a*int(i/b)
    x.append(y)
x = sorted(x)
print(x[-1])

### FIXED CODE ###

a,b,n=map(int,input().split())
x=min(b-1,n)
print((a*x)//b-a*(x//b))
### BUGGY CODE ###

N, K = map(int, input().split())
ans = 0
judge = True

while judge == True:
    ans = N - K
    ans = abs(ans)
    N = ans

    ans = N - K
    ans = abs(ans)
    mem = ans
    if N > mem:
        pass
    else:
        judge = False


print(N)



### FIXED CODE ###

N, K = map(int, input().split())
a = abs(N%K)
print(min(a, abs(a-K)))
### BUGGY CODE ###

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

count=0
for i in range(q):
    l,r=[int(i)-1 for i in input().split()]
    for j in range(l,r):
        if s[j]=="A":
            if s[j+1]=="C":
                count+=1
    print(count)
    count=0

### FIXED CODE ###

import re
n,q=map(int,input().split())
s=input()

a=[0]*(n+1)
for i in range(1,n+1):
    # print(s[i-1:i+1])
    if s[i-1:i+1]=="AC":
        a[i]=a[i-1]+1
    else:
        a[i]=a[i-1]

for i in range(q):
    l,r=[int(i) for i in input().split()]
    print(a[r-1]-a[l-1])
### BUGGY CODE ###

N = int(input())
A = [int(_) for _ in input().split()]

A2 = [0] * (N + 1)

for i in range(1, N + 1):
    A2[i] = A2[i - 1] + A[i - 1]


def find(_l, _r):
    l, r = _l, _r
    lv, rv = A2[l - 1], A2[r]
    while l < r - 1:
        m = (r + l) // 2
        a = A2[m] - lv
        if a <= (rv - lv) / 2:
            l = m
        else:
            r = m
    if l < _r:
        if abs((A2[l] - lv) - (rv - A2[l])) > abs((A2[l + 1] - lv) - (rv - A2[l + 1])):
            return A2[l + 1] - lv, rv - A2[l + 1]
    return A2[l] - lv, rv - A2[l]


ans = 1e10
for i in range(2, N - 1):
    p, q = find(1, i)
    r, s = find(i + 1, N)
    # print(p, q, r, s)
    ans = min(ans, abs(max(p, q, r, s) - min(p, q, r, s)))
print(ans)


### FIXED CODE ###

N = int(input())
A = [int(_) for _ in input().split()]

A2 = [0] * (N + 1)

for i in range(1, N + 1):
    A2[i] = A2[i - 1] + A[i - 1]


def find(_l, _r):
    l, r = _l, _r
    lv, rv = A2[l - 1], A2[r]
    while l < r - 1:
        m = (r + l) // 2
        a = A2[m] - lv
        if a <= (rv - lv) / 2:
            l = m
        else:
            r = m
    if l < _r:
        if abs((A2[l] - lv) - (rv - A2[l])) > abs((A2[l + 1] - lv) - (rv - A2[l + 1])):
            return A2[l + 1] - lv, rv - A2[l + 1]
    return A2[l] - lv, rv - A2[l]


ans = 1e10
for i in range(2, N - 1):
    p, q = find(1, i)
    r, s = find(i + 1, N)
    # print(p, q, r, s)
    ans = min(ans, abs(max(p, q, r, s) - min(p, q, r, s)))
print(ans)
### BUGGY CODE ###

def main():
    K = int(input())

    lunlun_number_memo = {}

    def is_lunlun(str_n):
        while True:
            if lunlun_number_memo.get(str_n):
                return True
            elif len(str_n) == 1:
                return True
            else:
                if abs(int(str_n[0]) - int(str_n[1])) <= 1:
                    str_n = str_n[1:]
                else:
                    return False


    lunlun_number_count = 0
    i = 0
    while lunlun_number_count < K:
        i += 1
        if is_lunlun(str(i)):
            lunlun_number_memo[str(i)] = True
            lunlun_number_count += 1
            # print(i)
            # print(lunlun_number_count)
            # print("running")

    print(i)

if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys
import queue

def main():
    K = int(input())
    q = queue.Queue()
    for i in range(1, 10):
        q.put(i)

    i = 0
    while True:
        i += 1

        n = q.get()
        center_num = (10 * n) + (n % 10)
        
        if n % 10 != 0:
            q.put(center_num - 1)
        
        q.put(center_num)

        if n % 10 != 9:
            q.put(center_num + 1)

        if i >= K:
            # print(q.queue)
            print(n)
            sys.exit()

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

def light(y,x):
    global g
    if not g[y][x]:
        return 0
    else:
        x0,y0=x,y
        L,R,U,D=0,0,0,0
        while x>=1 and g[y][x-1]:
            L+=1
            x-=1
        x,y=x0,y0
        while x<=W-2 and g[y][x+1]:
            R+=1
            x+=1
        x,y=x0,y0
        while y>=1 and g[y-1][x]:
            U+=1
            y-=1
        x,y=x0,y0
        while y<=H-2 and g[y+1][x]:
            D+=1
            y+=1
        return 1+L+R+U+D
        
H,W=map(int,input().split())
g=[[True for j in range(W)] for i in range(H)] # 障害物がなければTrue
for i in range(H):
    S=input()
    for j in range(W):
        if S[j]=='#':
            g[i][j]=False

ans=0

for i in range(H):
    for j in range(W):
        if g[i][j]:
            ans=max(ans,light(i,j))
            
print(ans)

### FIXED CODE ###

H,W=map(int,input().split())
s=[]
for i in range(H):
    si=[]
    Si=input()
    for j in range(W):
        si.append(Si[j]=='.')
    s.append(si)

# 左に照らした場合 行ごとに見てゆく
L=[[0 for j in range(W)] for i in range(H)]
for i in range(H):
    for j in range(W):
        if j==0 and s[i][j]:
            L[i][j]=1
        elif s[i][j]:
            L[i][j]=L[i][j-1]+1

# 右に照らした場合 行ごとに見てゆく
R=[[0 for j in range(W)] for i in range(H)]
for i in range(H):
    for j in reversed(range(W)):
        if j==W-1 and s[i][j]:
            R[i][j]=1
        elif s[i][j]:
            R[i][j]=R[i][j+1]+1

# 上に照らした場合 列ごとに見てゆく
U=[[0 for j in range(W)] for i in range(H)]
for j in range(W):
    for i in range(H):
        if i==0 and s[i][j]:
            U[i][j]=1
        elif s[i][j]:
            U[i][j]=U[i-1][j]+1

# 下に照らした場合 列ごとに見てゆく
D=[[0 for j in range(W)] for i in range(H)]
for j in range(W):
    for i in reversed(range(H)):
        if i==H-1 and s[i][j]:
            D[i][j]=1
        elif s[i][j]:
            D[i][j]=D[i+1][j]+1

ans=0
for i in range(H):
    for j in range(W):
        ans=max(ans,L[i][j]+R[i][j]+U[i][j]+D[i][j]-3)

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

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

rlist, glist, blist = [], [], []
for i in range(N):
    if S[i] == "R":
        rlist.append(i)
    if S[i] == "G":
        glist.append(i)
    if S[i] == "B":
        blist.append(i)
#print(rlist)

rnumber = len(rlist)
gnumber = len(glist)
bnumber = len(blist)
total = rnumber * gnumber * bnumber
#print(total)

overcount = 0
for r in rlist:
    for g in glist:
        for b in blist:
            options = sorted([r,g,b])
            if options[0]+options[2] == 2*options[1]:
                overcount += 1
    
print(total - overcount)

### FIXED CODE ###

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

x = S.count("R")
y = S.count("G")

total = x*y*(N-x-y)

count = 0
for i in range(N):
    texta = S[i]
    for j in range(i,int((N-1+i)/2)+1):
        if S[j] != texta:
            textb = S[j]
            if S[2*j-i] != texta and S[2*j-i] !=textb:
                count += 1

print(total - count)
### BUGGY CODE ###

from collections import Counter
s=input()
m=len(s)
DP=[""]

for i in range(m):
    DP.append(DP[-1]+s[-(i+1)])

for i in range(1,len(DP)):
    DP[i]=int(DP[i][::-1])%2019
DP.append(0)
DP=Counter(DP)

ans=0
for v,m in DP.items():
    if m>=2:ans +=m*(m-1)//2
print(ans)

### FIXED CODE ###

from collections import Counter
s=input()[::-1]
DP=[0]

num,point=0,1
for i in s:
    num +=int(i)*point
    num %=2019
    DP.append(num)
    point *=10
    point %=2019

ans=0
DP=Counter(DP)
for v,m in DP.items():
    if m>=2:
        ans +=m*(m-1)//2
print(ans)
### BUGGY CODE ###

from fractions import Fraction
import sys
input = sys.stdin.readline
N=int(input())
mod=10**9+7
dic={}
c=0
d=0
e=0
for i in range(N):
 A,B = map(int,input().split())
 if A==0 and B==0:
  e+=1
 elif A==0:
  c+=1
 elif B==0:
  d+=1
 else:
   if Fraction(A,B) in dic:
    dic[Fraction(A,B)]+=1
   else:
    dic[Fraction(A,B)]=1
ans=1
for k in dic:
 if  -1/k in dic:
  ans*=(pow(2,dic[k],mod)+pow(2,dic[-1/k],mod) -1)
  ans%=mod
  dic[k]=0
  dic[-1/k]=0
 else:
  ans*=pow(2,dic[k],mod)
  ans%=mod
ans*=(pow(2,c,mod)+pow(2,d,mod)-1)
print((ans-1+e)%mod)

### FIXED CODE ###

from collections import defaultdict
from math import gcd
import sys
input = sys.stdin.readline
N=int(input())
mod=10**9+7
dic=defaultdict(lambda: [0,0])
c=0
d=0
e=0
for i in [0]*N:
 A,B = map(int,input().split())
 if A==0 and B==0:
  e+=1
 elif A==0:
  c+=1
 elif B==0:
  d+=1
 else:
  g=gcd(A,B)
  A//=g
  B//=g
  if A*B>0:
   dic[(abs(A),abs(B))][0]+=1
  else:
   dic[(abs(B),abs(A))][1]+=1
ans=1
for k in dic:
 ans=ans*(pow(2,dic[k][0],mod)+pow(2,dic[k][1],mod) -1)
ans=ans*(pow(2,c,mod)+pow(2,d,mod)-1)
print((ans-1+e)%mod)
### BUGGY CODE ###

import numpy as np
N = int(input())
alist = np.array(list(map(int, input().split())))


def f(m):
    return np.sum(np.mod(alist, m))


max_num = 0
for m in range(1, 10**5 + 1):
    num = f(m)
    if num > max_num:
        max_num = num

print(max_num - N)


### FIXED CODE ###

import numpy as np
N = int(input())
alist = np.array(list(map(int, input().split())))
print(np.sum(alist - 1))
### BUGGY CODE ###

from operator import itemgetter

N, M = map(int, input().split())
cards = sorted(list(map(int, input().split())))
candidates = [list(map(int, input().split())) for _ in range(M)]
candidates.sort(key=itemgetter(1), reverse=True)

for canditate in candidates:
    n_card = canditate[0]
    replace_value = canditate[1]
    if  replace_value  < cards[0]:
        break
        
    for i in range(n_card):
        if cards[i] < replace_value:
            cards[i] = replace_value
        else:
            break
    cards.sort()

print(sum(cards))

### FIXED CODE ###

from heapq import heapify, heappush, heappop
from operator import itemgetter

def main():
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    heapify(A)

    query = [list(map(int, input().split())) for _ in range(M)]
    query.sort(key=itemgetter(1), reverse=True)

    for b, c in query:
        for _ in range(b):
            m = heappop(A)
            if m >= c:
                heappush(A, m)
                break
            heappush(A, c)
        else:
            continue
        break
    
    print(sum(A))


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

from math import factorial


def c(n):
    if n < 2:
        return 0
    return factorial(n) // (factorial(n-2) * factorial(2))


def main():
    N = int(input())  # 文字列または整数(一変数)
    a = list(map(int, input().split()))  # 整数のリスト
    for i in range(N):
        a[i] -= 1

    nums = [0 for _ in range(N)]

    for i in a:
        nums[i] += 1

    b = [c(nums[i]) for i in range(N)]
    sum_b = sum(b)

    for i in range(N):
        print(sum_b - b[a[i]] + c(nums[a[i]] - 1))


if __name__ == '__main__':
    main()


### FIXED CODE ###


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

    # print(N)
    # print(A)
    d = {i:0 for i in range(1,N+1)}
    d2 = {}
    d3 = {}
    # print(d)
    # return


    for i in A:
        d[i] += 1

    # print(d)
    sum = 0
    for i in range(1,N+1):
        d2[i] = int(d[i] * (d[i]-1) / 2)
        sum += d2[i]

    # print(d2)

    for i in range(1, N+1):
        if d[i] == 0: d3[i] = 0
        else: d3[i] = int((d[i]-1) * (d[i]-2) / 2)

    # print(d3)


    for i in A:
        print(sum - d2[i] + d3[i])

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

import functools
import operator
N = int(input())
A = list(map(int,input().split()))
result = functools.reduce(operator.mul, A)
if result > 10 ** 18:
  print("-1")
else:
  print(result)

### FIXED CODE ###

def demon():
  N = int(input())
  A = list(map(int,input().split()))
  A.sort()
  if A[0] == 0:
    print(0)
    return

  X = 1
  for i in A:
    X *= i
    if X > 10 ** 18:
      print("-1")
      return

  print(X)

demon()
### BUGGY CODE ###

import math
N = int(input())


def calc(n):
    for x in range(1, math.ceil(math.sqrt(n))):
        if x ** 2 > n:
            return 0
        for y in range(1, x+1):
            if y ** 2 + x * y > n:
                break
            for z in range(1, y+1):
                ans = x ** 2 + y ** 2 + z ** 2 + x * y + y*z + z*x
                # print(x, y, z, ans)
                if ans == n:
                    set_num = len({x, y, z})
                    if set_num == 1:
                        return 1
                    elif set_num == 2:
                        return 3
                    else:
                        return 6
                if ans > n:
                    break
    return 0

# print(calc(17))
for n in range(1, N + 1):
    res = calc(n)
    print(res)


### FIXED CODE ###

import math
N = int(input())

res = [0 for i in range(10 ** 4)]
for x in range(1, math.ceil(math.sqrt(10 ** 4))):
    for y in range(1, math.ceil(math.sqrt(10 ** 4))):
        for z in range(1, math.ceil(math.sqrt(10 ** 4))):
            ans = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
            if ans <= 10 ** 4:
                res[ans - 1] += 1

for n in range(N):
    print(res[n])
### BUGGY CODE ###

import numpy as np
n = int(input())
aa = list(map(int, input().split()))
aa.sort()

from collections import Counter
dic = Counter(aa)
times = np.array(list(dic.keys()))[np.array(list(dic.values())) > 1]

oks = np.ones(len(aa))
for i in range(len(aa)):
    if i < len(aa)-1:
        if aa[i+1] == aa[i]:
            oks[i] = 0
    for j in range(i+1,len(aa)):
        if (aa[j]%aa[i] == 0):
            oks[j] = 0
print(int(oks.sum()))

### FIXED CODE ###

import numpy as np
from collections import Counter
n = int(input())
aa = list(map(int, input().split()))
ngs = np.zeros((10**6)+1, dtype=int)

for a in set(aa):
    ngs[2*a::a] = 1
    
dic = Counter(aa)
times = np.array(list(dic.keys()))[np.array(list(dic.values())) > 1]

for i in times:
    ngs[i] = 1
cnt = 0
for a in aa:
    cnt += 1-ngs[a]
print((cnt))
### BUGGY CODE ###

from __future__ import print_function
class Node:
    def __init__(self, id):
        self.id = id
        self.left = None
        self.right = None
        self.parent = None

def preorder_tree_walk(root):
    print('', root.id, end='')
    if root.left != None:
        preorder_tree_walk(root.left)
    if root.right != None:
        preorder_tree_walk(root.right)

def inorder_tree_walk(root):
    if root.left != None:
        inorder_tree_walk(root.left)
    print('', root.id, end='')
    if root.right != None:
        inorder_tree_walk(root.right)

def insert(root, z):
    y = None
    x = root
    while x != None:
        y = x
        if z.id < x.id:
            x = x.left
        else:
            x = x.right
    z.parent = y

    if y == None:
        root = z
    elif z.id < y.id:
        y.left = z
    else:
        y.right = z
    return root

n = int(raw_input())
root = None
for i in xrange(n):
    line = raw_input().split()
    if line[0] == 'insert':
        num = int(line[1])
        root = insert(root, Node(num))
    elif line[0] == 'print':
        inorder_tree_walk(root)
        print()
        preorder_tree_walk(root)
        print()

### FIXED CODE ###

from __future__ import print_function
from sys import stdin
class Node:
    def __init__(self, id):
        self.id = id
        self.left = None
        self.right = None
        self.parent = None

def preorder_tree_walk(root):
    print('', root.id, end='')
    if root.left != None:
        preorder_tree_walk(root.left)
    if root.right != None:
        preorder_tree_walk(root.right)

def inorder_tree_walk(root):
    if root.left != None:
        inorder_tree_walk(root.left)
    print('', root.id, end='')
    if root.right != None:
        inorder_tree_walk(root.right)

def insert(root, z):
    y = None
    x = root
    while isinstance(x, Node):
        y = x
        if z.id < x.id:
            x = x.left
        else:
            x = x.right
    z.parent = y

    if y == None:
        root = z
    elif z.id < y.id:
        y.left = z
    else:
        y.right = z
    return root

n = int(raw_input())
root = None
for i in xrange(n):
    cmd = stdin.readline()
    if cmd.startswith('i'):
        num = int(cmd[7:])
        root = insert(root, Node(num))
    else:
        inorder_tree_walk(root)
        print()
        preorder_tree_walk(root)
        print()