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

from bisect import bisect_left, bisect_right
a, b, q = map(int, input().split())
inf = 10**18
shrine = [-inf] + [int(input()) for _ in range(a)] + [inf]
temple = [-inf] + [int(input()) for _ in range(b)] + [inf]

for _ in range(q):
    ans = inf
    x = int(input())
    index_s = bisect_left(shrine, x)
    index_t = bisect_right(temple, x)
    for i in range(index_s-1, index_s+1):
        s = shrine[i]
        i_t = bisect_left(temple, s)
        t0, t1 = temple[i_t-1], temple[i_t]
        ans = min(
            ans,
            abs(x - s) + abs(s - t0),
            abs(x - s) + abs(s - t1),
        )

    for i in range(index_t-1, index_t+1):
        t = temple[i]
        i_s = bisect_left(shrine, t)
        s0 = shrine[i_s - 1]
        s1 = shrine[i_s]
        ans = min(
            ans,
            abs(x - t) + abs(t - s0),
            abs(x - t) + abs(t - s1),
        )

    print(ans)


### FIXED CODE ###

from bisect import bisect_left, bisect_right
a, b, q = map(int, input().split())
inf = 10**18
shrine = [-inf] + [int(input()) for _ in range(a)] + [inf]
temple = [-inf] + [int(input()) for _ in range(b)] + [inf]

for _ in range(q):
    ans = inf
    x = int(input())
    index_s = bisect_left(shrine, x)
    index_t = bisect_right(temple, x)
    for i in range(index_s-1, index_s+1):
        s = shrine[i]
        i_t = index_t
        t0, t1 = temple[i_t-1], temple[i_t]
        ans = min(
            ans,
            abs(x - s) + abs(s - t0),
            abs(x - s) + abs(s - t1),
        )

    for i in range(index_t-1, index_t+1):
        t = temple[i]
        i_s = index_s
        s0 = shrine[i_s - 1]
        s1 = shrine[i_s]
        ans = min(
            ans,
            abs(x - t) + abs(t - s0),
            abs(x - t) + abs(t - s1),
        )

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

#%%
inf = 10**9 + 7
import numpy as np

n = int(input())
a = list(map(int, input().split()))
count = np.array([0] * 70)
for i in range(n):
    tmp = np.array(list(map(int, (bin(a[i])[2:].zfill(70)))))
    count[tmp==1] += 1


ans = 0
for i in range(70):
    k = 2 ** (69 - i)
    k %= inf
    x = count[i] % inf
    y = (n - x) % inf
    ans += (x * y * k) % inf
    ans %= inf

ans %= inf
print(ans)


# %%


### FIXED CODE ###

#%%
inf = 10**9 + 7

n = int(input())
a = list(map(int, input().split()))
count = [0] * 70
for i in range(n):
    tmp = list(str(bin(a[i])[2:]))[::-1]
    #print(tmp)
    for j in range(len(tmp)):
        if tmp[j] == '1':
            k = 69 - j
            count[k] += 1

#print(count)

ans = 0
for i in range(70):
    k = 2 ** (69 - i)
    k %= inf
    x = count[i] % inf
    y = (n - x) % inf
    ans += (x * y * k) % inf
    ans %= inf

ans %= inf
print(ans)



# %%
### BUGGY CODE ###

from scipy.misc import comb
n = int(input())
a = [int(x) for x in input().split()]
ans = 0
for i in range(len(a)):
  a_ = a.copy()
  a_.pop(i)
  A = list(set(a_))
  ans = 0
  for j in A:
    ans += comb(a_.count(j), 2, exact=True)

  print(ans)




### FIXED CODE ###

n = int(input())
a = [int(x) for x in input().split()]
from collections import defaultdict
d = defaultdict(int)
for i in a:
  d[i] += 1

total = 0
for i in set(a):
  x = d[i]
  total += x*(x-1)/2

for i in a:
  x = d[i]
  print(int(total-((x*(x-1)/2))+((x-1)*(x-2)/2)))
### BUGGY CODE ###

ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

h,w = nm()

s = []

for y in range(h):
  s.append([_ for _ in input()])



def bfs(sx,sy,gx,gy,route):
  xx=[1,-1,0,0]
  yy=[0,0,1,-1]
  
  if sx == gx and sy == gy:
    return 0
  
  mn = 9999
  for i in range(4):
    nx = sx + xx[i]
    ny = sy + yy[i]
    
    if 0 <= nx < w and 0 <= ny < h:
      if s[ny][nx] == '.':
        if (nx,ny) not in route:
          mn = min(mn,bfs(nx,ny,gx,gy,route+[(nx,ny)]))
  return mn+1

mx = 0

for sx in range(w):
  for sy in range(h):
    for gx in range(w):
      for gy in range(h):
        if s[sy][sx] == '.' and s[gy][gx] == '.':
          b = bfs(sx,sy,gx,gy,[])
          if b < h*w:
            mx = max(mx,b)

print(mx)


  
  
  

### FIXED CODE ###

ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

from collections import deque

h,w = nm()

s = []

for y in range(h):
  s.append([_ for _ in input()])



def bfs(sx,sy,visited):
  xx=[1,-1,0,0]
  yy=[0,0,1,-1]
  
  q=deque([(sx,sy)])
  visited[sy][sx] = 0

  while q:
    _ = q.popleft()
    x=_[0]
    y=_[1]

    for i in range(4):
      nx = x + xx[i]
      ny = y + yy[i]
      
      if 0 <= nx < w and 0 <= ny < h:
        if s[ny][nx] == '.' and visited[ny][nx]==-1:
          visited[ny][nx] = visited[y][x]+1
          q.append((nx,ny))
  mx=0
  for y in range(h):
    for x in range(w):
      mx = max(mx,visited[y][x])
  return mx

MX = 0

for sx in range(w):
  for sy in range(h):
    if s[sy][sx] == '.':
      b = bfs(sx,sy,[[-1]*w for _ in range(h)])
      MX = max(MX,b)

print(MX)
### BUGGY CODE ###

ABCK = [int(x) for x in input().split()]
A=ABCK[0]
B=ABCK[1]
C=ABCK[2]
K=ABCK[3]

n=0

while A>0 and K>0:
  n+=1
  K-=1
  A-=1
  
while B>0 and K>0:
  K-=1
  B-=1
  
while C>0 and K>0:
  n-=1
  C-=1
  K-=1
  
print(n)

### FIXED CODE ###

ABCK = [int(x) for x in input().split()]
A=ABCK[0]
B=ABCK[1]
C=ABCK[2]
K=ABCK[3]

n=0

if K<=A:
  n=K
elif K<=A+B:
  n=A
elif K<=A+B+C:
  n=A-(K-A-B)
  
print(n)
### BUGGY CODE ###

from bisect import insort_left, bisect_left
from collections import defaultdict

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

N_IDX = defaultdict(int)
for idx,a in enumerate(A):
    N_IDX[a] = idx

ans = 0
T = [-1, N]
for n in range(1, N + 1):
    insort_left(T, N_IDX[n])
    idx = bisect_left(T, N_IDX[n])
    ans += (T[idx] - T[idx-1]) * (T[idx+1] - T[idx]) * n

print(ans)

### FIXED CODE ###

import bisect
from collections import defaultdict
class SqrtSet:
    def __init__(self, block_limit=201):
        self.key = []
        self.child = [[]]
        self.block_limit = block_limit
 
    def search_lower(self, key):
        if key is None:
            return None
        ret = None
        i = bisect.bisect_left(self.key, key)
        if i != 0:
            ret = self.key[i - 1]
        block = self.child[i]
        i = bisect.bisect_left(block, key)
        if i != 0:
            ret = block[i - 1]
        return ret
        
    def search_higher(self, key):
        if key is None:
            return None
        ret = None
        i = bisect.bisect_right(self.key, key)
        if i != len(self.key):
            ret = self.key[i]
        block = self.child[i]
        i = bisect.bisect_right(block, key)
        if i != len(block):
            ret = block[i]
        return ret
 
    def insert(self, key):
        i = bisect.bisect(self.key, key)
        block = self.child[i]
        bisect.insort(block, key)
        if len(block) == self.block_limit:
            sep = self.block_limit // 2
            self.key.insert(i, block[sep])
            self.child.insert(i + 1, block[sep + 1:])
            self.child[i] = block[:sep]

def main():
    N = int(input())
    A = [int(i) for i in input().split()]

    # IDX[n] <-> A.index(n)
    IDX = defaultdict(int)
    for idx,a in enumerate(A):
        IDX[a] = idx

    SS = SqrtSet()
    SS.insert(-1)
    SS.insert(N)

    ans = 0
    for n in range(1, N + 1):
        H = SS.search_higher(IDX[n])
        L = SS.search_lower(IDX[n])
        ans += (IDX[n] - L) * (H - IDX[n]) *  n
        SS.insert(IDX[n])

    print(ans)

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

#import numpy as np
#import random
#import time
from collections import defaultdict, Counter

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

def main():
    #N = 20
    #A = [random.randint(1, int(1e6)) for _ in range(int(N))]
    N = int(input())
    A = [int(c) for c in input().split(' ')]
    #t1 = time.time()
    dup_cnt = Counter(A)
    dup = set(x for x in dup_cnt if dup_cnt[x] > 1)
    A_set = set(A)
    if 1 in A_set:
        if 1 in dup:
            print('0')
        else:
            print('1')
        exit()
    A = list(A_set)
    for t in (2,3,5,7):
        if t in A_set:
            A = [x for x in A if x%t != 0 or x==t]
    N = len(A)
    A.sort()
#    B = [factorization(x) for x in A]
#    B.sort()

    d = defaultdict(list)
    B = []
    for x in A:
        x_fac = factorization(x)
        B.append(x_fac)
        for y in x_fac:
            d[y[0]].append(x)
    assert len(A)==len(B)
    #print(A)
    #print(B)
    #print(d)
    not_divided = set()
    for i in range(N):
        bi = A[i]
        bi_fac = B[i]
        can_divide = False
        for y in bi_fac:
            for a in d[y[0]]:
                if bi % a == 0 and bi != a:
                    #print(a,bi)
                    can_divide = True
                    break
                elif a > bi:
                    break
            if can_divide:
                break
        if can_divide or bi in dup:
            continue
        else:
            not_divided.add(bi)
    #print(A)
    #print(dup)
    #print(not_divided)
    print(len(not_divided))
    #print(time.time() - t1)


if __name__ == "__main__":
    main()

### FIXED CODE ###

#import random
#import time
from collections import defaultdict, Counter

def main():
    #N = 20
    #A = [random.randint(1, int(1e6)) for _ in range(int(N))]
    N = int(input())
    A = [int(c) for c in input().split(' ')]
    #t1 = time.time()
    dup_cnt = Counter(A)
    dup = set(x for x in dup_cnt if dup_cnt[x] > 1)
    A_set = set(A)
    A = list(A_set)
    A.sort()
    N = len(A)
    max_A = A[-1]
    prime = [True]*(max_A+1)
    ans = 0
    for x in A:
        if not prime[x]:
            continue
        else:
            for y in range(2*x, max_A+1, x):
                prime[y] = False
            if not x in dup:
                ans += 1
    print(ans)


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

#B
def unti():
    N = int(input())
    A = list(map(int, input().split()))
    result = 1
    if 0 in A:
        print(0)
        return
    for a in A:
        if 0 in A:
            print(0)
            break
        result *= a
    if result >10**18:
        print(-1)
    else:
        print(result)

unti()

### FIXED CODE ###

#B
def main ():
    N = int(input())
    A = list(map(int,input(). split ()))
    if 0 in A:
        print(0)
        return
    prod = 1
    for a in A:
        prod *= a
        if prod > 1000000000000000000:
            print(-1)
            return
    print(prod)
main ()
### BUGGY CODE ###

num = int(input())

num_list = []
count_list = []

for i in range(0,num):
  num_list.append(input())

num_set = list(set(num_list))

for i in range(0,len(num_set)):
  count_list.append(num_list.count(num_set[i]))

ans = []
max = 0

for i in range(0,len(num_set)):
  temp = count_list[i]
  
  if temp == max:
    ans.append(num_set[i])
  
  if temp > max:
    max = temp
    ans = []
    ans.append(num_set[i])
ans.sort()

for i in range(0,len(ans)):
  print(ans[i])

### FIXED CODE ###

import collections

num = int(input())

num_list = []
count_list = []
ans = []

for i in range(0,num):
  num_list.append(input())

num_list_2 =collections.Counter(num_list).most_common()

for i in range(0,len(num_list_2)):
  if num_list_2[0][1] > num_list_2[i][1]:
    break
  
  ans.append(num_list_2[i][0])

ans.sort()

for i in range(0,len(ans)):
  print(ans[i])
### BUGGY CODE ###

import bisect
n, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
for i in range(m):
    tmp_max = a.pop()
    bisect.insort(a, tmp_max // 2)
print(sum(a))

### FIXED CODE ###

import heapq
n, m = map(int, input().split())
a = list(map(int, input().split()))
a = list(map(lambda x: x * (-1), a))
heapq.heapify(a)
for _ in range(m):
    min = ((heapq.heappop(a) * (-1)) // 2) * (-1)
    heapq.heappush(a, min)
print(sum(a)*(-1))
### BUGGY CODE ###

"""
--- アルゴリズム概要 ---
前計算で頂点Kから各ノードへの最短路を記録しておき、
各クエリに対しては、dp[a]+dp[b]を返せばよい。

頂点Kから各ノードへの最短ルートはdfsとかで記録していけばよい。
"""
import sys
sys.setrecursionlimit(2000000)
input = sys.stdin.readline
N = int(input())
AB = [{}for _ in range(N+1)]
for i in range(N-1):
    a,b,c = map(int,input().split())
    AB[a][b] = c
    AB[b][a] = c

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

path = {K:""}
dp = [0]*(N+1)
def dfs(n,cost):
    path[n]=""
    dp[n]=cost
    for i,c in AB[n].items():
        if i not in path:
            dfs(i,cost+c)
dfs(K,0)
for i in range(Q):
    x,y=map(int,input().split())
    print(dp[x]+dp[y])

### FIXED CODE ###

"""
--- アルゴリズム概要 ---
前計算で頂点Kから各ノードへの最短路を記録しておき、
各クエリに対しては、dp[a]+dp[b]を返せばよい。

頂点Kから各ノードへの最短ルートはdfsとかで記録していけばよい。
"""
def main():
    from collections import deque
    import sys
    sys.setrecursionlimit(20000000)
    input = sys.stdin.readline
    N = int(input())
    AB = [[]for _ in range(N+1)]
    for i in range(N-1):
        a,b,c = map(int,input().split())
        AB[a].append((b,c))
        AB[b].append((a,c))

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

    path = {K:""}
    dp = [0]*(N+1)
    que = deque()
    for n,c in AB[K]:
        que.append((n,c))
    while que:
        now,cost = que.pop()
        path[now]=""
        dp[now]=cost
        for n,c in AB[now]:
            if n not in path:
                que.append((n,cost+c))
    for i in range(Q):
        x,y=map(int,input().split())
        print(dp[x]+dp[y])
main()
### BUGGY CODE ###

n,k=map(int,input().split())
p=list(map(int,input().split()))
maxy=0
for i in range(n-k+1):
  temp=0
  for q in range(k):
    temp+=p[i+q]
  
  if temp>maxy:
    maxy=temp
    
print((maxy+k)/2)
  



### FIXED CODE ###

n,k= map(int, input().split())
p = list(map(int, input().split()))
ans = sum(p[:k])
q = [ans]
for i in range(k,n):
  ans = ans+p[i]-p[i-k]
  q.append(ans)
print((max(q)+k)/2)
### BUGGY CODE ###

import collections
from sys import stdin


def get_result(data):
    S = data[0]
    mod_all_bit = [0]
    for i in range(len(S)):
        mod_all_bit.append(int(S[-(i+1):]) % 2019)
    c = collections.Counter(mod_all_bit)
    ans = 0
    for key, val in c.items():
        if val >= 2:
            ans += int(val * (val-1) * 0.5)
    return ans


if __name__ == '__main__':
    data = list(map(str, stdin.readline().rstrip().split(' ')))
    result = get_result(data)
    print(result)


### FIXED CODE ###

from sys import stdin


def get_result(data):
    S = data[0]
    mod_all_bit = [0] * 2019
    mod_all_bit[0] = 1
    # 10**i の mod を漸化式的に事前計算
    # こうすることで計算が効率化できる
    ten_i_mod = [0] * len(S)
    ten_i_mod[0] = 1
    for i in range(len(S)-1):
        ten_i_mod[i+1] = (ten_i_mod[i] * 10) % 2019
    mod = 0
    for i in range(len(S)):
        mod = (mod + ten_i_mod[i] * int(S[-(i+1)])) % 2019
        mod_all_bit[mod] += 1
    ans = 0
    for val in mod_all_bit:
        if val >= 2:
            ans += val * (val-1) * 0.5
    return int(ans)


if __name__ == '__main__':
    data = list(map(str, stdin.readline().rstrip().split(' ')))
    result = get_result(data)
    print(result)
### BUGGY CODE ###

n=int(input())
strl=[input() for i in range(n)]
"""
def anagram(sa,sb) :
  flag=True
  sal=list(sa)
  sbl=list(sb)
  sal.sort()
  sbl.sort()
  if sal==sbl:
    return True
  else :
    return False
  
  for i in range(10) :
    if sal[i] in sbl :
      sbl.remove(sal[i])
    else :
      flag=False
      break

  """
  #return flag
   
#print(anagram("peanutbomb","constraint"))    
count=0
for i in range(n) :
  jl=list(range(i+1,n))
  for j in jl :
    flag=True
    sal=list(strl[i])
    sbl=list(strl[j])
    sal.sort()
    sbl.sort()
    if sal==sbl:
      count+=1
print(count)

### FIXED CODE ###

#import numpy as np
n=int(input())
strl=[list(input()) for i in range(n)]

count=0
pt={}
#il=np.arange(n)
for i in range(n) :
  sal=strl[i]
  sal.sort()
  temp="".join(sal)
  if temp in pt.keys() :
    #ptがある
    tempc=pt[temp]
    count+=tempc
    pt[temp]=tempc+1
  else :
    pt[temp]=1
print(count)
#print(count)
### BUGGY CODE ###

import sys
import math
import heapq
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y): return pow(x, y, DVSR)
def INV(x, m=DVSR): return pow(x, m - 2, m)
def DIV(x, y, m=DVSR): return (x * INV(y, m)) % m
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def FLIST(n):
    res = [1]
    for i in range(1, n+1): res.append(res[i-1]*i%DVSR)
    return res

K=II()
S=input()
L=len(S)
FACT=FLIST(K+L)
def NCR(n, r):
    res = FACT[n-r]
    res *= FACT[r]
    res %= DVSR
    res = INV(res)
    res *= FACT[n]
    res %= DVSR
    return res

ans = 0
for i in range(K+1):
    v = NCR(L+K-i-1, L-1)
    v *= POW(25, K-i)
    v %= DVSR
    v *= POW(26, i)
    v %= DVSR
    ans += v

print(ans % DVSR)


### FIXED CODE ###

import sys
import math
import heapq
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y): return pow(x, y, DVSR)
def INV(x, m=DVSR): return pow(x, m - 2, m)
def DIV(x, y, m=DVSR): return (x * INV(y, m)) % m
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def FLIST(n):
    res = [1]
    for i in range(1, n+1): res.append(res[i-1]*i%DVSR)
    return res

K=II()
S=input()
L=len(S)
FACT=FLIST(K+L)
def NCR(n, r):
    res = FACT[n-r]
    res *= FACT[r]
    res %= DVSR
    res = INV(res)
    res *= FACT[n]
    res %= DVSR
    return res

ans = 0
for i in range(K+1):
    v = NCR(L+K-i-1, L-1)
    v *= POW(25, K-i)
    v %= DVSR
    v *= POW(26, i)
    v %= DVSR
    ans += v

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

N,M=map(int,input().split(' '))
sum_=[0]*N
for i in range(M):
  LR=list(map(int,input().split(' ')))
  for j in range(LR[0]-1,LR[1]):
    sum_[j]+=1

from collections import Counter
c=Counter(sum_)
print(c[M])


### FIXED CODE ###

import numpy as np
N,M=map(int,input().split(' '))
LR=[list(map(int,input().split(' '))) for i in range(M)]
LR=np.array(LR)

if min(LR[:,1])-max(LR[:,0])+1>0:
  print(min(LR[:,1])-max(LR[:,0])+1)
else:
  print(0)
### BUGGY CODE ###

s = input()
t = input()
s_len = len(s)
t_len = len(t)
s_list = [s[i] for i in range(s_len)]
num = 0
str_num = 0
for i in range(t_len):
  try:
    num = s_list.index(t[i])
    str_num += num+1
    s_list = s_list[num+1:] + s_list[:num+1]
  except:
    str_num = -1
    break
print(str_num) 

### FIXED CODE ###

from collections import defaultdict
from bisect import bisect_left
 
s = input()
t = input()
s_len = len(s)
t_len = len(t)
if not set(t) <= set(s):
  print(-1)
else: 
  idx = defaultdict(list)
  for i in range(s_len):
    idx[s[i]].append(i)
  
  loop_num = 0
  current_position = -1
  for i in range(t_len):
    char = t[i]
    tmp_idx = idx[char]
    n = bisect_left(tmp_idx, current_position+1)
    if n < len(tmp_idx):
      current_position = tmp_idx[n]
    else:
      current_position = tmp_idx[0]
      loop_num += 1
  print(s_len * loop_num + current_position + 1)
### BUGGY CODE ###

n = int(input())
a = [0 for i in range(22369621)]
for i in range(n):
    s = input().split(" ")
    num = 0
    p = 1
    for j in range(len(s[1])):
        if s[1][j] == "A":
            num += p * 1
        elif s[1][j] == "C":
            num += p * 2
        elif s[1][j] == "G":
            num += p * 3
        else:
            num += p * 4
        p *= 4
    if s[0] == "insert":
        a[num] = 1
    else:
        if a[num] == 1:
            print("yes")
        else:
            print("no")

### FIXED CODE ###

n = int(input())
dic = set()
for i in range(n):
    Cmd, Key = input().split(" ")
    if Cmd == "insert":
	    dic.add(Key)
    else:
        if Key in dic:
	        print("yes")
        else:
            print("no")
### BUGGY CODE ###

N=int(input())
S=[str(i) for i in input()]
l=[]
for i in range(10):
  for j in range(10):
    for k in range(10):
      l.append(str(i)+str(j)+str(k))

ans=0
for i in range(len(l)):
  now=l[i]
  j=0
  s=0
  while(True):
    if S[s]==now[j]:
      s+=1
      j+=1
    else:
      s+=1

    if j==3:
      ans+=1
      break

    if N<=s:
      break
      
print(ans)

### FIXED CODE ###

N=int(input())
S=input()
ans=0

for i in range(10):
  x=S.find(str(i),0)
  if x!=-1:
    for j in range(10):
      y=S.find(str(j),x+1)
      if y!=-1:
        for k in range(10):
          z=S.find(str(k),y+1)
          if z!=-1:
            ans+=1

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

N = int(input())
*A, = map(int, input().split())
A = sorted(A)
checked = [True] * N
ans = 0
for i, a in enumerate(A):
    if not checked[i]: continue
    flag = True
    for j in range(i+1, N):
        if A[j] % a == 0:
            checked[j] = False
            if A[j] == a: flag = False
    if flag: 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 = map(int,input().split())
ls = list(map(int,input().split()))
dir = [list(map(int,input().split())) for _ in range(m)]
k = 0
for i in range(1,n+1):
    new = [e for e in dir if i in e]
    if new == []:
        k += 1
    else:
        for j in range(len(new)):
            if new[j][0] != i:
                (new[j][0],new[j][1]) = (new[j][1],new[j][0])
            if ls[new[j][0]-1]<=ls[new[j][1]-1]:
                break
        else:
            k += 1
        p = 0
print(k)
                


### FIXED CODE ###

n,m = map(int,input().split())
ls = list(map(int,input().split()))
pos = [1]*(n)
for i in range(m):
    a,b = map(int,input().split())
    if ls[a-1] > ls[b-1]:
        pos[b-1] = 0
    elif ls[a-1] < ls[b-1]:
        pos[a-1] = 0
    else:
        pos[a-1] = 0
        pos[b-1] = 0
print(sum(pos))
### BUGGY CODE ###

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

max = num = int(a*n/b) - a * int(n/b)

for x in range(0, n+1, b):
    num = int(a*(x-1)/b) - a * int((x-1)/b)
    if num > max:
        max = num

print(max)


### FIXED CODE ###

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

if n<b:
    print(((a*n)//b) - a * (n//b))
else:
    print(((a*(b-1))//b) - a * ((b-1)//b))
### BUGGY CODE ###

H,N = map(int, input().split())
dp_ = [0]+[float("inf")]*H
for n in range(N):
  A,B = map(int, input().split())
  dp = [0]*(H+1)
  for h in range(1,H+1): dp[h] = min(dp_[h], dp[max(0,h-A)]+B)
  dp_ = dp
print(dp[-1])

### FIXED CODE ###

H,N,*AB = map(int, open(0).read().split())
dp = [0]+[10**8]*H
for n in range(N):
  A,B = AB[2*n:2*(n+1)]
  for h in range(1,H+1): dp[h] = min(dp[h],dp[max(0,h-A)]+B)
print(dp[-1])
### BUGGY CODE ###

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

list=list(S)

kei=[]
for a in range(N-2):
    for b in range(a+1,N-1):
        if b<=a:
            break
        for c in range(b+1,N):
            if c<=b:
                break
            #print(a,b,c)
            retsu=''
            retsu=retsu+list[a]+list[b]+list[c]
            kei.append(retsu)
last=set(kei)
print(len(last))


### FIXED CODE ###

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

list=list(S)

count=0
for a in range(10):
    find1=S.find(str(a))
    if find1==-1:
        continue
    for b in range(10):
        find2=S[find1+1:].find(str(b))
        if find2==-1:
            continue
        for c in range(10):
            find3=S[find1+1+find2+1:].find(str(c))
            if find3==-1:
                continue
            count+=1
print(count)