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

import numpy as np
H,W = list(map(int,input().split()))

D=[]
for h in range(H):
    D.append(list(input()))
    
D = np.array(D) # D[h][w]
Lamp_h =  np.zeros(D.shape)

for d_h,d in enumerate(D):
    obst =[-1]
    
    for d_idx in range(len(d)):
        if d[d_idx] == '#':
            obst.append(d_idx)
            
    obst.append(W)
    for o_ed in range(1,len(obst)):
        o_st = o_ed-1
        
        o_st = obst[o_st]
        o_ed = obst[o_ed]
        
        Lamp_h[d_h][o_st+1:o_ed] = o_ed-1 - o_st

D_ = D.T # D[h][w]
Lamp_w =  np.zeros(D_.shape)

for d_h,d in enumerate(D_):
    obst =[-1]
    
    for d_idx in range(len(d)):
        if d[d_idx] == '#':
            obst.append(d_idx)
            
    obst.append(H)
    for o_ed in range(1,len(obst)):
        o_st = o_ed-1
        
        o_st = obst[o_st]
        o_ed = obst[o_ed]
        
        Lamp_w[d_h][o_st+1:o_ed] = o_ed-1 - o_st
        
Lamp_w.T

Lamp = Lamp_w.T + Lamp_h

print(int(Lamp.max()-1))

### FIXED CODE ###

from collections import deque

H,W = list(map(int,input().split()))
D_h = {}
D_w = {}

for h in range(H):
    D_h[h]=deque([-1])
    
for w in range(W):
    D_w[w]=deque([-1])
    
for h in range(H):
    D = list(input())
    for w in range(W):
        if D[w] =='#':
            D_h[h].append(w)
            D_w[w].append(h)
            
    D_h[h].append(W)
    
for w in range(W):
    D_w[w].append(H)
    
Lamp_h = [ [0] * W  for h in range(H) ]

for d_h in D_h.keys():
    obst = D_h[d_h]
    for o_ed in range(1,len(obst)):
        o_st = o_ed-1
        
        o_st = obst[o_st]
        o_ed = obst[o_ed]
        
        for o in range(o_st+1,o_ed):
            Lamp_h[d_h][o] = o_ed-1 - o_st
    
Lamp_w =  [ [0] * H  for w in range(W) ]
for d_w in D_w.keys():
    obst = D_w[d_w]
    for o_ed in range(1,len(obst)):
        o_st = o_ed-1
        
        o_st = obst[o_st]
        o_ed = obst[o_ed]
        
        for o in range(o_st+1,o_ed):
            Lamp_w[d_w][o] = o_ed-1 - o_st
    
ans = 0
for h in range(H):
    for w in range(W):
        ans_ = Lamp_h[h][w] + Lamp_w[w][h] 
        if ans < ans_:
            ans =ans_
        
print(ans-1)
### BUGGY CODE ###

n=int(input())
k=list()
for i in range(int(n*0.5)):
  if n%(i+1)==0:
    k.append(int(i+n/(i+1)-1))
print(min(k))


### FIXED CODE ###

n=int(input())
k=list()
for i in range(int(n**0.5)):
  if n%(i+1)==0:
    k.append(int(i+n/(i+1)-1))
print(min(k))
### BUGGY CODE ###

#float型を許すな
#numpyはpythonで
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

n=I()
seq=LI()
c=Counter(seq)
seq=list(set(seq))
seq.sort()
lis=[seq[0]]
for i in range(1,len(seq)):
    count=0
    for x in lis:
        if seq[i]%x!=0:
            count+=1
    if count==len(lis):
        lis.append(seq[i])
#print(lis)
ans=len(lis)
for x in lis:
    if c[x]>1:
        ans-=1
print(ans)
        




### FIXED CODE ###

from collections import Counter
n = int(input())
a = list(map(int, input().split()))
c = Counter(a)
p = [True] * (10 ** 6 + 1)
s = list(set(a))
for x in s:
    t = x * 2
    while t <= 10 ** 6:
        p[t] = False
        t += x
ans = 0
for x in a:
    if c[x] == 1 and p[x] == True:
        ans += 1
print(ans)
### BUGGY CODE ###

import re
S = input()
raw = len(S)
prev = len(S)
while True:
    S = re.sub(r"(10)+", "", S)
    S = re.sub(r"(01)+", "", S)
    if prev > len(S):
        prev = len(S)
    else:
        break
print(raw - len(S))


### FIXED CODE ###

import re
S = input()
num_1 = S.count("1")
num_0 = S.count("0")
print(min(num_0, num_1) * 2)
### BUGGY CODE ###

DIV = 998244353

N = input()
a = []
for i in range(N):
    a.append(input())
a.sort()
suma = sum(a)
dp = [[0] * (suma+1) for i in range(N)]
dp[0][0] = 2
dp[0][a[0]] = 1
allc = 3
for i in range(1,N):
	allc = allc*3
	k = a[i]
	for j in range(sum(a[:i+1])+1):
		if(j < k):
			dp[i][j] = dp[i-1][j]*2
		else:
			dp[i][j] = dp[i-1][j]*2+dp[i-1][j-k]
allc = allc - sum(dp[N-1][suma-suma/2:])*3
if(suma%2 == 0):
	dp2 = [[0] * (suma+1) for i in range(N)]
	dp2[0][0] = 1
	dp2[0][a[0]] = 1 
	for i in range(1,N):
		k = a[i]
		for j in range(sum(a[:i+1])+1):
			if(j < k):
				dp2[i][j] = dp2[i-1][j]
			else:
				dp2[i][j] = dp2[i-1][j]+dp2[i-1][j-k]
	allc += dp2[N-1][suma/2]*3
print(allc%DIV)

### FIXED CODE ###

import numpy as np

DIV = 998244353

N = input()
a = []
for i in range(N):
    a.append(input())
a.sort()
suma = sum(a)

dp = np.zeros((N,suma+1,2),dtype = np.int)
dp[0,0,0] = 2
dp[0,a[0],0] = 1
dp[0,0,1] = 1
dp[0,a[0],1] = 1

allc = 3
for i in range(1,N):
	allc = allc*3
	k = a[i]
	dp[i,k:,0] += dp[i-1,:-k,0]
	dp[i,:,0] += dp[i-1,:,0]*2
	dp[i,k:,1] += dp[i-1,:-k,1]
	dp[i,:,1] += dp[i-1,:,1]
	if(i%10 == 0):
		dp[i,:,:] = dp[i,:,:]%DIV
allc = allc - sum(dp[N-1,suma-suma/2:,0])*3
if(suma % 2 == 0):			
	allc += dp[N-1,suma/2,1]*3
print(int(allc%DIV))
### BUGGY CODE ###

n = int(input())

ans = 0
for i in range(1, n):
    ans += i % (i+1)

print(ans)

### FIXED CODE ###

n = int(input())

if n % 2 == 0:
    print((n-1)*int(n/2))
else:
    print(n*int((n-1)/2))
### BUGGY CODE ###

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

num = K
memo = []
town = 1
if K > N:
    for _ in range(K):
        memo.append(town)
        if not A[town-1] in memo:
            town = A[town-1]
            num -= 1
        else:
            index = memo.index(A[town-1])
            l = len(memo) - index
            if num % l == 0:
                town = memo[-1]
            else:
                town = memo[index + (num % l) - 1]
            break
else:
    for _ in range(K):
        town = A[town - 1]

print(town)

### FIXED CODE ###

from collections import deque
n, k = map(int, input().split())
a = [-1] + list(map(int, input().split()))
town = [-1] * (n + 1)
town[1] = 0
now_town = 1
second_first = 0
while True:
    if town[a[now_town]] != -1:
        second_first = a[now_town]
        break
    town[a[now_town]] = town[now_town] + 1
    if town[a[now_town]] == k:
        print(a[now_town])
        exit()
    now_town = a[now_town]
    # print(town)
start_index = town[second_first]
end_index = max(town)
rest = k - end_index
div = (rest-1) % (end_index - start_index + 1)
# print(rest, div)
ans = town.index((start_index) + div)
print(ans)
### BUGGY CODE ###

n=int(input())
s=[input() for _ in range(n)]

maxx=s.count(max(s))
ans=[]

for i in s:
  if s.count(i)==maxx:
    ans.append(i)

ans=set(ans)
answer=[]
for i in ans:
  answer.append(i)

answer.sort()
for i in answer:
  print(i)

### FIXED CODE ###

n=int(input())
s=[input() for _ in range(n)]
s.sort()
ans,be=[],""
cnt,maxcount=1,0

for i in range(n):
  if be==s[i]:
    cnt+=1
    
  else:
    if cnt>=1:
      if cnt>maxcount:
        maxcount=cnt
        ans.clear()
        ans.append(be)
      
      elif cnt==maxcount:
        ans.append(be)
      
      cnt=1
  be=s[i]
  if i==n-1:
    if cnt>=1:
      if cnt>maxcount:
        maxcount=cnt
        ans.clear()
        ans.append(be)
      
      elif cnt==maxcount:
        ans.append(be)
    
ans.sort()
for i in ans:
  if i!="":
    print(i)
### BUGGY CODE ###

n,k=map(int,input().split())
s=list(map(int,input().split()))
count=0
count=0

while k>0:
  s[s.index(max(s))]=0
  k-=1
    
if len(s)!=n-1:
  for i in s:
    count+=i
      
print(count)

### FIXED CODE ###

import sys

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

if k<len(s):
  for i in range(k):
    s[i]=0
else:
  for i in range(n):
    print(0)
    sys.exit()

print(sum(s))
### BUGGY CODE ###

n = int(input())
l = list(map(int, input().split()))
l.sort()
out = 0
for i in range(n-2):
  for j in range(i+1, n-1):
    for k in range(j+1, n):
      if l[k] < l[i] + l[j]:
        out += 1
      else:
        break
print(out)

### FIXED CODE ###

n = int(input())
l = list(map(int, input().split()))
l.sort()
out = 0
for i in range(n-2):
  k = i+2
  a = 1
  for j in range(i+1, n-1):
    a -= 1
    while k < n and l[k] < l[i] + l[j]:
      a += 1
      k += 1
    else:
      out += a
print(out)
### BUGGY CODE ###

def dotHeight(y,x):
    cnt=0
    for i in range(y,-1,-1):
        if L[i][x]=="*":
            return cnt
        cnt+=1

def dotLength(y,x):
    cnt=0
    for i in range(x,-1,-1):
        if L[y][i]=="*":
            return cnt
        cnt+=1

while True:
    H,W=map(int,raw_input().split())
    if H==W==0:break
    L=[["*"]+list(raw_input())+["*"] for i in range(H)]
    L.append(["*"]*(W+2))
    L.insert(0,["*"]*(W+2))
    dp=[[set() for i in range(W+2)] for i in range(H+2)]
    maxInt=0
    for i in range(1,H+2):
        for j in range(1,W+2):
            if L[i][j]==".":
                if L[i-1][j]==L[i][j-1]=="*":
                    dp[i][j].add((1,1))
                    maxInt=max(maxInt,1)
                elif L[i-1][j]=="*":
                    for k in dp[i][j-1]:
                        dp[i][j].add((k[0]+1,1))
                        maxInt=max(maxInt,k[0]+1)
                elif L[i][j-1]=="*":
                    for k in dp[i-1][j]:
                        dp[i][j].add((1,k[1]+1))
                        maxInt=max(maxInt,k[1]+1)
                else:
                    h=dotHeight(i,j)
                    l=dotLength(i,j)
                    for k in dp[i][j-1]:
                        dp[i][j].add((k[0]+1,min(k[1],h)))
                        maxInt=max(maxInt,(k[0]+1)*min(k[1],h))
                    for k in dp[i-1][j]:
                        dp[i][j].add((min(k[0],l),k[1]+1))
                        maxInt=max(maxInt,min(k[0],l)*(k[1]+1))
        dp[i-1]=[]
    print maxInt

### FIXED CODE ###

def histogram(mass, h, w):
    table = [[0]*w for i in range(h)]
    for i in range(h):
        for j in range(w):
            if mass[i][j] == '*':
                table[i][j] = 0
            else:
                table[i][j] = table[i-1][j] + 1
    return table


def get_rectangle_area(table, w):
    maxv = 0
    stack = []
    table.append(0)
    for i, rect in enumerate(table):
        if stack == []:
            stack.append((rect, i))
        elif stack[-1][0] < rect:
            stack.append((rect, i))
        elif stack[-1][0] == rect:
            pass
        elif stack[-1][0] > rect:
            while stack != [] and stack[-1][0] >= rect:
                high, pos = stack.pop()
                maxv = max(maxv, high*(i-pos))
            stack.append((rect, pos))
    return maxv

while True:
    h, w = map(int, raw_input().split())
    if h == w == 0:
        break
    mass = [raw_input() for i in range(h)]
    table = histogram(mass, h, w)
    ans = 0
    for tab in table:
        ans = max(ans, get_rectangle_area(tab, w))
    print ans
### BUGGY CODE ###

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

for i in range(1,N):
    j = i
    tmp = 0
    while i > 0:
        if P[j] <= P[i-1]:
            tmp += 1
        i -= 1
    if j == tmp:
        cnt += 1
print(cnt)

### FIXED CODE ###

N = int(input())
P = list(map(int,input().split()))
ans = 0
mini = P[0]

for i in range(N):
    if P[i] <= mini:
        mini = P[i]
        ans += 1
print(ans)
### BUGGY CODE ###

# -*- coding: utf-8 -*-

a, b, k = map(int, input().split())
tmp = 0
aa = set()

for i in range(a, b+1):
    if tmp < k:
        aa.add(i)
    tmp += 1

tmp = 0

for i in range(a, b+1):
    if tmp >= b+1-a-k:
        aa.add(i)
    tmp += 1

for i in sorted(list(aa)):
    print(i)


### FIXED CODE ###

# -*- coding: utf-8 -*-

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

if b-a < 2*k:
    for i in range(a, b+1):
        print(i)
else:
    for i in range(a, a+k):
        print(i)
    for i in range(b-k+1, b+1):
        print(i)
### BUGGY CODE ###

S = input()

count = 0
while True:
    c = S.count('BW')
    if c == 0:
        break
    S = S.replace('BW', 'WB')
    count += c
print(count)

### FIXED CODE ###

S = input()

count = 0
for i in range(len(S)):
    if S[i] == 'W':
        continue
    else:
        break
S = S[i:]

count = 0
score = 0
for i in range(len(S)):
    if S[i] == 'W':
        score += (i - count)
        count += 1
print(score)
### BUGGY CODE ###

n = int(input())
a = [int(input()) for i in range(n)]
for i in range(n):
    print(max(a[0:i]+a[i+1:n]))

### FIXED CODE ###

n = int(input())
a = [int(input()) for i in range(n)]
b = sorted(a)
for i in range(n):
    if a[i] == b[-1]:
        print(b[-2])
    else:
        print(b[-1])
### BUGGY CODE ###

n = int(input())
A = list(map(int,input().split()))
B = sorted(set(A))
dic = {}
ans = 0

for i in range(len(B)):
    if A.count(B[i]) > 1:
        C = A.count(B[i])
        dic[B[i]] = C
        ans += C*(C-1)//2
    else:
        dic[B[i]] = 1
        
for i in range(len(B)):
    x = dic[B[i]]
    dic[B[i]] = ans + 1 - x

for i in range(n):
    print(dic[A[i]])

### FIXED CODE ###

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

import collections
c = collections.Counter(a)

for i in c.values():
    ans += i*(i-1)//2
    
for i in a:
    print(ans - c[i])
### BUGGY CODE ###

def solve():
    n = int(input())
    people = input()
    return min([people[:i].count("W") + people[i + 1:].count("E") for i in range(n)])


if __name__ == "__main__":
    print(solve())


### FIXED CODE ###

def resolve():
    n = int(input())
    s = input()
    left = [0] * n
    right = [s[1:].count("E")] + [0] * (n - 1)
    ans = [s[1:].count("E")] + [0] * (n - 1)
    for i in range(1, n):
        left[i] = left[i - 1] + (1 if s[i - 1] == "W" else 0)
        right[i] = right[i - 1] + (-1 if s[i] == "E" else 0)
        ans[i] = left[i] + right[i]
    print(min(ans))


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

pattern = int(input())

xs = []
ys = []
hs = []

for _ in range(pattern):
    x, y, h = map(int, input().split(' '))
    xs.append(x)
    ys.append(y)
    hs.append(h)

correct = 0

max_h = max(hs) + 200

for Cx in range(101):
    for Cy in range(101):
        for H in range(max(hs), max_h):
            for x, y, h in zip(xs, ys, hs):
                if abs(x-Cx) + abs(y-Cy) == abs(h-H):
                    correct += 1
                    if correct == len(xs) and max(hs) <= H:
                        print(Cx, Cy, H)
                        break
                else:
                    correct = 0
                    continue


### FIXED CODE ###

N = int(input())

coords = [list(map(int, input().split(' '))) for _ in range(N)]

coords.sort(key=lambda x: x[2], reverse=True)

# 全探索
def search():
    for Cx in range(101):
        for Cy in range(101):
            x, y, h = tuple(coords[0])
            H = h + abs(Cx - x) + abs(Cy - y)
            for x, y, h in coords:
                if max(H - abs(Cx - x) - abs(Cy - y), 0) != h:
                    break
            else:
                return Cx, Cy, H

x, y, h = search()
print("{} {} {}".format(x, y, h))
### BUGGY CODE ###

H, W = map(int, input().split())
AB = []
for i in range(H):
  AB.append(list(map(int, input().split())))

for i in range(H):
  AB[i] = [abs(AB[i][j] - int(b)) for j, b in enumerate(input().split())]

K = 80*(H + W)
dp = [[[False]*K for w in range(W)] for h in range(H)]
dp[0][0][abs(AB[0][0])] = True


for h in range(H):
  for w in range(W):
    if h == 0:
      if w == 0:
        continue
      else:
        for k in range(K):
          ab = AB[h][w]
          k1, k2 = abs(k - ab), k + ab
          if k1 < K and k2 < K:
            dp[h][w][k] = dp[h][w-1][k1] or dp[h][w-1][k2]
          elif k1 < K and k2 >= K:
            dp[h][w][k] = dp[h][w-1][k1]
          else:
            dp[h][w][k] = dp[h][w-1][k2]
    else:
      if w == 0:
        for k in range(K):
          ab = AB[h][w]
          k1, k2 = abs(k - ab), k + ab
          if k1 < K and k2 < K:
            dp[h][w][k] = dp[h-1][w][k1] or dp[h-1][w][k2]
          elif k1 < K and k2 >= K:
            dp[h][w][k] = dp[h-1][w][k1]
          else:
            dp[h][w][k] = dp[h-1][w][k2]
      else:
        for k in range(K):
          ab = AB[h][w]
          k1, k2 = abs(k - ab), k + ab
          if k1 < K and k2 < K:
            dp[h][w][k] = dp[h][w-1][k1] or dp[h][w-1][k2] or dp[h-1][w][k1] or dp[h-1][w][k2]
          elif k1 < K and k2 >= K:
            dp[h][w][k] = dp[h][w-1][k1] or dp[h-1][w][k1]
          else:
            dp[h][w][k] = dp[h][w-1][k2] or dp[h-1][w][k2]

for k in range(K):
  if dp[H-1][W-1][k]:
    print(k)
    break
  

### FIXED CODE ###

H, W = map(int, input().split())
AB = []
max_ab = 0
for i in range(H):
  AB.append(list(map(int, input().split())))
  max_ab = max(max_ab, max(AB[-1]))

for i in range(H):
  AB[i] = [abs(AB[i][j] - int(b)) for j, b in enumerate(input().split())]

base = max_ab*(H + W)
dp = [[1 << base for w in range(W)] for h in range(H)]
dp[0][0] = (1 << base + AB[0][0]) | (1 << base - AB[0][0])
for h in range(1, H):
  dp[h][0] = (dp[h-1][0] << AB[h][0]) | (dp[h-1][0] >> AB[h][0])

for w in range(1, W):
  dp[0][w] = (dp[0][w-1] << AB[0][w]) | (dp[0][w-1] >> AB[0][w])

for h in range(1, H):
  for w in range(1, W):
    dp[h][w] = (
      (dp[h-1][w] << AB[h][w]) | (dp[h-1][w] >> AB[h][w]) 
      | (dp[h][w-1] << AB[h][w]) | (dp[h][w-1] >> AB[h][w]))

positive = bin(dp[H-1][W-1] >> base)
print(positive[::-1].find('1'))
### BUGGY CODE ###

import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)

N = int(readline().rstrip())
A = list(map(int, readline().split()))

import itertools
pairs = list(itertools.combinations(range(0, N), 2))

ans = 0
for pair in pairs:
    x1, x2 = pair
    if abs(x1 - x2) == A[x1] + A[x2]:
        ans += 1

print(ans)

### FIXED CODE ###

import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)

N = int(readline().rstrip())
A = list(map(int, readline().split()))

d1 = {}
d2 = {}
for n in range(1, N+1):
    x1 = n + A[n-1]
    if x1 in d1:
        d1[x1] += 1
    else:
        d1[x1] = 1
    
    x2 = n - A[n-1]
    if x2 in d2:
        d2[x2] += 1
    else:
        d2[x2] = 1

ans = 0
for d in d1:
    if d in d2:
        ans += (d1[d] * d2[d])
print(ans)
### BUGGY CODE ###

import sys
import collections
ns = lambda: sys.stdin.readline().rstrip()
ni = lambda: int(ns())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())
nsl = lambda: map(str, sys.stdin.readline().split())

n = ni()
a = nl()
ans = []
if n % 2 == 0:
    for i in range(n):
        if i % 2 == 0:
            ans.append(str(a.pop(0)))
        else:
            ans.insert(0, str(a.pop(0)))
else:
    for i in range(n):
        if i % 2 == 0:
            ans.insert(0, str(a.pop(0)))
        else:
            ans.append(str(a.pop(0)))
print(' '.join(ans))


### FIXED CODE ###

import sys
import collections
ns = lambda: sys.stdin.readline().rstrip()
ni = lambda: int(ns())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())
nsl = lambda: map(str, sys.stdin.readline().split())

n = ni()
a = collections.deque(nl())
ans = collections.deque()
if n % 2 == 0:
    for i in range(n):
        if i % 2 == 0:
            ans.append(str(a.popleft()))
        else:
            ans.appendleft(str(a.popleft()))
else:
    for i in range(n):
        if i % 2 == 0:
            ans.appendleft(str(a.popleft()))
        else:
            ans.append(str(a.popleft()))
print(' '.join(ans))
### BUGGY CODE ###

from collections import Counter

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

# サイズA_maxのbool配列dpを用意し、trueで初期化する
A_max = max(A)
dp = [True] * (A_max + 1)
calculated = {}

# 数列の要素を昇順に見る O(nloglogn)
for x in range(A_max):
    # すでに計算していれば再度計算しない
    if x in calculated:
        continue
    # xが数列Aに含まれているとき、xより大きいxの倍数yについて、dp[y]をfalseに変更する
    if x in A:
        calculated[x] = True
        t = 2
        while x * t <= A_max:
            dp[x * t] = False
            t += 1

# 同じ値が複数存在するかチェックする用のカウンタ
C = {a: 0 for a in A}
for a in A:
    C[a] += 1

ans = 0
for a in A:
    if C[a] == 1 and dp[a] is True:
        ans += 1

print(ans)


### FIXED CODE ###

from collections import Counter

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

# 同じ値が複数存在するかチェックする用のカウンタ
counter = Counter(A)

# D[a] = True: Aにaより小さいaの約数が存在する
A_max = max(A)
dp = {a: False for a in A}

for a in A:
    # xが数列Aに含まれているとき、aより大きいaの倍数tについて、dp[a * t]をTrueに変更する
    if counter[a] > 0:
        t = 2
        while a * t <= A_max:
            dp[a * t] = True
            t += 1

ans = 0
for a in A:
    if counter[a] == 1 and dp[a] is False:
        ans += 1

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

N = int(input())
p = set()
for _ in range(N):
    x, y = map(int, input().split())
    p.add((x, y))
p = list(p)

res = 0
for x, y in p:
    p.sort(key=lambda i: abs(i[0] - x) + abs(i[1] - y))
    res = max(res, abs(x - p[-1][0]) + abs(y - p[-1][1]))
print(res)

### FIXED CODE ###

N = int(input())
p = []
for _ in range(N):
    x, y = map(int, input().split())
    p.append((x, y))
p = sorted(p, key=lambda i: i[0] + i[1])
x1, y1 = p[0]
x2, y2 = p[-1]
res = abs((x1 + y1) - (x2 + y2))
p = sorted(p, key=lambda i: i[0] - i[1])
x1, y1 = p[0]
x2, y2 = p[-1]
res = max(abs((x1 - y1) - (x2 - y2)), res)
print(res)
### BUGGY CODE ###

n = int(input())
table=[[] for _ in range(n+1)]
import copy
from collections import defaultdict
def yaku(m):
    pf=defaultdict(int)
    for i in range(2,int(m**0.5)+1):
        while m%i==0:
            pf[i]=pf.get(i,0)+1
            m//=i
            if table[m]!=[]:
                tmp=copy.deepcopy(table[m])
                for key in pf.keys():
                    tmp[key]+=pf[key]
                return tmp
    if m>1:pf[m]=1
    return pf

ans=1
for m in range(2,n+1):
    table[m]=yaku(m)
    tmp=1
    for k in table[m].keys():
        tmp*=(table[m][k]+1)
    ans+=m*tmp

print(ans)

### FIXED CODE ###

n = int(input())
table=[1 for _ in range(n+1)]
ans=0
for x in range(1,n+1):
    y=n//x
    ans+=y*(y+1)*x//2
print(ans)
### BUGGY CODE ###

s = input()
t = input()

# DPテーブルを初期化
dp = [[0 for j in range(len(t)+1)] for i in range(len(s)+1)]


# ループを回す
for i in range(len(s)):
    for j in range(len(t)):
        if s[i] == t[j]:
            dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j] + 1)
        dp[i+1][j+1] = max(dp[i+1][j+1], dp[i+1][j])
        dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j+1])

# 答えを復元
ans = ''
i = len(s)
j = len(t)
while i > 0 and j > 0:
    if dp[i][j] == dp[i-1][j]:
        i -= 1
    elif dp[i][j] == dp[i][j-1]:
        j -= 1
    else:
        ans = s[i-1]+ans
        i -= 1
        j -= 1
print(ans)


### FIXED CODE ###

s = input()
t = input()

# DPテーブルを初期化
dp = [[0 for j in range(len(t)+1)] for i in range(len(s)+1)]


# ループを回す
for i in range(len(s)):
    for j in range(len(t)):
        if s[i] == t[j]:
            dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j] + 1)
        dp[i+1][j+1] = max(dp[i+1][j+1], dp[i+1][j])
        dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j+1])

# 答えを復元
ans = ''
i = len(s)
j = len(t)
while i > 0 and j > 0:
    if dp[i][j] == dp[i-1][j]:
        i -= 1
    elif dp[i][j] == dp[i][j-1]:
        j -= 1
    else:
        ans = s[i-1]+ans
        i -= 1
        j -= 1
print(ans)