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

H, W = map(int, input().split())
S = [input() for i in range(H)]
distW = [[0 for j in range(W)] for i in range(H)]
distH = [[0 for j in range(W)] for i in range(H)]

for i in range(H):
    j = 0
    while j < W:
        if S[i][j]==".":
            dj = 1
            for nj in range(1, W+1):
                if j+nj == W or S[i][j+nj] == "#":
                    for nnj in range(nj):
                        dj = nj
                        distW[i][j+nnj] = nj
                    break
            j += dj
        elif S[i][j]=="#":
            distW[i][j] = 0
            j+=1

for j in range(W):
    i = 0
    while i < H:
        if S[i][j]==".":
            di = 1
            for ni in range(1, H+1):
                if i+ni == H or S[i+ni][j] == "#":
                    di = ni
                    for nni in range(ni):
                        distH[i+nni][j] = ni
                    break
            i += di
        elif S[i][j]=="#":
            distH[i][j] = 0
            i+=1

ans = 0
for i in range(H):
    for j in range(W):
        ans = max(ans, distW[i][j]+distH[i][j]-1)

print(ans)

### FIXED CODE ###

H, W = map(int, input().split())
S = [input() for i in range(H)]
distW = [[0 for j in range(W)] for i in range(H)]
distH = [[0 for j in range(W)] for i in range(H)]

for i in range(H):
    j = 0
    while j < W:
        if S[i][j]==".":
            dj = 1
            for nj in range(1, W+1):
                if j+nj == W or S[i][j+nj] == "#":
                    for nnj in range(nj):
                        dj = nj
                        distW[i][j+nnj] = nj
                    break
            j += dj
        elif S[i][j]=="#":
            distW[i][j] = 0
            j+=1

for j in range(W):
    i = 0
    while i < H:
        if S[i][j]==".":
            di = 1
            for ni in range(1, H+1):
                if i+ni == H or S[i+ni][j] == "#":
                    di = ni
                    for nni in range(ni):
                        distH[i+nni][j] = ni
                    break
            i += di
        elif S[i][j]=="#":
            distH[i][j] = 0
            i+=1

ans = 0
for i in range(H):
    for j in range(W):
        ans = max(ans, distW[i][j]+distH[i][j]-1)

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

import bisect
import math
 
N=int(input())
b1=0

ans=0
 
A=list(map(int, input().split()))
A=sorted(A)
B=list(map(int, input().split()))
B=sorted(B)
C=list(map(int, input().split()))
C=sorted(C)
D=[]

for b in B:
  D.append(len(C)-bisect.bisect_right(C,b))

B.append(math.inf)

for i in range(len(A)):
  b1=bisect.bisect_right(B,A[i])
  for j in range(b1,len(B)-1):
    ans += D[j]

print(ans)

### FIXED CODE ###

import bisect
 
N=int(input())
b1=0
d=0

ans=0
 
A=list(map(int, input().split()))
A=sorted(A)
B=list(map(int, input().split()))
B=sorted(B, reverse=True)
C=list(map(int, input().split()))
C=sorted(C)
D=[]
E=[]

for b in B:
  d=d+len(C)-bisect.bisect_right(C,b)
  D.append(d)

D=sorted(D, reverse= True)  
B=sorted(B)

for a in A:
  if 0 <= bisect.bisect_right(B,a) <= len(D)-1:
    ans += D[bisect.bisect_right(B,a)]
print(ans)
### BUGGY CODE ###

# cook your dish here
import bisect
n = int(input())
a = list(map(int,input().split()))
a.sort()
 

c = [0]*n #使ったら1
 
res = 0
 
for i in range(n-1,-1,-1):
    if c[i] == 0:
        b = 1
        while b <= a[i]:
            b = b*2
        w1 = bisect.bisect_left(a,b-a[i])
        w2 = bisect.bisect_right(a,b-a[i])
        if w2 >w1:
            for p in range(w1,w2):
                if c[p] == 0 and i != p:
                    res += 1
                    c[p] = 1
                    c[i] = 1
                    break
                

print(res)

### FIXED CODE ###

import bisect
 
N = int(input())
A = [int(a) for a in input().split()]
A = sorted(A)
 
c = 0
for i in range(N - 1 , -1, -1):
    if A[i] == int(A[i]):
        b = 1
        while b <= A[i]:
            b <<= 1
 
        j = bisect.bisect_left(A, b - A[i])
        if i > j:
            if b - A[i] == A[j]:
                c += 1
                A[j] = A[j] - 0.5
                A[i] = A[i] + 0.5
print(c)
### BUGGY CODE ###

N=int(input())
a=[]
for i in range(N):
    a.append(int(input()))
for j in range(N):
    k=a.pop(j)
    print(max(a))
    a.insert(0,k)
    
    

### FIXED CODE ###

N=int(input())
mx=int(input())
a=[mx]
for i in range(N-1):
    l=int(input())
    a.append(l)
    mx=max(mx,l)
num=a.index(mx)
a.remove(mx)
mx2=a[0]
for j in range(1,N-1):
    mx2=max(mx2,a[j])
for k in range(N):
    if k==num:
        print(mx2)
    else:
        print(mx)
### BUGGY CODE ###

import sys
input = sys.stdin.readline

count = int(input())
list = list(map(int, input().split()))
sum = list[0]
for i in range(count - 1):
    sum = sum * list[i + 1]

if sum > 1000000000000000000:
    sum = -1

print(sum)

### FIXED CODE ###

from functools import reduce
from operator import mul
import sys
input = sys.stdin.readline

count = int(input())
list = list(map(int, input().split()))
sum = list[0]
if 0 in list:
    print(0)
    exit()
else:
    for i in range(count - 1):
        sum = sum * list[i + 1]
        if sum > 1000000000000000000:
            print(-1)
            exit()


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

a, b, c, d = map(int, input().split())
while True:
    c -= b
    if c == 0:
        print("Yes")
        break
    a -= d
    if a == 0:
        print("No")
        break


### FIXED CODE ###

a, b, c, d = map(int, input().split())
while True:
    c -= b
    if c <= 0:
        print("Yes")
        break
    a -= d
    if a <= 0:
        print("No")
        break
### BUGGY CODE ###

# D Knapsack 1

n, w = map(int,input().split())
wv_list = [[int(x) for x in input().split()] for y in range(n)]

dp = [[float("-Inf")] * (w+1) for _ in range(n+1)]
dp[0] = [0]*(w+1)

for i in range(n):
    _w,_v = wv_list[i]
    for j in range(w+1):
        if j-_w < 0:
            dp[i+1][j] = dp[i][j]
        else:
            dp[i+1][j] = max(dp[i][j], dp[i][j-_w]+_v)

print(dp[n][w])


### FIXED CODE ###

# D Knapsack 1

from collections import deque

n, w = map(int,input().split())
wv_list = deque([[int(x) for x in input().split()] for y in range(n)])

dp = [[float("-Inf")] * (w+1) for _ in range(n+1)]
dp[0] = [0]*(w+1)

for i in range(n):
    _w,_v = wv_list.popleft()
    for j in range(w+1):
        if j-_w < 0:
            dp[i+1][j] = dp[i][j]
        else:
            dp[i+1][j] = max(dp[i][j], dp[i][j-_w]+_v)

print(dp[n][w])
### BUGGY CODE ###

import sys
sys.setrecursionlimit(1000000)

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

broken_step = []
for _ in range(M):
    broken_step.append(int(input()))
    
mod = 1000000007

memo = [-1] * (N+1)

def step_memo(N):
    if N == 0:
        return 1
    if N == 1:
        return 1

    a = 1
    b = 1
    
    if N-1 in broken_step:
        a = 0
    if N-2 in broken_step:
        b = 0
    if N in broken_step:
        a = 0
        b = 0
        
    if memo[N] != -1:
        return memo[N]
    memo[N] =  (a * step_memo(N-1) + b * step_memo(N-2)) % mod
    return (a * step_memo(N-1) + b * step_memo(N-2)) % mod
  
print(step_memo(N))


### FIXED CODE ###

N, M = map(int, input().split())
import sys
sys.setrecursionlimit(10000000)

mod = 1000000007

memo = [-1] * (N+1)

for _ in range(M):
    broken_step = int(input())
    memo[broken_step] = 0
    
memo[0] = 1
if memo[1] == -1:
    memo[1] = 1

def step_memo(N):
    
    if memo[N] != -1:
        return memo[N]
    
    memo[N] =  (step_memo(N-1) + step_memo(N-2)) % mod
    return (step_memo(N-1) + step_memo(N-2)) % mod
  
print(step_memo(N))
### BUGGY CODE ###

from collections import deque
import sys
sys.setrecursionlimit(4100000)
n, m, k = map(int, input().split())
F = [deque([]) for i in range(n)] #Friend
B = [deque([]) for i in range(n)] #Block
#友達関係
for i in range(m):
    a, b = map(int, input().split())
    F[a-1].append(b)
    F[b-1].append(a)

#ブロック関係
for i in range(k):
    c, d = map(int, input().split())
    B[c-1].append(d)
    B[d-1].append(c)
#print('F=',F)
#print('B=',B)

def using_DFS(p):
    if G[p] == 0:
        G[p] = num
        for j in F[p]:
            using_DFS(j-1)
    else:
        pass

#DFSで連結部分ごとのグループに分ける
G = [0] * n #Group
S = deque([])   #Size
num = 0
for i in range(n):
    if G[i] == 0:
        num += 1
        t = 0
        using_DFS(i)
        S.append(G.count(num))
    else:
        pass
#print('G=',G)
#print('S=',S)

#答えの計算
for i in range(n):
    ans = S[G[i]-1] - 1
    #ブロック関係がこの中で何人いるか
    for j in B[i]:
        if G[j-1] == G[i]:
            ans -= 1
        else:
            pass
    #直接の友達関係がこの中で何人いるか
    for k in F[i]:
        if G[k-1] == G[i]:
            ans -= 1
        else:
            pass
    print(ans)

### FIXED CODE ###

import sys
from collections import deque, Counter, defaultdict
from fractions import gcd
input = lambda: sys.stdin.readline().rstrip()

def eprint(s):
    sys.stderr.write('DEBUG: {}'.format(s))
    return

def main():
    n, m, k = map(int, input().split())
    fgraph = [list() for i in range(n)]
    bgraph = [list() for i in range(n)]
    cgraph = [list() for i in range(n)]
    
    rks = [None] *n
    sys.setrecursionlimit(10**9)
    # r: どの連結成分に存在するかをメモするid
    def dfs(graph,s,r):
        if rks[s] is None:
            rks[s] = r
        for i in range(len(graph[s])):
            if rks[graph[s][i]-1] is not None:
                continue
            dfs(graph, graph[s][i]-1,r)

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

    # print(fgraph)
    #print(bgraph)
    # 連結成分に対してid的なindexをつける
    c = -1
    for i in range(n):
        if rks[i] is None:
            c += 1
            dfs(fgraph, i, c)
    
    for i in range(k):
        c,d = map(int, input().split())
        if rks[c-1] == rks[d-1]:
            bgraph[d-1].append(c)
            bgraph[c-1].append(d)

    counter = Counter(rks)
    for i in range(n):
        # counter[rks[i]] 連結成分のサイズ
        # len(fgraph[i]) 友達の数
        # len(bgraph[i]) 連結成分内のブロックの数
        # 1 自分
        print(counter[rks[i]] - len(fgraph[i]) - len(bgraph[i]) - 1)

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

n = int(input())
li = list(map(int,input().split()))
li1 = []
for i in range(len(li)):
    if li.count(li[i])>=2:
        li1.append(li[i])
li1 = sorted(list(set(li1)))[::-1]
if len(li1)>=2:
    print(li1[0]*li1[1])
else:
    print(0)

### FIXED CODE ###

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

a,b = 0,0
i = 0
while i<=len(li)-2:
    if li[i] == li[i+1] and a == 0:
        a = li[i]
        i += 2
    elif li[i] == li[i+1]  and a != 0:
        b = li[i]
        break
    elif li[i] != li[i+1]:
        i += 1
print(a*b)
### BUGGY CODE ###

from collections import deque
n,m,k=map(int,input().split())
friend={i:set() for i in range(n)}
for i in range(m):
  a,b=map(int,input().split())
  friend[a-1].add(b-1)
  friend[b-1].add(a-1)
block={i:set() for i in range(n)}
for i in range(k):
  c,d=map(int,input().split())
  block[c-1].add(d-1)
  block[d-1].add(c-1)
checked=set()
belongs=[-1 for i in range(n)]
renketsu=[]
b = 0
for i in range(n):
  if i in checked:
    continue
  g = set()
  queue = deque([i])
  while(queue):
    t = queue.popleft()
    if t in checked:
      continue
    checked.add(t)
    g.add(t)
    belongs[t] = b
    queue.extend(friend[t])
  renketsu.append(g)
  b += 1
fnum=[]
for i in range(n):
  fnum.append(len( renketsu[belongs[i]] - friend[i] - block[i])-1)
print(' '.join(map(str,fnum)))

### FIXED CODE ###

import sys
input = sys.stdin.readline

def connected_components(graph):
  seen = set()
  def component(n):
    nodes = set([n])
    while nodes:
      n = nodes.pop()
      seen.add(n)
      nodes |= graph[n] - seen
      yield n
  for n in graph:
    if n not in seen:
      yield component(n)

n,m,k=map(int,input().split())
friend={i:set() for i in range(n)}
for i in range(m):
  a,b=map(int,input().split())
  friend[a-1].add(b-1)
  friend[b-1].add(a-1)
block={i:set() for i in range(n)}
for i in range(k):
  c,d=map(int,input().split())
  block[c-1].add(d-1)
  block[d-1].add(c-1)
c = connected_components(friend)
fnum=[-1 for i in range(n)]
for graph in c:
  s = set(graph)
  for x in s:
    fnum[x] = len(s) - len(s & block[x]) -len(friend[x])- 1
print(' '.join(map(str,fnum)))
### BUGGY CODE ###

import numpy as np
n = list(map(int,input().split()))
a = list(map(int,input().split()))
a = np.array(a)

for i in range(n[1]):
    a[a.argmax()] = a[a.argmax()]//2 
print(sum(a))


### FIXED CODE ###


N, M = map(int,input().split())
A = list(-int(i) for i in input().split())
import heapq

heapq.heapify(A)
for _ in range(M):
    a = heapq.heappop(A)//(-2)
    heapq.heappush(A,-a)

print(-sum(A))
### BUGGY CODE ###

#!/usr/bin/env python3
def main():
    import sys

    sys.setrecursionlimit(10 ** 6)

    def dfs(now: int, depth: int):
        """深度を記録しながらDFS"""
        if temp_dis[now] <= depth:
            return
        temp_dis[now] = min(temp_dis[now], depth)
        for next in G[now]:
            dfs(next, depth + 1)
        
    N, X, Y = map(int, input().split())

    G = [[1]] + [[x - 1, x + 1] for x in range(1, N - 1)] + [[N - 2]]
    G[X - 1].append(Y - 1)
    G[Y - 1].append(X - 1)
    # print(G)

    # distance = [set() for _ in [0] * N]
    cnt_dis = [0] * N
    for i in range(N):
        temp_dis = [N] * N
        dfs(i, 0)
        # print(i, temp_dis)
        for j in range(N):
            # distance[temp_dis[j]].add((i, j) if i <= j else (j, i))
            cnt_dis[j] += temp_dis.count(j)
    
    # for ans in distance[1:]:
    #     print(len(ans))
    for ans in cnt_dis[1:]:
        print(ans // 2)


if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
def main():
    from collections import deque
        
    N, X, Y = map(int, input().split())

    G = [[1]] + [[x - 1, x + 1] for x in range(1, N - 1)] + [[N - 2]]
    G[X - 1].append(Y - 1)
    G[Y - 1].append(X - 1)

    dist = [[-1] * N for _ in [0] * N]
    for s in range(N):
        q = deque([s])
        dist[s][s] = 0
        while q:
            v = q.popleft()
            for nv in G[v]:
                if dist[s][nv] == -1:
                    dist[s][nv] = dist[s][v] + 1
                    q.append(nv)
    res = [0] * N
    for i in range(N):
        for j in range(i + 1, N):
            res[dist[i][j]] += 1
    for d in range(1, N):
        print(res[d])


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

n = int(input())
l = sorted([int(x) for x in input().split()])

ret = 0

for i in range(len(l)):
	a = l[i]
	for j in range(i + 1, len(l)):
		b = l[j]
		for k in range(j+1, len(l)):
			c = l[k]
			if c >= a+b:
				break
			if a<b+c and b<a+c and c<a+b:
				ret += 1

print(ret)

### FIXED CODE ###

n = int(input())
a = sorted([int(x) for x in input().split()])
ret = 0
for i in range(n-1, 0, -1):
	l = 0
	r = i-1
	while l<r:
		if a[l]+a[r]>a[i]:
			ret += r - l
			r -= 1
		else:
			l += 1

print(ret)
### BUGGY CODE ###

import sys
import math
import itertools
import collections
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()

NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()

def main():
    R,C = NMI()
    #sy, sx = NMI()
    #gy, gx = NMI()
    board = [list(input()) for _ in range(R)]
    
    ans = 0

    #移動4方向のベクトル
    dx = [1, 0, -1, 0]
    dy = [0, 1, 0, -1]

    #すべての点をINFで初期化
    INF = R*C*2
    distance = [[INF for _ in range(C)] for _ in range(R)]

    #地点を保存するqueを作成
    que = deque([])
    
    #スタート地点を取り出す
    for r in range(R):
        for c in range(C):
            if board[r][c] == '#':
                que.append((r,c))
                #スタート地点の距離は0
                distance[r][c] = 0

    #queが空になるまでループ
    while len(que) != 0:
        #取り出してきた状態
        pop = que.popleft()

        #移動4方向をループ
        for i in range(len(dx)):
            #移動した後の点をny,nxとする
            ny = pop[0]+dy[i]
            nx = pop[1]+dx[i]

            #nyが0以上R未満   nxが0以上C未満   まだ訪れたことがない
            if 0<= ny < R and 0 <= nx < C and distance[ny][nx] == INF:
                #つまり移動可能でまだ行ったことがなければqueへ入れる
                que.append((ny,nx))
                #その距離をもとのpopの最短距離+1でdistanceに記録
                distance[ny][nx] = distance[pop[0]][pop[1]]+1
                if ans < distance[ny][nx]:
                    ans = distance[ny][nx]
                
    print(ans)

if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys
import math
import itertools
import collections
from collections import deque

sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()

NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()

def main():
    R,C = NMI()
    #sy, sx = NMI()
    #gy, gx = NMI()
    board = [list(input()) for _ in range(R)]
    
    ans = 0

    #移動4方向のベクトル
    dx = [1, 0, -1, 0]
    dy = [0, 1, 0, -1]

    #すべての点をINFで初期化
    INF = R*C*2
    distance = [[INF for _ in range(C)] for _ in range(R)]

    #地点を保存するqueを作成
    que = deque([])
    
    #スタート地点を取り出す
    for r in range(R):
        for c in range(C):
            if board[r][c] == '#':
                que.append((r,c))
                #スタート地点の距離は0
                distance[r][c] = 0

                
    cnt = 0
    
    #queが空になるまでループ
    while len(que) != 0:
        #取り出してきた状態
        pop = que.popleft()
        
        #移動4方向をループ
        for i in range(len(dx)):
            #移動した後の点をny,nxとする
            ny = pop[0]+dy[i]
            nx = pop[1]+dx[i]

            #nyが0以上R未満   nxが0以上C未満   まだ訪れたことがない
            if 0<= ny < R and 0 <= nx < C and distance[ny][nx] == INF:
                #つまり移動可能でまだ行ったことがなければqueへ入れる
                que.append((ny,nx))
                #その距離をもとのpopの最短距離+1でdistanceに記録
                distance[ny][nx] = distance[pop[0]][pop[1]]+1
                if ans < distance[ny][nx]:
                    ans = distance[ny][nx]
                
    print(ans)


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

import math
from functools import reduce
def gcd(*numbers):
    return reduce(math.gcd, numbers)
k=int(input())
t=0
for i in range(k):
  for j in range(k):
    for l in range(k):
      t+=gcd((i+1),(j+1),(l+1))
print(t)

### FIXED CODE ###

i=int(input())
a=[0, \
1	, \
9	, \
30	, \
76	, \
141	, \
267	, \
400	, \
624	, \
885	, \
1249	, \
1590	, \
2208	, \
2689	, \
3411	, \
4248	, \
5248	, \
6081	, \
7485	, \
8530	, \
10248	, \
11889	, \
13687	, \
15228	, \
17988	, \
20053	, \
22569	, \
25242	, \
28588	, \
31053	, \
35463	, \
38284	, \
42540	, \
46581	, \
50893	, \
55362	, \
61824	, \
65857	, \
71247	, \
76884	, \
84388	, \
89349	, \
97881	, \
103342	, \
111528	, \
120141	, \
128047	, \
134580	, \
146316	, \
154177	, \
164817	, \
174438	, \
185836	, \
194157	, \
207927	, \
218812	, \
233268	, \
245277	, \
257857	, \
268182	, \
288216	, \
299257	, \
313635	, \
330204	, \
347836	, \
362973	, \
383709	, \
397042	, \
416448	, \
434025	, \
456967	, \
471948	, \
499740	, \
515581	, \
536073	, \
559758	, \
583960	, \
604833	, \
633651	, \
652216	, \
683712	, \
709065	, \
734233	, \
754734	, \
793188	, \
818917	, \
846603	, \
874512	, \
909496	, \
933081	, \
977145	, \
1006126	, \
1041504	, \
1073385	, \
1106467	, \
1138536	, \
1187112	, \
1215145	, \
1255101	, \
1295142	, \
1342852	, \
1373253	, \
1422195	, \
1453816	, \
1502376	, \
1553361	, \
1595437	, \
1629570	, \
1691292	, \
1726717	, \
1782111	, \
1827492	, \
1887772	, \
1925853	, \
1986837	, \
2033674	, \
2089776	, \
2145333	, \
2197483	, \
2246640	, \
2332104	, \
2379085	, \
2434833	, \
2490534	, \
2554600	, \
2609625	, \
2693919	, \
2742052	, \
2813988	, \
2875245	, \
2952085	, \
3003306	, \
3096024	, \
3157249	, \
3224511	, \
3306240	, \
3388576	, \
3444609	, \
3533637	, \
3591322	, \
3693924	, \
3767085	, \
3842623	, \
3912324	, \
4027884	, \
4102093	, \
4181949	, \
4270422	, \
4361548	, \
4427853	, \
4548003	, \
4616104	, \
4718640	, \
4812789	, \
4918561	, \
5003286	, \
5131848	, \
5205481	, \
5299011	, \
5392008	, \
5521384	, \
5610705	, \
5739009	, \
5818390	, \
5930196	, \
6052893	, \
6156139	, \
6239472	, \
6402720	, \
6493681	, \
6623853	, \
6741078	, \
6864016	, \
6953457	, \
7094451	, \
7215016	, \
7359936	, \
7475145	, \
7593865	, \
7689630	, \
7886244	, \
7984165	, \
8130747	, \
8253888	, \
8403448	, \
8523897	, \
8684853	, \
8802826	, \
8949612	, \
9105537	, \
9267595	, \
9376656	, \
9574704	, \
9686065	, \
9827097	, \
9997134	, \
10174780	, \
10290813	, \
10493367	, \
10611772	, \
10813692]
print(a[i])
### BUGGY CODE ###

import numpy as np
from collections import Counter
N = int(input())
A = list(map(int, input().split()))

C = Counter(A)
if C[1] == 1:
    print(1)
    exit()
if C[1] >= 2:
    print(0)
    exit()

U = 10 ** 6 + 1
memo = np.zeros(U, dtype=int)
tmp = np.arange(U)
ans = 0

for k in sorted(C.keys()):
    v = C[k]
    if v >= 2:
        ans += v
        if not memo[k]:
            memo[tmp % k == 0] = 1
        continue
    if memo[k]:
        ans += 1
    else:
        memo[tmp % k == 0] = 1

print(N-ans)

### FIXED CODE ###

from collections import Counter
U = 10 ** 6 + 1

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

C = Counter(A)
dp = [0] * U

ans = 0
for k in sorted(C.keys()):
    if dp[k]:
        continue
    if C[k] == 1:
        ans += 1
    for i in range(k, U, k):
        dp[i] = 1

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

n, k = map(int, input().split())
cou = 0
i = 0
flag = 0
if k != 1:
  while flag < 1:
    if n < abs(n-k):
      flag = 1
    else:
      n = abs(n-k)
      i += 1
elif k == 1:
  n = 0
print(n)

### FIXED CODE ###

n, k = map(int, input().split())

q = n // k
mod = n % k
ans_mod = k-mod

if mod<ans_mod:
  print(mod)
else:
  print(ans_mod)
### BUGGY CODE ###

N, K= map(int, input().split())
h = list(map(int, input().split()))
DP = [float('inf')]*N
DP[0] = 0
for i in range(N-1):
  for j in range(min(K,N-1-i)):
    DP[i+j+1] = min(DP[i+j+1], DP[i] + abs(h[i+j+1] - h[i]))  
print(DP[-1])


### FIXED CODE ###

N, K= map(int, input().split())
h = list(map(int, input().split()))
DP = [float('inf')]*N
DP[0] = 0
for i in range(N-1):
  L = N-1-i
  for j in range(min(K,L)):
    DP[i+j+1] = min(DP[i+j+1], DP[i] + abs(h[i+j+1] - h[i]))  
print(DP[-1])
### BUGGY CODE ###

n=int(input())
a=[[int(_),0] for _ in input().split()]
for i in range(n): a[i][1]=i
a.sort(reverse=True)
dp=[[0 for _ in range(n)] for __ in range(n)]
for l in range(n):
    for r in range(n):
        if l+r < n:
            if l<n-1:dp[l+1][r]=max(dp[l+1][r], dp[l][r]+a[l+r][0]*abs(a[l+r][1]-l))
            if r<n-1:dp[l][r+1]=max(dp[l][r+1], dp[l][r]+a[l+r][0]*abs(a[l+r][1]-(n-r-1)))
print(max([dp[i][n-i] for i in range(1,n)]))

### FIXED CODE ###

n=int(input())
a=[[int(_),0] for _ in input().split()]
for i in range(n): a[i][1]=i
a.sort(reverse=True)
dp=[[0 for _ in range(n)] for __ in range(n)]
for l in range(n):
    for r in range(n):
        if l+r < n:
            if l<n-1:dp[l+1][r]=max(dp[l+1][r], dp[l][r]+a[l+r][0]*abs(a[l+r][1]-l))
            if r<n-1:dp[l][r+1]=max(dp[l][r+1], dp[l][r]+a[l+r][0]*abs(a[l+r][1]-(n-r-1)))
print(max([dp[i][n-i] for i in range(1,n)]))
### BUGGY CODE ###

N = int(input())
ans=0

#初項a、公差d=a、n項までの和
for a in range(1,N+1):
    n=N//a
    S=((2*a+(n-1)*a)*n)//2
    ans=ans+S
print(ans)


### FIXED CODE ###

N = int(input())
ans=0

#初項a、公差d=a、n項までの和
for a in range(1,N+1):
    n=N//a
    ans=(n*(2*a+(n-1)*a))//2+ans
print(ans)
### BUGGY CODE ###

def check(target_num, num_list):
    for i in num_list:
        if i < target_num:
            return 0
    return 1

def solve(n, p_list):

    count = 0
    for i in range(n):
        target_num = p_list.pop()
        count += check(target_num, p_list)
    return count

if __name__ == "__main__":

    n = int(input())
    p_list = [int(i) for i in input().split()]
    ans = solve(n, p_list)
    print(ans)

### FIXED CODE ###

def solve(n, p_list):

    count = 0
    j = 2 * 10**5 +1
    for i in p_list:
        if j > i:
            count += 1
            j = i

    return count

if __name__ == "__main__":

    n = int(input())
    p_list = [int(i) for i in input().split()]
    ans = solve(n, p_list)
    print(ans)