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

n = int(input())
li = [[],[]]
for _ in range(n):
  si = str(input())
  di = {}
  for i in range(10):
    if si[i] in di.keys():
      di[si[i]] += 1
    else:
      di[si[i]] = 1
  frag = True
  for j,st in enumerate(li[0]):
    if di == st:
      li[1][j] += 1
      frag = False
  if frag:
    li[0].append(di)
    li[1].append(1)
sm = 0
for j in li[1]:
  sm += j*(j-1)//2
print(sm)

### FIXED CODE ###

n = int(input())
dic = {}
for _ in range(n):
  si = str(input())
  li = [si[i] for i in range(10)]
  li.sort()
  moji = "".join(li)
  if moji in dic.keys():
    dic[moji] += 1
  else:
    dic[moji] = 1
sm = 0
for j in dic.values():
  sm += j*(j-1)//2
print(sm)
### BUGGY CODE ###

n,k=map(int,input().split())
l=list(map(int,input().split()))
m=0
 
for i in range(k,n+1):
  p = sum(l[i-k:i])
  if m < p:
    m = p
    
print((m+k)/2)

### FIXED CODE ###

n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
s = sum(p[:k])
m = s

for i in range(n-k):
  s = s-p[i]+p[i+k]
  if m < s:
    m = s
print((m+k)/2)
### BUGGY CODE ###

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

for i in range(1, n + 1):
    print(a.count(i))


### FIXED CODE ###

from collections import Counter

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

c = Counter(a)

for i in range(1, n + 1):
    if i in c:
        print(c[i])
    else:
        print(0)
### BUGGY CODE ###

N,Q = map(int,input().split())
S = list(input())
s = []
for i in range(Q):
    l,r = map(int,input().split())
    #c = 0
    #print(Q,i)
    s.append(0)
    #print(s)
    for j in range(l-1,r-1):
        #print(i,j)
        if S[j] == "A" and S[j+1] == "C":
            s[i] += 1
        #if c == 0 and S[j] == "A":
         #   c = 1
            #print("a")
        #elif c == 1 and S[j] == "C":
         #   c = 0
          #  s[i] = s[i]+ 1
            #print("b")
    #print(i)
for i in range(Q):
    print(s[i])

### FIXED CODE ###

N, Q = map(int,input().split())
S = input()
a =[0] * N
for i in range(N-1):
    if S[i] == "A" and S[i + 1] == "C":
        a[i + 1] = a[i] + 1
    else:
        a[i + 1] = a[i]
l, r = 0, 0
b = [0] * Q
for i in range(Q):
    l, r = map(int, input().split())
    b[i] = a[r-1] - a[l-1]
for i in range(Q):
    print(b[i])
### BUGGY CODE ###

S = input().rstrip()
Q = int(input())

flag = 0 #0:そのまま 1:反転
for _ in range(Q):
  elem = input().rstrip()
  if len(elem) == 1:
    flag ^= 1
  else:
    s = int(elem[2])
    if s == 1 and flag == 0:
      S = elem[4] + S
    elif s == 2 and flag == 0:
      S = S + elem[4]
    elif s == 1 and flag == 1:
      S = S + elem[4]
    else:
      S = elem[4] + S

if flag == 1:
  S = S[::-1]
print(S)

### FIXED CODE ###

import sys
input = sys.stdin.readline
from collections import deque

S = input().rstrip()
S = deque(S)
Q = int(input())
Que = (input().rstrip() for _ in range(Q))

flag = 0 #0:そのまま 1:反転
for elem in Que:
  if elem[0] == '1':
    flag ^= 1
  else:
    s = int(elem[2])
    if s == 1 and flag == 0:
      S.appendleft(elem[4])
    elif s == 2 and flag == 0:
      S.append(elem[4])
    elif s == 1 and flag == 1:
      S.append(elem[4])
    else:
      S.appendleft(elem[4])

if flag == 1:
  S.reverse()
print(''.join(S))
### BUGGY CODE ###

N = int(input())
cont = []
res = 0
for A in range(1, N + 1):
    if N % A == 0:
        B = int(N / A)
        if len(str(A)) <= len(str(B)):
            res = len(str(B))
        elif len(str(A)) >= len(str(B)):
            res = len(str(A))
        cont.append(res)
    else:
        continue
print(min(cont))

### FIXED CODE ###

def make_divisors(n):
    divisors = []
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n // i)

    # divisors.sort()
    return divisors


N = int(input())
r = make_divisors(N)
res = []
for i in r:
    y = N // i
    res.append(max(len(str(y)), len(str(i))))
print(min(res))
### BUGGY CODE ###

N = int(input())
s = [input() for i in range(N)]
S = [[0]*len(s[i]) for i in range(N)]
for i, x in enumerate(s):
    res = []
    q = 0
    for j in range(len(x)):
        if x[j] == ')':
            S[i][j] = -1
        else:
            S[i][j] = 1
s = [0]*N
m = [len(S[i]) for i in range(N)]
for i, x in enumerate(S):
    tmp = 0
    for j in range(len(x)):
        tmp += S[i][j]
        m[i] = min(tmp, m[i])
    s[i] = tmp

if sum(s) == 0:
    sp = [(m[i], s[i]) for i in range(N) if s[i] > 0]
    mp = [(-(s[i]-m[i]), -s[i]) for i in range(N) if s[i] <= 0]#右から見た場合
    sp.sort(key=lambda x: x[0], reverse=True)
    tmp = 0
    for x, y in sp:
        if tmp + x < 0:
            print("No")
            exit(0)
        tmp += y
    mp.sort(key=lambda x: x[0], reverse=True)
    tmp2 = 0
    for x, y in mp:
        if tmp2 + x < 0:
            print("No")
            exit(0)
        tmp2 += y
    print("Yes")

else:
    print("No")


### FIXED CODE ###

N = int(input())
s = [input() for i in range(N)]
S = [[0]*len(s[i]) for i in range(N)]
for i, x in enumerate(s):
    res = []
    q = 0
    for j in range(len(x)):
        if x[j] == ')':
            S[i][j] = -1
        else:
            S[i][j] = 1
s = [0]*N
m = [len(S[i]) for i in range(N)]
for i, x in enumerate(S):
    tmp = 0
    for j in range(len(x)):
        tmp += S[i][j]
        m[i] = min(tmp, m[i])
    s[i] = tmp

if sum(s) == 0:
    sp = [(m[i], s[i]) for i in range(N) if s[i] > 0]
    mp = [(-(s[i]-m[i]), -s[i]) for i in range(N) if s[i] <= 0]#右から見た場合
    sp.sort(key=lambda x: x[0], reverse=True)
    tmp = 0
    for x, y in sp:
        if tmp + x < 0:
            print("No")
            exit(0)
        tmp += y
    mp.sort(key=lambda x: x[0], reverse=True)
    tmp2 = 0
    for x, y in mp:
        if tmp2 + x < 0:
            print("No")
            exit(0)
        tmp2 += y
    print("Yes")

else:
    print("No")
### BUGGY CODE ###

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

dp = [None] * N
for n in range(N):
    if n == 0:
        min_num = 0
    else:
        l = min(n, K)
        min_num = 10 ** 10
        for k in range(1, l + 1):
            min_num = min(abs(A[n] - A[n - k]) + dp[n - k], min_num)
    dp[n] = min_num

print(dp[-1])

### FIXED CODE ###

import sys

N, K = map(int, sys.stdin.readline().split())
A = list(map(int, sys.stdin.readline().split()))

dp = [0] + [None] * (N - 1)
for n, a in enumerate(A):
    if n:
        l = max(0, n - K)
        dp[n] = min(abs(a - a2) + d for a2, d in zip(A[l : n], dp[l : n]))

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

import numpy as np

def dp(v, d, c):
    if memo[v-1][d] is not None:
        return

    memo[v-1][d] = True
    if d == 0:
        res[v-1] = c
        return None

    dp(v, d-1, c)
    for e in dic[v-1]:
        dp(e, d-1, c)


N, M = tuple(map(int, input().split(' ')))

dic = [[] for _ in range(N)]
memo = [[None]*11 for _ in range(N)]

for m in range(M):
    a, b = tuple(map(int, input().split(' ')))
    dic[a-1].append(b)
    dic[b-1].append(a)

Q = int(input())

vdc = [None]*Q

for q in range(Q):
    vdc[q] = tuple(map(int, input().split(' ')))

res = np.zeros(N)

for q in range(Q-1, -1, -1):
    v, d, c = vdc[q]
    dp(v, d, c)


for i in range(N):
    print(int(res[i]))


### FIXED CODE ###

import numpy as np

def dp(v, d, c):
    if memo[v-1][d]:
        return

    memo[v-1][d] = True
    if d == 0:
        res[v-1] = str(c)
        return

    dp(v, d-1, c)
    for e in dic[v-1]:
        dp(e, d-1, c)


N, M = [int(e) for e in input().split(' ')]

dic = [[] for _ in range(N)]
memo = [[False]*11 for _ in range(N)]

for m in range(M):
    a, b = [int(e) for e in input().split(' ')]
    dic[a-1].append(b)
    dic[b-1].append(a)

Q = int(input())


vdc = [[int(e) for e in input().split(' ')] for _ in range(Q)]

res = ['0']*N

[dp(v, d, c) for v, d, c in vdc[::-1]]


print('\n'.join(res))
### BUGGY CODE ###

N = int(input())
a = []
res = 0
for _ in range(N):
  a.append(int(input()))

hasGreaterBefore = set()

for num in range(N, 0, -1):
    max_v, min_v = 0, 1e5
    hasGreaterBefore.clear()
    for e in a:
        if max_v < e:
            max_v = e
        else:
            hasGreaterBefore.add(e)

    if num in hasGreaterBefore:
        eidx = a.index(num)
        if eidx != 0:
            a.pop(eidx)
            a = [num] + a
            res += 1

print(res)


### FIXED CODE ###

N = int(input())
a = [0]
for _ in range(N):
  a.append(int(input()))

Q = [0 for i in range(N + 1)]
for i in range(N + 1):
    Q[a[i]] = i
ans = 1
num = 1

for idx in range(2, len(Q)):
    if Q[idx - 1] < Q[idx]:
        num += 1
    else:
        ans, num = max(num, ans), 1

print(N - max(num, ans))
### BUGGY CODE ###

n = int(input())
dll =[]
for i in range(n):
    command = input().split()
    if command[0] == 'insert':
        dll.insert(0, command[1])
    elif command[0] == 'delete':
        try:
            dll.remove(command[1])
        except:
            pass
    elif command[0] == 'deleteFirst':
        dll.pop(0)
    else:
        dll.pop()

print(*dll)

### FIXED CODE ###

from collections import deque

n = int(input())
dll = deque()
for i in range(n):
    command = input().split()
    if command[0] == 'insert':
        dll.appendleft(command[1])
    elif command[0] == 'delete':
        try:
            dll.remove(command[1])
        except:
            pass
    elif command[0] == 'deleteFirst':
        dll.popleft()
    else:
        dll.pop()
print(*dll)
### BUGGY CODE ###

def comb(n, r):
    ret = 1
    if (n == r) or (n == 0) or (r == 0):
        ret = 1
    else:
        for i in range(1, n + 1):
            ret *= i
        for i in range(1, r + 1):
            ret //= i
        for i in range(1, n - r + 1):
            ret //= i
    return ret

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

s = [0, a[0]]
for i in range(1, n):
    s.append(s[i]+a[i])
d = {}
for x in s:
    if x in d.keys():
        d[x] += 1
    else:
        d[x] = 1

ans = 0
for k, v in d.items():
    if v >= 2:
        ans += comb(v, 2)
print(ans)

### FIXED CODE ###

'''
https://beta.atcoder.jp/contests/agc023/submissions/2426081
'''
n = int(input())
A = map(int, input().split())
B = {0:1}
s = 0
ans = 0
for a in A:
    s += a
    B_s = B.get(s, 0) 
    ans += B_s
    B[s] = B_s + 1
print(ans)
### BUGGY CODE ###

n = int(input())
a = list(map(int, input().split()))
total = 0
MOD = 10**9+7

for i in range(n-1):
    back = sum(a[i+1:n])
    total += a[i] * back
    total = total % MOD
print(total)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
total = 0
MOD = 10**9+7
back= sum(a)

for i in range(n-1):
    back -= a[i]
    total += a[i] * back
    total = total % MOD
print(total)
### BUGGY CODE ###

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

def solve():
    ans = 0
    count = 0
    for i in range(1, 1000001):
        if i in a_i:
            flag = 0
            for j in range(n):
                if i != a_i[j] and i % a_i[j] == 0:
                    break
                elif i == a_i[j] and flag == 0:
                    flag = 1
                elif i == a_i[j] and flag == 1:
                    break
            else:
                ans += 1
            count += 1
        if count == n:
            break
    return ans

print(solve())

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
num_list = [0] * 1000001
 
def solve():
    ans = 0
    for i in range(n):
        if num_list[a[i]] == 0:
            num_list[a[i]] += 1
            for j in range(2, (1000000 // a[i]) + 1):
                num_list[j * a[i]] += 1
        elif num_list[a[i]] == 1:
            num_list[a[i]] += 1
    for i in range(n):
        if num_list[a[i]] == 1:
            ans += 1
    return ans
 
print(solve())
### BUGGY CODE ###

n = int(input())
hs = list(map(int, input().split()))
maxh = max(hs)
dp = [-1] * (maxh + 1)
ans = 0

for i, h in enumerate(hs):
    for j in range(h + 1):
        if dp[j] == -1:
            dp[j] = i
    for j in range(h + 1, maxh + 1):
        if dp[j] != -1:
            ans = max(ans, j * (i - dp[j]))
            dp[j] = -1
ans = max(ans, max((n - i) * j for j, i in enumerate(dp) if i != -1))

print(ans)

### FIXED CODE ###

n = int(input())
hs = list(map(int, input().split()))
stack = []
ans = 0

for i, h in enumerate(hs):
    j = -1
    while stack and stack[-1][1] > h:
        j, h2 = stack.pop()
        ans = max(ans, (i - j) * h2)
    if not stack or stack[-1][1] < h:
        stack.append((i if j == -1 else j, h))
ans = max(ans, max((n - j) * h2 for j, h2 in stack))

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

N = int(input())
A = list(map(int, input().split()))
while not all(a==0 for a in A[0:-1]):
    A.sort()
    A[-1] = A[-1] - A[-2]
print(A[-1])

### FIXED CODE ###

import fractions
N = int(input())
A = list(map(int, input().split()))
a = 0
for i in range(N):
    a = fractions.gcd(a, A[i])
print(a)
### BUGGY CODE ###

n, m = map(int, input().split())
a = []
c = []
for i in range(m):
    sa, sb = map(int, input().split())
    sc = list(map(int, input().split()))
    tc = 0
    a.append(sa)
    for j in sc:
        tc += 2 ** (j - 1)
    c.append(tc)

dp = [10 ** 7 for j in range(2 ** n)]
dp[0] = 0
for i in range(m):
    sc = c[i]
    for j in range(2 ** n):
        dp[int(j | sc)] = min(dp[int(j | sc)], dp[j] + a[i])

if dp[2 ** n - 1] == 10 ** 7:
    print(-1)
else:
    print(dp[2 ** n - 1])


### FIXED CODE ###

def main():
    n, m = map(int, input().split())
    a = []
    c = []
    dp = [10 ** 7 for j in range(2 ** n)]
    dp[0] = 0
    for _ in range(m):
        a, b = map(int, input().split())
        sc = list(map(int, input().split()))
        c = 0
        for j in sc:
            c += 2 ** (j - 1)
        for j in range(2 ** n):
            dp[j | c] = min(dp[j | c], dp[j] + a)

    if dp[2 ** n - 1] == 10 ** 7:
        print(-1)
    else:
        print(dp[2 ** n - 1])


main()
### BUGGY CODE ###

import sys

N, W = map(int, input().split())
WV = [list(map(int, sys.stdin.readline().split())) for i in range(N)]

INF = 10**10 + 1
dp = [[INF]*(N+1) for i in range(1000*N+2)]

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

i = 1

while(True):
        for j in range(1, N+1):
                if i-WV[j-1][1]>=0:
                        dp[i][j] = min(dp[i-WV[j-1][1]][j-1]+WV[j-1][0], dp[i][j-1])
                else:
                        dp[i][j] = min(dp[i][j-1], WV[j-1][0])
        #print(i, dp[i][N])
        if dp[i-1][N] <= W and dp[i][N] > W:
                break
        i += 1

print(i-1)

### FIXED CODE ###

import sys

N, W = map(int, input().split())
WV = [list(map(int, sys.stdin.readline().split())) for i in range(N)]
'''
w = [0]*N
v = [0]*N
for i in range(N):
        w[i], v[i] = map(int, sys.stdin.readline().split())
'''
INF = 10**11+1
dp = [[INF]*(N+1) for j in range(N*(10**3)+10)]
i = 1
ans = INF
while(True):
        for j in range(1, N+1):
                #print(i, j)
                w = WV[j-1][1]
                if i-w > 0:
                        dp[i][j] = min(dp[i][j-1], dp[i-w][j-1]+WV[j-1][0])
                        #dp[i][j] = max(dp[i-WV[j-1][0]][j-1]+WV[j-1][1], dp[i][j-1])
                else:
                        dp[i][j] = min(dp[i][j-1], WV[j-1][0])
        #print(dp[i][N])
        #print(i, dp[i][N])
        if dp[i][N] > W and ans <= W:
                print(i-1)
                exit()
        ans = dp[i][N]
        '''
        if dp[i][N] >= W:
                if ans == 0:
                        ans = dp[i][N]
                elif ans < dp[i][N]:
                        print(i)
                        exit()
                print(i, ans)
        '''
        i += 1
### BUGGY CODE ###

def max_heapify(A, i):
  H = len(A) - 1
  l, r, m = i*2, i*2+1, i
  if l <= H and A[l] > A[i]: m = l
  if r <= H and A[r] > A[m]: m = r

  if m != i:
    A[i], A[m] = A[m], A[i]
    max_heapify(A, m)

def build_max_heap(A):
  H = len(A) - 1
  for i in range(H // 2, 0, -1):
    max_heapify(A, i)

A = [0]
cmd = input()
while cmd != "end":
  if cmd == "extract":
    if len(A) <= 2:
      print(A.pop())
    else:
      print(A[1])
      A[1] = A.pop()
      max_heapify(A, 1)
  else:
    cmd, k = cmd.split()
    if cmd == "insert":
      A.append(int(k))
      build_max_heap(A)
  cmd = input()

### FIXED CODE ###

import sys

def max_heapify(A, H, i):
  target = A[i]

  m = i
  l = i * 2
  while l <= H:
    largest = target
    if A[l] > target:
      m = l
      largest = A[m]

    r = l + 1
    if r <= H and A[r] > largest:
      m = r
      largest = A[m]

    if m != i:
      A[i] = largest
      i = m
      l = i * 2
    else:
      break

  A[m] = target

def build_max_heap(A, i):
  if i < 2: return
  last = A[i]
  p = i // 2
  while p > 0 and A[p] < last:
    A[i] = A[p]
    i = p
    p = i // 2
  A[i] = last

A = [0]

for line in sys.stdin.readlines():
  if line[0] == 'i':
    A.append(int(line[7:]))
    build_max_heap(A, len(A) - 1)
  elif line[1] == 'x':
    if len(A) <= 1:
      pass
    elif len(A) <= 2:
      print(A.pop())
    else:
      print(A[1])
      A[1] = A.pop()
      max_heapify(A, len(A) -1, 1)
  else:
    exit()
### BUGGY CODE ###

n = int(input())
ans = int(1)
a = input().split(" ")

for i in range(n):
  ans *= int(a[i])
  
if ans > 10**18:
  print("-1")
else:
  print(ans)

### FIXED CODE ###

n = int(input())
ans = int(1)
a = input().split(" ")

if "0" in a:
  ans = 0
else:
  for i in range(n):
    ans *= int(a[i])
    if ans > 10**18:
      print("-1")
      break
    
if ans <= 10**18:
  print(ans)
### BUGGY CODE ###

import sys
from itertools import combinations as combi
input = sys.stdin.readline
N = int(input())
a = [tuple(map(int, input().split())) for _ in range(N)]
#print(a)
tableud = [[0] * N for _ in range(N)]
tablelr = [[0] * N for _ in range(N)]
for i in range(N):
  x, y, _ = a[i]
  for j in range(N):
    tableud[i][j] = abs(a[j][0] - x) * a[j][2]
    tablelr[i][j] = abs(a[j][1] - y) * a[j][2]
tableudi = [[10 ** 20] * N for _ in range(1 << N)]
tablelri = [[10 ** 20] * N for _ in range(1 << N)]
for i in range(1 << N):
  for j in range(N):
    if i & (1 << j):
      for k in range(N):
        tableudi[i][k] = min(tableudi[i][k], tableud[j][k])
        tablelri[i][k] = min(tablelri[i][k], tablelr[j][k])
zero = 0
for t in range(N + 1):
  res = float("inf")
  if zero:
    print(0)
    continue
  for c in combi([x for x in range(N)], t):
    for i in range(1 << t):
      x = 0
      y = 0
      rres = 0
      for j in range(t):
        if i & (1 << j): x |= 1 << c[j]
        else: y |= 1 << c[j]
      for j in range(N):
        rres += min(min(abs(a[j][0]), abs(a[j][1])) * a[j][2], tableudi[x][j], tablelri[y][j])
      res = min(res, rres)
  print(res)
  if res == 0: zero = 1


### FIXED CODE ###

import sys
input = sys.stdin.readline
N = int(input())
a = [tuple(map(int, input().split())) for _ in range(N)]
#print(a)
table = [0] * N
for k in range(N): table[k] = min(abs(a[k][0]), abs(a[k][1])) * a[k][2]
tableudi = [10 ** 12 for _ in range((1 << N) * N)]
tablelri = [10 ** 12 for _ in range((1 << N) * N)]
for i in range(1 << N):
  for j in range(N):
    if i & (1 << j):
      for k in range(N):
        ud = min(abs(a[k][0] - a[j][0]) * a[k][2], table[k])
        lr = min(abs(a[k][1] - a[j][1]) * a[k][2], table[k])
        tableudi[i * N + k] = min(tableudi[i * N + k], ud)
        tablelri[i * N + k] = min(tablelri[i * N + k], lr)
    else:
      for k in range(N):
        tableudi[i * N + k] = min(tableudi[i * N + k], min(abs(a[k][0]), abs(a[k][1])) * a[k][2])
        tablelri[i * N + k] = min(tablelri[i * N + k], min(abs(a[k][0]), abs(a[k][1])) * a[k][2])
res = [10 ** 12] * (N + 1)
for t in range(1 << N):
  i = t + 0
  c = bin(t).count("1")
  while True:
    x = i + 0
    y = t ^ x
    rres = 0
    for j in range(N):
      rres += min(tableudi[x * N + j], tablelri[y * N + j])
    res[c] = min(res[c], rres)
    #print(t, res, rres)
    if i == 0: break
    i = (i - 1) & t
for r in res: print(r)
### BUGGY CODE ###

from fractions import gcd

lcm = lambda a, b: a * b // gcd(a, b)
mod = 10 ** 9 + 7

N, *A = map(int, open(0).read().split())

L = 1
for a in A:
    L = lcm(L, a)

ans = 0
for a in A:
    ans = (ans + L // a) % mod

print(ans)

### FIXED CODE ###

from fractions import gcd
from functools import reduce

def main():
    lcm = lambda a, b: a * b // gcd(a, b)
    mod = 10 ** 9 + 7

    N, *A = map(int, open(0).read().split())

    L = reduce(lcm, A)
    print(sum(L // a for a in A) % mod)

main()
### BUGGY CODE ###

from sys import stdin, setrecursionlimit
from collections import Counter, deque, defaultdict
import heapq
from math import floor, ceil
from bisect import bisect_left
from itertools import combinations
setrecursionlimit(100000)

INF = int(1e10)
MOD = int(1e9 + 7)

def main():
    from builtins import int, map
    H, W = map(int, input().split())
    Ch, Cw = map(lambda x: int(x) - 1, input().split())
    Dh, Dw = map(lambda x: int(x) - 1, input().split())
    S = [input() for _ in range(H)]

    dist = defaultdict(lambda: float("inf"))
    queue = deque([(Ch, Cw, 0)])

    while queue:
        (h, w, d) = queue.popleft()

        if dist[h, w] == float("inf") or dist[h, w] > d:
            dist[h, w] = d
            
            # 5x5-grid
            for ddh in range(-2, 3):
                for ddw in range(-2, 3):
                    nh, nw = h + ddh, w + ddw
                    if 0 <= nh < H and 0 <= nw < W and S[nh][nw] == '.':
                        # cost-0 move
                        if abs(ddh) + abs(ddw) <= 1:
                            queue.appendleft((nh, nw, d))
                        # cost-1 move
                        else:
                            queue.append((nh, nw, d + 1))

    if dist[Dh, Dw] == float("inf"):
        print(-1)
    else:
        print(dist[Dh, Dw])

if __name__ == '__main__':
    main()


### FIXED CODE ###

from collections import deque
INF = int(1e10)

def main():
    from builtins import int, map
    H, W = map(int, input().split())
    Ch, Cw = map(lambda x: int(x) - 1, input().split())
    Dh, Dw = map(lambda x: int(x) - 1, input().split())
    S = [input() for _ in range(H)]

    # dist = defaultdict(lambda: float("inf"))
    dist = [[float("inf")] * W for _ in range(H)]
    queue = deque([(Ch, Cw, 0)])

    while queue:
        (h, w, d) = queue.popleft()

        if dist[h][w] == float("inf") or dist[h][w] > d:
            dist[h][w] = d
            
            # 5x5-grid
            for ddh in range(-2, 3):
                for ddw in range(-2, 3):
                    nh, nw = h + ddh, w + ddw
                    if 0 <= nh < H and 0 <= nw < W and S[nh][nw] == '.':
                        # cost-0 move
                        if abs(ddh) + abs(ddw) <= 1:
                            queue.appendleft((nh, nw, d))
                        # cost-1 move
                        else:
                            queue.append((nh, nw, d + 1))

    if dist[Dh][Dw] == float("inf"):
        print(-1)
    else:
        print(dist[Dh][Dw])

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

#import numpy as np
import math
import collections
import bisect
#import sympy


def divisor(n):
    i = 1
    lower_divisors, upper_divisors = [], []
    while(i * i <= n):
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n // i)
        i += 1
    return lower_divisors + upper_divisors[::-1]


N = int(input())

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

A.sort()

ans = 0
ans = N
Set = set()
for i in range(N):
    divs = divisor(A[i])
    # print(divs)
    if i != 0:
        Set.add(A[i - 1])
    if i < N - 1:
        if A[i] == A[i + 1]:
            ans -= 1
            continue

    for d in divs:
        if i != 0:
            if d in Set:
                ans -= 1
                break
print(ans)


### FIXED CODE ###

import numpy as np
import math
import collections
import bisect
from collections import Counter


N = int(input())

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

A.sort()
Set = set()

Amax = A[len(A) - 1]

counter = Counter(A)
ans = 0
for a in A:
    if a in Set:
        continue
    x = a
    while(x <= Amax):
        Set.add(x)
        x += a

    if counter[a] == 1:
        ans += 1

print(ans)