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

import numpy as np

h, w, k = map(int, input().split())
s = []
for i in range(h):
    string = input()
    temp = []
    for j in range(w):
        temp.append(int(string[j]))
    s.append(temp)

s_arr = np.array(s)

ans = 10**9
for i in range(2**(h-1)):
    bin_str = format(i, '0'+str(h-1)+'b')
    kouryo = np.array([[0 for _ in range(w)]])
    cnt = 0
    start = 0
    for j in range(h-1):
        if bin_str[j] == '1':
            cnt += 1
            kouryo = np.concatenate((kouryo, s_arr[start:j+1].sum(axis=0, keepdims=True)), axis=0)
            start=j+1
    kouryo = np.concatenate((kouryo, s_arr[start:].sum(axis=0, keepdims=True)), axis=0)

    if cnt > ans: continue
    if np.any(kouryo>k): continue

    wa = np.array([0 for _ in range(len(kouryo))])
    for j in range(w):
        wa += kouryo[:, j]
        if np.any(wa>k):
            cnt += 1
            if cnt > ans: break
            wa = kouryo[:, j]
    ans = min(ans, cnt)
print(ans)

### FIXED CODE ###

import numpy as np

h, w, k = map(int, input().split())
s = []
for i in range(h):
    string = input()
    temp = []
    for j in range(w):
        temp.append(int(string[j]))
    s.append(temp)

s_arr = np.array(s)

ans = 10**9
for i in range(2**(h-1)):
    bin_str = format(i, '0'+str(h-1)+'b')
    kouryo = np.array([[0 for _ in range(w)]])
    cnt = 0
    start = 0
    for j in range(h-1):
        if bin_str[j] == '1':
            cnt += 1
            kouryo = np.concatenate((kouryo, s_arr[start:j+1].sum(axis=0, keepdims=True)), axis=0)
            start=j+1
    kouryo = np.concatenate((kouryo, s_arr[start:].sum(axis=0, keepdims=True)), axis=0)

    if cnt > ans: continue
    if np.any(kouryo>k): continue

    wa = np.array([0 for _ in range(len(kouryo))])
    for j in range(w):
        wa += kouryo[:, j]
        if np.max(wa)>k:
            cnt += 1
            if cnt > ans: break
            wa = kouryo[:, j]
    ans = min(ans, cnt)
print(ans)
### BUGGY CODE ###

n, m = map(int, input().split())
queue = []
for i in range(m):
    a, b = input().split()
    queue.append([a, b])

sort_list = [[10**10] for i in range(n)]
for data in queue:
    k, v = map(int, data)
    sort_list[k - 1].append(v)

for i in range(n):
    sort_list[i].sort()

for data in queue:
    k, v = map(int, data)   

    num_index = sort_list[k -1].index(v)

    print(str(k).zfill(6) + str(num_index + 1).zfill(6))


### FIXED CODE ###

n, m = map(int, input().split())
queue = []
for i in range(m):
    c, y= map(int, input().split())
    queue.append([c, y, i])

queue = sorted(queue)

index = 0
keep = queue[0][0]
for i in range(m):
    if keep != queue[i][0]:
        index = 0
        keep = queue[i][0]
    index += 1
    queue[i][0] = str(queue[i][0]).zfill(6)
    queue[i][1] = str(index).zfill(6)

queue.sort(key=lambda x: x[2])

for data in queue:
    cn, yn, i = data
    print(cn + yn)
### BUGGY CODE ###

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

A.sort(reverse=True)

l=1
r=200000+1

while l+1<r:
    mid=(l+r)//2
    cnt=0
    C=0
    S=0
    for la in A:
        ll=-1
        rr=N
        while ll+1<rr:
            mi=(ll+rr)//2
            if A[mi]<=mid-la:
                rr=mi
            else:
                ll=mi
        if rr==0:
            break
        cnt+=rr
    if cnt<M:
        r=mid
    else:
        l=mid

AN=r

S=[0]*(N+1)

for i in range(N):
    S[i+1]=S[i]+A[i]

ans1=0
c=0
for la in A:
    ll = -1
    rr = N
    while ll + 1 < rr:
        mi = (ll + rr) // 2
        if A[mi] <= AN - la:
            rr = mi
        else:
            ll = mi
    if rr == 0:
        break
    c+=rr
    ans1=ans1+la*rr+S[rr]

ans=ans1+(M-c)*AN
print(ans)




### FIXED CODE ###

from bisect import bisect_left

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

A.sort()

l=1
r=200000+1

def chk(x):
    c=0
    for la in A:
        y=bisect_left(A,x-la)
        c+=N-y
    if c>=M:
        return True
    else:
        return False



while l+1<r:
    mid=(l+r)//2
    if chk(mid):
        l=mid
    else:
        r=mid

AN=l

S=[0]*(N+1)

for i in range(N):
    S[i+1]=S[i]+A[i]

ans1=0
c=0
for la in A:
    ll = -1
    rr = N
    while ll + 1 < rr:
        mi = (ll + rr) // 2
        if A[mi] > AN - la:
            rr = mi
        else:
            ll = mi
    c+=N-rr
    ans1=ans1+la*(N-rr)+S[N]-S[rr]

ans=ans1+(M-c)*AN
print(ans)
### BUGGY CODE ###

def mx(ls,n):
    sm = 0
    for i in range(n):
        sm += ls.pop()
    return sm

def mn(ls,n):
    sm = 0
    for i in range(n):
        sm += ls.pop(0)
    return sm

def soi(ls,n,s):
    if n == 0:
        if s == 0:
            return 1
        else:
            return 0
    else:
        count = 0
        l = len(ls)
        for i in range(l):
            rls = ls[:]
            k = rls.pop(i)
            if s-k >= mn(rls,n-1):
                if s-k <= mx(rls,n-1):
                    count += soi(rls,n-1,s-k)
                else:
                    break
        return count

ls = [i for i in range(101)]
while True:
    n, s = map(int, raw_input().split())
    if n == 0:
        break
    print soi(ls,n,s)

### FIXED CODE ###

ls = [[0]*1001 for i in range(10)]
ls[0][0] = 1
for i in range(101):
	for j in range(9,0,-1):
		for k in range(i,1000):
			ls[j][k] += ls[j-1][k-i] 
	

while True:
	n,s = map(int, raw_input().split())
	if n == 0: break
	print ls[n][s]
### BUGGY CODE ###


S = input()


def calculate(s):
    rs = reversed(s)

    sss = 0
    dict = [0] * 2019
    dict[0] = 1
    for index, c in enumerate(rs):
        sss = sss + int(c) * 10 ** index
        mod = sss % 2019
        dict[mod] = dict[mod] + 1

    res = 0
    for d in dict:
        if d > 1:
            res = res + d -1

    print(res)


calculate(S)


### FIXED CODE ###

s = input()[::-1] # 入力文字列を逆順でsに格納

counts = [0] * 2019
counts[0] = 1

num, d = 0, 1

for char in s:
    num += int(char) * d
    num %= 2019
    d *= 10
    d%= 2019
    counts[num] += 1

ans = 0
for cnt in counts:
    ans += cnt * (cnt - 1) // 2

print(ans) # 答えの出力
### BUGGY CODE ###

l, r = map(int,input().split())
min_val = float('inf')
for i in range(l,r):
  for j in range(l+1, r+1):
    min_val = min(min_val, (i*j)%2019)
    if r-l>=2019 and min_val==0:
      break
print(min_val)

### FIXED CODE ###

l, r = map(int,input().split())
min_val = float('inf')
for i in range(l,r):
  for j in range(l+1, r+1):
    tmp = i*j%2019
    if min_val>tmp:
      min_val = tmp
    if min_val == 0:
      break
  if min_val == 0:
    break
print(min_val)
### BUGGY CODE ###

import fractions
k = int(input())
cnt = 0
for i in range(1,k+1):
    for j in range(1,k+1):
        for m in range(1,k+1):
            cnt += fractions.gcd(i,fractions.gcd(j,m))
print(cnt)

### FIXED CODE ###

from math import gcd
k = int(input())
cnt = 0
for i in range(1,k+1):
    for j in range(1,k+1):
        tmp = gcd(i,j)
        for m in range(1,k+1):
            cnt += gcd(m,tmp)
print(cnt)
### BUGGY CODE ###

n = int(input())
s = [input() for i in range(n)]
s.sort()
l = sorted(set(s))
ans = 0
ans_l = []

for i in l:
    if s.count(i) > ans:
      ans_l.clear()
      ans_l.append(i)
      ans = s.count(i)
    elif s.count(i) == ans:
      ans_l.append(i)
    del s[:s.count(i)-1]
      

print("\n".join(ans_l))

### FIXED CODE ###

from collections import Counter

n = int(input())
S = [input() for i in range(n)]

s = Counter(S)
max_cnt = max(s.values())
names = [name for name, cnt in s.items() if cnt == max_cnt]
names.sort()

print("\n".join(names))
### BUGGY CODE ###

##72_C
n = int(input())
a = [int(i) for i in input().split()]


cnt_list = []
minn = min(a)
maxx= max(a)

for x in range(minn - 1, maxx + 2):
    cnt = 0
    for i in range(n):
        if a[i] == x or a[i] + 1 == x or a[i] - 1 == x:
            cnt += 1
    cnt_list.append(cnt)

print(max(cnt_list))

### FIXED CODE ###

from collections import Counter
n = int(input())
a = [int(i) for i in input().split()]
b = []
for i in a:
    b.append(i + 1)
    b.append(i)
    b.append(i - 1)
##辞書型 キーに要素、値に出現回数を出力
c = Counter(b)
##most_comonn (要素, 出現回数)という形のタプルを出現回数順に並べたリストを返す
##出現回数が最も多いものは[0],出現回数のみを出力するので[1]
print(c.most_common()[0][1])
### BUGGY CODE ###

import numpy as np
S = input()[::-1]
mod = 1000000007

n = len(S)
a = S[0]
x = np.zeros(26, int)
l = [[13 - i * j % 13 for j in range(0, 10)] for i in [1, 10, 9, 12, 3, 4]] * (n // 6 + 1)
if a == "?":
    x[0:10] += 1
else:
    x[int(a)] += 1
for s, l_ in zip(S[1:], l[1:]):
    x[13:] = x[:13]
    if s == "?":
        x[:13] = sum(x[v:v+13] for v in l_)
    else:
        v = l_[int(s)]
        x[:13] = x[v:v+13]
    x %= mod
print(x[5])

### FIXED CODE ###

#!python3

LI = lambda: list(map(int, input().split()))

# input
S = input()

MOD = 10 ** 9 + 7


def main():
    n = len(S)
    m = 5
    w = []
    p = 1
    for i in range(n):
        s = S[-1 - i]
        if s == "?":
            w.append(p)
        else:
            m = (m - int(s) * p) % 13
        p = p * 10 % 13

    n = len(w)
    l1 = [0] * 13
    l1[0] = 1
    for i in range(1, n + 1):
        l2 = [0] * 13
        for j in range(10):
            x = w[i - 1] * j % 13
            for k in range(13):
                t = (x + k) % 13
                l2[t] += l1[k]
        l1 = [y % MOD for y in l2]
    
    ans = l1[m]
    print(ans)


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

N = int(input())
UVW = [list(map(int, input().split())) for _ in range(N - 1)]

UVW.sort(key = lambda x: x[0])
color = [2 for _ in range(N)]

while len(UVW) > 0:
  uvw = UVW.pop(0)
  if len(UVW) == N - 2:
    if uvw[2] % 2 == 0:
      color[uvw[0] - 1] = 0
      color[uvw[1] - 1] = 0
    else:
      color[uvw[0] - 1] = 0
      color[uvw[1] - 1] = 1
  if uvw[2] % 2 == 0:
    if color[uvw[0] - 1] != 2:
      color[uvw[1] - 1] = color[uvw[0] - 1]
    elif color[uvw[1] - 1] != 2:
      color[uvw[0] - 1] = color[uvw[1] - 1]
    else:
      UVW.append(uvw)
  else:
    if color[uvw[0] - 1] != 2:
      color[uvw[1] - 1] = color[uvw[0] - 1] ^ 1
    elif color[uvw[1] - 1] != 2:
      color[uvw[0] - 1] = color[uvw[1] - 1] ^ 1
    else:
      UVW.append(uvw)

for c in color:
  print(c)

### FIXED CODE ###

N = int(input())
to = [[] for _ in range(N)]
cost = [[] for _ in range(N)]

for _ in range(N - 1):
  a, b, w = map(int, input().split())
  a -= 1
  b -= 1
  to[a].append(b)
  to[b].append(a)
  cost[a].append(w)
  cost[b].append(w)

ans = [-1 for _ in range(N)]
queue = []
queue.append(0)
while len(queue) > 0:
  v = queue.pop(0)
  for i in range(len(to[v])):
    u = to[v][i]
    w = cost[v][i]
    if ans[u] != -1:
      continue
    ans[u] = (ans[v] + w) % 2
    queue.append(u)

for a in ans:
  print(a)
### BUGGY CODE ###

n = int(input())
print(sum(range(0, n)))

### FIXED CODE ###

n = int(input())
print(int(n * (n - 1) // 2))
### BUGGY CODE ###

# -*- coding: utf-8 -*-
 
N, K = map(int, input().split())
 
h = list(map(int, input().split()))
 
dp = [0]
 
for n in range(1, N):
    temp = float("inf")
    for k in range(1,K+1):
        if n-k < 0:
            break
        temp = min(temp, dp[n-k] + abs(h[n]-h[n-k]))
    dp += [temp]
#print(dp)
print(dp[N-1])

### FIXED CODE ###

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

import numpy as np

N, K = map(int, input().split())
 
h = np.array(list(map(int, input().split())))
 
dp = np.zeros(N)
 
for n in range(1, N):
    k = min(K, n)
    temp = np.min(dp[n-k:n] + np.abs(h[n]-h[n-k:n]))
    dp[n] = temp
print(int(dp[-1]))
### BUGGY CODE ###

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

l.sort()
cnt = 0
import itertools
import bisect
for a, b in itertools.combinations(l, r=2):
  l_woab = list(set(l) - set([a, b]))
  l_woab.sort()

  if False:
    print(a, b, end=' : ')
    print(l_woab)
    print(bisect.bisect_left(l_woab, a + b ), bisect.bisect_left(l_woab, b))
  
  cnt += max(bisect.bisect_left(l_woab, a + b ) -
             bisect.bisect_left(l_woab, b), 0)

print(cnt)


### FIXED CODE ###

import bisect

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

l.sort()

ans=0
for i in range(n):
  for j in range(i+1,n):
    a=l[i]
    b=l[j]
    le=bisect.bisect_left(l,max(a-b,b-a)+1)
    ri=bisect.bisect_right(l,a+b-1)
    #print(le,ri)
    f=0
    if le<=i<=ri:
      f-=1
    if le<=j<=ri:
      f-=1
    if ri-le+f>0:
      ans+=ri-le+f
    #print(a,b,ans)

print(ans//3)
### BUGGY CODE ###

n, m = [int(i) for i in input().split()]
a = []
for i in range(m):
  a.append(int(input()))

if 1 in a:
  step = [1,0]
else:
  step = [1,1]

for i in range(2, n + 1):
  if i in a:
    step.append(0)
  else:
    step.append(step[-1] + step[-2])
    
print(step[-1]%1000000007)

### FIXED CODE ###

n, m = [int(i) for i in input().split()]

a = [int(input()) for i in range(m)]

a.append(n + 1)
a.insert(0, -1)
b = [i-j-1 for i,j in zip(a[1:], a[:-1])]

mm = max(b) - 1

step = [0,1]

for i in range(mm):
	step.append(step[-1] + step[-2])

mul = 1
for i in b:
	mul *= step[i]
	
print(mul%1000000007)
### BUGGY CODE ###

N = int(input())
A = tuple(map(int, input().split(' ')))
MOD = 10 ** 9 + 7

zeros = [0] * 60
ones = [0] * 60

for a in A:
    for i, bit in enumerate(reversed(format(a, '060b'))):
        if bit == '0':
            zeros[i] += 1
        else:
            ones[i] += 1

base = 1
ans = 0

for i in range(len(zeros)):
    ans += zeros[i] * ones[i] * base
    ans %= MOD
    base *= 2
    base %= MOD

print(ans)


### FIXED CODE ###

N = int(input())
A = tuple(map(int, input().split(' ')))
MOD = 10 ** 9 + 7

zeros = [0] * 60
ones = [0] * 60

for a in A:
    for i, bit in enumerate(reversed(format(a, '060b'))):
        if bit == '0':
            zeros[i] += 1
        else:
            ones[i] += 1

base = 1
ans = 0

for i in range(len(zeros)):
    ans += zeros[i] * ones[i] * base
    ans %= MOD
    base *= 2
    base %= MOD

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

# -*- coding: utf-8 -*-
N, M = map(int, input().split(' '))
graph = [[] for _ in range(N)]
for i in range(M):
    l, r, d = map(int, input().split(' '))
    l -= 1
    r -= 1
    graph[l].append((r, d))
    graph[r].append((l, -d))

dsts = [float('inf') for _ in range(N)]

for n in range(N):
    if dsts[n] != float('inf'):
        continue

    buf = [n]
    dsts[n] = 0
    while buf:
        src = buf.pop(0)
        for dst, d, in graph[src]:
            next_d = dsts[src] + d

            if dsts[dst] == float('inf'):
                dsts[dst] = next_d
                buf.append(dst)

            elif dsts[dst]  != next_d:
                # print(dsts)
                # print(dst, src, dsts[dst], dsts[src], d, next_d)
                print("No")
                exit()

print("Yes")




### FIXED CODE ###

# -*- coding: utf-8 -*-
from collections import deque
N, M = map(int, input().split(' '))
graph = [[] for _ in range(N)]
for i in range(M):
    l, r, d = map(int, input().split(' '))
    l -= 1
    r -= 1
    graph[l].append((r, d))
    graph[r].append((l, -d))

dsts = [float('inf') for _ in range(N)]

for n in range(N):
    if dsts[n] != float('inf'):
        continue

    buf = deque()
    buf.append(n)
    dsts[n] = 0
    while buf:
        src = buf.popleft()
        for dst, d, in graph[src]:
            next_d = dsts[src] + d

            if dsts[dst] == float('inf'):
                dsts[dst] = next_d
                buf.append(dst)

            elif dsts[dst]  != next_d:
                # print(dsts)
                # print(dst, src, dsts[dst], dsts[src], d, next_d)
                print("No")
                exit()

print("Yes")
### BUGGY CODE ###

import numpy as np
h, w = map(int, input().split())
maze = []

for i in range(h):
    maze.append(list(input()))


def bfs(start: list):
    global h, w, maze
    length = np.array([[-1 for _ in range(w)] for _ in range(h)])
    check = set()
    queue = [start]
    depth = 0
    res = -1
    while len(queue) > 0:
        [x, y, bx, by] = queue.pop(0)
        check.add((x, y))
        length[x][y] = length[bx][by] + 1
        res = max(res, length[x][y])

        depth += 1
        target = []
        if x != 0:
            target.append((x - 1, y))
        if x != h - 1:
            target.append((x + 1, y))
        if y != 0:
            target.append((x, y - 1))
        if y != w - 1:
            target.append((x, y + 1))

        for t in target:
            if t not in check:
                if maze[t[0]][t[1]] == ".":
                    queue.append([t[0], t[1], x, y])

    return res


ans = -1

for i in range(h):
    for j in range(w):
        if maze[i][j] == ".":
            ans = max(ans, bfs([i, j, i, j]))

print(ans)


### FIXED CODE ###

from collections import deque
h, w = map(int, input().split())
maze = []

for i in range(h):
    maze.append(list(input()))

move = [[-1, 0], [1, 0], [0, -1], [0, 1]]


def bfs(start: list):
    global h, w, maze
    length = [[-1 for _ in range(w)] for _ in range(h)]
    check = [[False for _ in range(w)] for _ in range(h)]
    check[start[0]][start[1]] = True
    queue = deque([start])
    res = -1
    while len(queue) > 0:
        [x, y, bx, by] = queue.popleft()

        length[x][y] = length[bx][by] + 1
        res = max(res, length[x][y])

        for p in move:
            next_x = x + p[0]
            next_y = y + p[1]
            if (next_x < 0)or(next_x == h)or(next_y < 0)or(next_y == w):
                continue
            if not check[next_x][next_y]:
                check[next_x][next_y] = True
                if maze[next_x][next_y] == ".":
                    queue.append([next_x, next_y, x, y])

    return res


ans = -1

for i in range(h):
    for j in range(w):
        if maze[i][j] == ".":
            ans = max(ans, bfs([i, j, i, j]))

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

n=int(input())
a=[int(i) for i in input().split()]
#print(a)

ans=0
for i in range(1,100000+1):
    cnt=a.count(i-1)+a.count(i)+a.count(i+1)
    if ans < cnt:
      ans = cnt

print(ans)



### FIXED CODE ###

from collections import Counter

#tmp_list = [1, 1, 1, 1, 0, 1, 1]


n=int(input())
a=[int(i) for i in input().split()]
b=[i-1 for i in a]
c=[i+1 for i in a]
d=a+b+c

counter = Counter(d)

print(counter.most_common()[0][1])
### BUGGY CODE ###

from collections import deque

h, w = map(int, input().split())
Ch, Cw = map(int, input().split())
Dh, Dw = map(int, input().split())
Ch -= 1
Cw -= 1
Dh -= 1
Dw -= 1
t = [[i for i in range(w)] for j in range(h)]
visited = [[0 for i in range(w)] for j in range(h)] # いったところ
ans = 0
for i in range(h):
  temp = input()
  for j in range(w):
    t[i][j] = temp[j]

d = deque([(Ch, Cw)])
ans = 0
a = [(1,0),(-1,0),(0,1),(0,-1)]

while True:
  # 移動A
  stemp = set()
  while len(d) != 0:
    Th, Tw = d.popleft()
    # s.add((Th, Tw))
    visited[Th][Tw] = 1
    stemp.add((Th, Tw))
    if (Th,Tw) == (Dh, Dw):
      print(ans)
      exit()
    for i, j in a:
      _h,_w = Th + i, Tw + j
      _p = (_h, _w)
      if 0 <= _h < h and 0 <= _w < w and t[_h][_w] == '.' and visited[_h][_w] == 0 and (not (_p) in d):
        d.append(_p)
  # 移動B
  ans += 1
  for Th,Tw in stemp:
    for i in range(-2, 3) :
      for j in range(-2, 3) :
        _h,_w = Th + i, Tw + j
        _p = (_h, _w)
        if 0 <= _h < h and 0 <=  _w < w and t[_h][_w] == '.' and visited[_h][_w] == 0:
          d.append(_p)
  if len(d) == 0:
    print('-1')
    exit()


### FIXED CODE ###

from collections import deque

h, w = map(int, input().split())
Ch, Cw = map(int, input().split())
Dh, Dw = map(int, input().split())
Ch -= 1
Cw -= 1
Dh -= 1
Dw -= 1
t = [[i for i in range(w)] for j in range(h)]
visited = [[0 for i in range(w)] for j in range(h)] # いったところ
ans = 0
for i in range(h):
  temp = input()
  for j in range(w):
    t[i][j] = temp[j]

d = deque([(Ch, Cw)])
ans = 0
a = [(1,0),(-1,0),(0,1),(0,-1)]

while True:
  # 移動A
  stemp = set()
  while len(d) != 0:
    Th, Tw = d.popleft()
    # s.add((Th, Tw))
    visited[Th][Tw] = 1
    stemp.add((Th, Tw))
    if (Th,Tw) == (Dh, Dw):
      print(ans)
      exit()
    for i, j in a:
      _h,_w = Th + i, Tw + j
      _p = (_h, _w)
      if 0 <= _h < h and 0 <= _w < w and t[_h][_w] == '.' and visited[_h][_w] == 0:
        d.append(_p)
        visited[_h][_w] = 1
  # 移動B
  ans += 1
  for Th,Tw in stemp:
    for i in range(-2, 3) :
      for j in range(-2, 3) :
        _h,_w = Th + i, Tw + j
        _p = (_h, _w)
        if 0 <= _h < h and 0 <=  _w < w and t[_h][_w] == '.' and visited[_h][_w] == 0:
          d.append(_p)
  if len(d) == 0:
    print('-1')
    exit()
### BUGGY CODE ###

import sys

# import re
import math
import collections
# import decimal
import bisect
import itertools
import fractions
# import functools
import copy
import heapq
import decimal
# import statistics
import queue

# import numpy as np

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===


def main():
    n = ni()
    a = na()

    a_set = set(a)

    a_cnt = collections.Counter(a)

    a_list = list(a_set)
    a_list.sort()

    ans = 0
    for i, ai in enumerate(a_list):
        if a_cnt[ai] > 1:
            continue
        idx = bisect.bisect_left(a_list, ai // 2)
        if i == idx:
            idx -= 1
        flg = True
        for j in range(idx, -1, -1):
            if ai % a_list[j] == 0:
                flg = False
                break
        if flg:
            ans += 1

    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
# import re
import math
import collections
# import decimal
import bisect
import itertools
import fractions
# import functools
import copy
# import heapq
import decimal
# import statistics
import queue

# import numpy as np

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))

# ===CODE===

eps = 10 ** (-9)


def main():
    n = ni()
    a = na()

    seta = set(a)
    cnta = collections.Counter(a)
    lista = list(seta)
    lista.sort()

    table = [True for _ in range(10 ** 6 + 1)]
    ans = 0

    for ai in lista:
        if table[ai]:
            if cnta[ai] == 1:
                ans += 1
            for i in range(ai, 10 ** 6 + 1, ai):
                table[i] = False

    print(ans)


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

import sys
import os

def file_input():
    f = open('AGC009/input.txt', 'r')
    sys.stdin = f

def main():
    #file_input()
    N=int(input())
    A=[]
    B=[]
    for i in range(N):
        tmp=list(map(int, input().split()))
        A.append(tmp[0])
        B.append(tmp[1])

    cnt=0
    for j in range(N):
        while (A[N-1-j]+cnt)%B[N-1-j]!=0:
            cnt+=1

    print(cnt)

if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
import os

def file_input():
    f = open('AGC009/input.txt', 'r')
    sys.stdin = f

def main():
    #file_input()
    N=int(input())
    A=[]
    B=[]
    for i in range(N):
        tmp=list(map(int, input().split()))
        A.append(tmp[0])
        B.append(tmp[1])

    cnt=0
    for j in range(N):
        # while (A[N-1-j]+cnt)%B[N-1-j]!=0:
        # cnt+=1
        tmp=A[N-1-j]+cnt
        if not tmp==0:
            # cnt=B[N-1-j]
            if tmp<B[N-1-j]:
                cnt+=B[N-1-j]-tmp
            elif tmp%B[N-1-j]!=0:
                cnt+=B[N-1-j]-tmp%B[N-1-j]

    print(cnt)

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

x = input().split()
N = int(x[0])
K = int(x[1])
H = input().split()
H = [int(l) for l in H]

if N <= K:
    print(0)
else:
    for i in range(K):
        m = max(H)
        H.remove(m)
    print(sum(H))

### FIXED CODE ###

x = input().split()
N = int(x[0])
K = int(x[1])
H = input().split()
H = [int(l) for l in H]

if N <= K:
    print(0)
else:
    H = sorted(H,reverse=True)
    print(sum(H[K:]))