Harryxun/stf_run huggingface dataset:
import sys
sys.setrecursionlimit(10**6)

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

balls=[]
for i in range(N):
  balls.append( [int(i) for i in input().split()])

salist=[]
for i in range(1,len(balls),1):
  sax = balls[i][0]-balls[i-1][0]
  say = balls[i][1]-balls[i-1][1]
  salist.append([sax,say])
  
balls.reverse()
costs=[]
for i,sa in enumerate(reversed(salist)):
  cost=1
  for i in range(0,len(balls)-1,1):
    if balls[i+1][0]!=balls[i][0]-sa[0] and balls[i+1][1]!=balls[i][1]-sa[1]:
      cost+=1
  costs.append(cost)

print(min(costs))

### FIXED CODE ###

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

balls=[]
for i in range(N):
  balls.append( [int(i) for i in input().split()])

ans=0
for i in range(0,N-1):
  for j in range(i+1,N):
    sax = balls[j][0]-balls[i][0]
    say = balls[j][1]-balls[i][1]
    merge=0
    for k in range(0,N):
      if([balls[k][0]+sax,balls[k][1]+say] in balls):
          merge+=1
    ans=max(ans,merge)
print(N-ans)
def solve2(aa,bb,cc,dd,lv):
  a,b,c,d=aa,bb,cc,dd
  m=3**(lv-1)
  mm=2*m
  ab=3*((0--b//m)-1)+(0--a//m)
  cd=3*((0--d//m)-1)+(0--c//m)
  if ab>cd:
    ab,cd=cd,ab
    a,b,c,d=c,d,a,b
  if ab==cd:
    mx=m*((0--a//m)-1)
    my=m*((0--b//m)-1)
    a-=mx
    b-=my
    c-=mx
    d-=my
    return [2,[a,b,c,d]]
  if ab==2 and cd==8:
    ans=abs(b-d)+min(abs(a-m)+abs(c-m),abs(a-mm)+abs(c-mm))
    return [0,ans]
  if ab==4 and cd==6:
    ans=abs(a-c)+min(abs(b-m)+abs(d-m),abs(b-mm)+abs(d-mm))
    return [0,ans]
  if ab==1:
  if cd==4 or cd==7:
      ans=abs(m-d)
      d=m
      return [1,ans,[a,b,c,d]]
    if cd==2 or cd==3:
      ans=abs(m-c)
      c=m
      return [1,ans,[a,b,c,d]]
  if ab==2 and cd==3:
    a-=m
    c-=m
    ans=abs(m-c)
    c=m
    return [1,ans,[a,b,c,d]]
  if ab==3 and (cd==6 or cd==9):
    a-=mm
    c-=mm
    ans=abs(m-d)
    d=m
    return [1,ans,[a,b,c,d]]
  if ab==4 and cd==7:
    b-=m
    d-=m
    ans=abs(m-d)
    d=m
    return [1,ans,[a,b,c,d]]
  if ab==6 and cd==9:
    a-=mm
    c-=mm
    b-=m
    d-=m
    ans=abs(m-d)
    d=m
    return [1,ans,[a,b,c,d]]
  if ab==7 and (cd==8 or cd==9):
    b-=mm
    d-=mm
    ans=abs(m-c)
    c=m
    return [1,ans,[a,b,c,d]]
  if ab==8 and cd==9:
    a-=m
    c-=m
    b-=mm
    d-=mm
    ans=abs(m-c)
    c=m
    return [1,ans,[a,b,c,d]]
  ans=abs(a-c)+abs(b-d)
  return [0,ans]

def solve(aa,bb,cc,dd):
  a,b,c,d=aa,bb,cc,dd
  ans=0
  for lv in range(30,0,-1):
    re=solve2(a,b,c,d,lv)
    if re[0]==2:
      a,b,c,d=re[1]
    if re[0]==1:
      ans+=re[1]
      a,b,c,d=re[2]
    if re[0]==0:
      return ans+re[1]
  return ans+abs(a-c)+abs(b-d)

q=int(input())
for _ in range(q):
  a,b,c,d=map(int,input().split())
  print(solve(a,b,c,d))


### FIXED CODE ###

def solve(aa,bb,cc,dd):
  a,b,c,d=aa,bb,cc,dd
  mx=my=0
  for i in range(1,31):
    if a==c and a%3==2 and abs(b-d)>=2:mx=i
    if b==d and b%3==2 and abs(a-c)>=2:my=i
    a=0--a//3
    b=0--b//3
    c=0--c//3
    d=0--d//3
  a,b,c,d=aa,bb,cc,dd
  if mx==my==0:return abs(a-c)+abs(b-d)
  if mx<my:
    ans=abs(a-c)
    mi=3**(my-1)
    ma=2*3**(my-1)+1
    bd=(3**my)*((0--b//(3**my))-1)
    b-=bd
    d-=bd
    ans+=min(abs(mi-b)+abs(mi-d),abs(ma-b)+abs(ma-d))
    return ans
  if mx>my:
    ans=abs(b-d)
    mi=3**(mx-1)
    ma=2*3**(mx-1)+1
    ac=(3**mx)*((0--a//(3**mx))-1)
    a-=ac
    c-=ac
    ans+=min(abs(mi-a)+abs(mi-c),abs(ma-a)+abs(ma-c))
    return ans
  if mx==my==0:return abs(a-c)+abs(b-d)
  ans=1/0#正しければ実行されないはず
q=int(input())
for _ in range(q):
  a,b,c,d=map(int,input().split())
  print(solve(a,b,c,d))
import sys
sys.setrecursionlimit(10**6)
n=int(input())
s=[[]for i in range(n+1)]
m=10**9+7
for i in range(n-1):
    x,y=map(int,input().split())
    s[x].append(y)
    s[y].append(x)
t=[[0,0]for i in range(n+1)]
def f(a,b):
    t[a][0]=t[a][1]=1
    for i in s[a]:
        if i!=b:
            f(i,a)
            t[a][0]*=t[i][0]+t[i][1]
            t[a][1]*=*t[i][0]
f(1,0)
print(sum(t[1])%m)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)
n=int(input())
s=[[]for i in range(n+1)]
m=10**9+7
for i in range(n-1):
    x,y=map(int,input().split())
    s[x].append(y)
    s[y].append(x)
t=[[0,0]for i in range(n+1)]
def f(a,b):
    t[a][0]=t[a][1]=1
    for i in s[a]:
        if i!=b:
            f(i,a)
            t[a][0]*=t[i][0]+t[i][1]
            t[a][1]*=t[i][0]
f(1,0)
print(sum(t[1])%m)
class TreeNode:
    def __init__(self):
        self.val = 0
        self.vertex = []


def make_trees(n, A, B):
    trees = []
    for i in range(n):
        trees.append(TreeNode())
    for i in range(len(A)):
        a = A[i]-1
        b = B[i]-1
        trees[a].vertex.append(b)
    return trees

def dfs(node: TreeNode, carry: int, trees):
    if node:
        node.val += carry
        for i in node.vertex:
            dfs(trees[i], node.val, trees)

def sol(n, q, A, B, P, X):
    trees = make_trees(n, A, B)
    for i in range(len(P)):
        p = P[i]-1
        x = X[i]
        t = trees[p]
        # dfs, give point x
        t.val += x
    # accmulative run
    dfs(trees[0], 0, trees)
    #
    return " ".join([str(t.val) for t in trees])
    #return n, q, A, B, P, X



do_submit = True
#do_submit = False

def input_parse(input_str):
    lines = [x.strip() for x in input_str.split("\n") if x.strip()]
    parsed_lines = [list(map(str, line.split())) for line in lines]
    print(parsed_lines)
    n = int(parsed_lines[0][0])
    q = int(parsed_lines[0][1])
    A = []
    B = []
    P = []
    X = []
    for i in range(1, n-1+1):
        a = int(parsed_lines[i][0])
        b = int(parsed_lines[i][1])
        A.append(a)
        B.append(b)
    for i in range(n, 1+n+q-1):
        p = int(parsed_lines[i][0])
        x = int(parsed_lines[i][1])
        P.append(p)
        X.append(x)

    # S = parsed_lines[1][0]
    # return n, k, S
    return n, q, A, B, P, X


if not do_submit:
    n, q, A, B, P, X = input_parse("""
    4 3
    1 2
    2 3
    2 4
    2 10
    1 100
    3 1
    """)
    print(sol(n, q, A, B, P, X))

    n, q, A, B, P, X = input_parse("""
        6 2
        1 2
        1 3
        2 4
        3 6
        2 5
        1 10
        1 10
    """)
    print(sol(n, q, A, B, P, X))

    n, q, A, B, P, X = input_parse("""
        10 5
        1 2
        1 3
        1 4
        2 5
        2 6
        3 7
        4 8
        4 9
        7 10
        7 3
        3 100
        1 2
        5 10
        4 11
    """)
    print(sol(n, q, A, B, P, X))

else:
    n, q = list(map(int, input().split()))
    trees =  [ [] for i in range(n) ]
    values = [ 0 for i in range(n) ]
    for i in range(n-1):
        a, b = list(map(int, input().split()))
        trees[a-1].append(b-1)
    for i in range(q):
        p, x = list(map(int, input().split()))
        # dfs, give point x
        values[p-1] = values[p-1] + x
    # accmulative run
    def dfs2(i):
        for j in trees[i]:
            values[j] += values[i]
            dfs2(j)
    dfs2(0)
    #
    for x in values:
        print(x, end=" ")

### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
n, q = map(int, input().split())
 
ki = [[] for i in range(n + 1)]
for i in range(n - 1):
    a, b = map(int, input().split())
    ki[a].append(b)
    ki[b].append(a)
# print(ki)
 
cnt = [0] * (n + 1)
for i in range(q):
    p, x = map(int, input().split())
    cnt[p] += x
 
 
# print(cnt)
 
 
def d(y, parent):
    for i in ki[y]:
        if i == parent:
            continue
        cnt[i] += cnt[y]
        d(i, y)
 
 
d(1, -1)
print(*cnt[1:])
n,a,b = map(int,input().split())

x = n//(a+b)
y = (n-x*(a+b))//a

if y!=0:
  print(a*x+a)
else:
  print(a*x+n-(a+b)*x)

### FIXED CODE ###

n, a, b = map(int, input().split())
quo = n // (a+b)
rem = n % (a+b)
ans = quo*a
if rem == 0:
    print(ans)
elif rem < a:
    print(ans + rem)
else:
    print(ans + a)
A = int(input())
B = int(input())
print(A*B)

### FIXED CODE ###

A, B = map(int, input().split())
print(A*B)
import numpy as np

N = int(input())
A = [int(i) for i in input().split()]
arr = np.arange(3) 
for i in range(N):
    arr[A[i]-1] = i+1
for i in range(N):   
    print(arr[i],end=" ")

### FIXED CODE ###

import numpy as np

N = int(input())
A = [int(i) for i in input().split()]
arr = np.arange(N) 
for i in range(N):
    arr[A[i]-1] = i+1
for i in range(N):   
    print(arr[i],end=" ")
input()
s = set(map(int,input().split()))
n = int(input())
t = set(map(int,input().split()))
c = 0
for i in range(n):
    if t[i] in s:
        c += 1
print(c)

### FIXED CODE ###

input()
s = set(map(int,input().split()))
n = int(input())
t = tuple(map(int,input().split()))
c = 0
for i in range(n):
    if t[i] in s:
        c += 1
print(c)
n, a, b, c, d = map(int, input().split())
s = input()


if a > b:
    a, b, c, d = b, a, d, c

def search(start, goal):
    for i in range(start+1, goal - 2):
        if s[i] + s[i + 1] == '##': return False
    return True


def search3(start, goal):
    for i in range(start, goal -2):
        if s[i] + s[i + 1]+[i+2] == '...': return True
    return False
if c < b:
    if search(a,c) and search(b,d):print('Yes')
    else:print('No')

else:
    if search3(b-1,d+1):print('Yes')
    else:print('No')


### FIXED CODE ###

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

a,b,c,d=a-1,b-1,c-1,d-1
if a > b:
    a, b, c, d = b, a, d, c


if '##' in s[a:c] or '##' in s[b:d]:print('No')
else:
    if c < d:
        print('Yes')

    else:
        if '...' in s[b - 1 : d + 2]:
            print('Yes')
        else:
            print('No')
N = int(input())
a = [int(input()) for i in range(N)]
M = int(input())
b = [int(input()) for i in range(M)]

k = []

for x in a:
	temp = a.count(x)-b.count(x)
    k.append(temp)
print(max(k))

### FIXED CODE ###

N = int(input())
a = [input() for i in range(N)]
M = int(input())
b = [input() for i in range(M)]
 
k = [0]
 
for x in a:
  temp = a.count(x)-b.count(x)
  k.append(temp)
for y in b:
  temp = a.count(y)-b.count(y)
  k.append(temp)
print(max(k))
N,Q = map(int,input().split())
ab = []
a=[]
for n in range(N-1):
    ab.append([int(i) for i in input().split()])
px = []
for q in range(Q):
    px.append([int(i) for i in input().split()])
class Graph():
    def __init__(self):
        """ ノードのつながりを辞書型で表現する """
        self.adjacency_dict = {}
    
    def add_vertex(self, v):
        """ ノードを追加する """
        self.adjacency_dict[v] = []
    def add_edge(self, v1, v2):
        """ ノード同士をつなぐ。"""
        # 無向グラフの場合は双方向。もし有向グラフなら片側のみ。
        self.adjacency_dict[v1].append(v2)    
    def print_graph(self):
        print(self.adjacency_dict)
graph = Graph()
for n in range(N-1):
    if graph.adjacency_dict.get(ab[n][0]):
        pass
    else:
        graph.add_vertex(ab[n][0])
    graph.add_edge(ab[n][0],ab[n][1])
def search(graph,j,ret):
    if graph.get(j):
        for k in graph[j]:
            ret.append(k)
            search(graph,k,ret)
    return ret
values = [0]* N
for q in range(Q):
    add_list = search(graph.adjacency_dict,px[q][0],[px[q][0]])
    for add in add_list:
        values[add-1] += px[q][1]
print(' '.join(map(str, values)))


### FIXED CODE ###

N,Q = map(int,input().split())
AB = [[] for _ in range(N-1)]
for n in range(N-1):
    AB[n] = list(map(int,input().split()))
PX = [[] for _ in range(Q)]
for q in range(Q):
    PX[q] = list(map(int,input().split()))
graph = [[] for _ in range(N+1)]
for ab in AB:
    graph[ab[0]].append(ab[1])
    graph[ab[1]].append(ab[0])
val = [0] * (N+1)
for px in PX:
    val[px[0]] += px[1]
parent = [0] * (N+1)
from collections import deque
Q  = deque([1])
while Q:
    q = Q.popleft()
    for c in graph[q]:
        if c == parent[q]:
            continue
        parent[c] = q
        Q.append(c)
        val[c] += val[q]
print(*val[1:])
a,b,c,d=map(int, input().split())
L=a+b,R=c+d
if L>R:
  print('Left')
elif L==R:
  print('Balanced')
else:
  print('Right')

### FIXED CODE ###

a,b,c,d=map(int, input().split())
L=a+b
R=c+d
if L>R:
  print('Left')
elif L==R:
  print('Balanced')
else:
  print('Right')
def main():
    import sys
    input = sys.stdin.readline

    N = list(map(int, list(input())))
    N = N[::-1] + [0]

    ans = 0
    for i in range(len(N)-1):
        if N[i] < 5:
            ans += N[i]
        elif N[i] > 5:
            ans += 10 - N[i]
            N[i+1] += 1
        else:
            ans += 5
            if N[i+1] >= 5:
                N[i+1] += 1

    print(ans + N[len(N)-1])

main()

### FIXED CODE ###

def main():
    import sys
    input = sys.stdin.readline

    N = list(map(int, list(input()[:-1])))
    N = N[::-1] + [0]

    ans = 0
    for i in range(len(N)-1):
        if N[i] < 5:
            ans += N[i]
        elif N[i] > 5:
            ans += 10 - N[i]
            N[i+1] += 1
        else:
            ans += 5
            if N[i+1] >= 5:
                N[i+1] += 1

    print(ans + N[len(N)-1])

main()
N = int(input())
D = list(map(int,input().split(" ")))

ans = D[:]


D.sort()

for i in range(N):
	if i % 2 == 0:
		D_1.append(24-D[i])
		D_2.appned(D[i])
	else:
		D_2.append(24-D[i])
		D_1.appned(D[i])


for i in range(N):
	for j in range(i+1,N):
		df1 = abs(D_1[j] - D_1[i])
		df2 = abs(D_2[j] - D_2[i])
		
		df1 = min([df1,24-df1])
		df2 = min([df2,24-df2])
			
		ans.append(df1)
		ans.append(df2)

print(min(df1))






### FIXED CODE ###

N = int(input())
D = list(map(int,input().split(" ")))

ans = D[:]
D.sort()
D_1 = []
D_2 = []

for i in range(N):
	if i % 2 == 0:
		D_1.append(24-D[i])
		D_2.append(D[i])
	else:
		D_2.append(24-D[i])
		D_1.append(D[i])


for i in range(N):
	for j in range(i+1,N):
		df1 = abs(D_1[j] - D_1[i])
		df2 = abs(D_2[j] - D_2[i])
		
		df1 = min([df1,24-df1])
		df2 = min([df2,24-df2])
			
		ans.append(df1)
		ans.append(df2)

print(min(ans))
import collections
import sys
sys.setrecursionlimit(20000)
n, m  = [int(i) for i in input().split(' ')] 
edges = collections.defaultdict(list)
for i in range(m):
    s,d = [int(i) for i in input().split(' ')] 
    edges[s-1].append(d-1) 
dp = [-1]*n
maxPath = 0 
def dfs(node): 
    global dp
    if dp[node]>=0:
        return dp[node] 
    ans = 0 
    for i in edges[node]: 
        ans = max(ans,dfs(i)+1)
    dp[node] = ans
    return ans
for i in range(n):
    maxPath = max(dfs(i), maxPath) 
print(maxPath)


### FIXED CODE ###

import collections
import sys
from functools import lru_cache
sys.setrecursionlimit(int(10**9))
n, m  = [int(i) for i in input().strip().split(' ')] 
edges = collections.defaultdict(list)
for i in range(m):
    s,d = [int(i) for i in input().strip().split(' ')]
    edges[s-1].append(d-1) 
# dp = [-1]*n
maxPath = 0 
@lru_cache(None)
def dfs(node): 
    ans = 0 
    for i in edges[node]:
        ans = max(ans,dfs(i)+1)
    return ans

for i in range(n):
    maxPath = max(dfs(i), maxPath) 
print(maxPath)
package main

import (
    "fmt"
    "math/rand"
    "time"
)

func swap(data []float64, i,

### FIXED CODE ###

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

num = b - a
h = 0
for i in range(num):
    h += i

print(h-a)
import itertools

N = int(input())

NUMBERS = list(itertools.permutations(range(N)))
ret = 0
for numbers in NUMBERS:
  sum = 0
  for num,i in zip(numbers,range(N)):
    sum += (num+1)%(i+1)
  ret = max(ret,sum)

print(ret)


### FIXED CODE ###

N = int(input())
print((N-1)*N//2)
a,b=input().split()
 
print(min(a*int(b),b*(int(a) ) )
      


### FIXED CODE ###

N,M=map(int,input().split())
print("Yes" if N==M else "No")
L, R = map(int, input().split())
if L//2019 != R//2019:
    print(0
elif:
    L%2019<= 673 and R%2019 >= 673 and L-R >= 2:
    print(0)
else:
    print(min((L*(L+1))%2019,(R*(R-1)%2019)))


### FIXED CODE ###

L, R = map(int, input().split())
if L//2019 != R//2019:
    print(0)
elif L % 2019 <= 673 and R % 2019 >= 673 and R - L >= 2:
    print(0)
else:
    ans = 2019
    for i in range(L, R):
        for j in range(i+1,R+1):
            ans = min(ans, (i*j)%2019)
    print(ans)
import sys
sys.setrecursionlimit(100000000)

def solve(s, a, b):
    if a == b:
        return s + a
    elif a > b:
        return solve(s + b * 2, a - b, b)
    else:
        return solve(s + a * 2, a, b - a)


n, x = map(int, input().split())
print(solve(0, n - x, x) + n)

### FIXED CODE ###

def solve(s, a, b):
    if a % b == 0:
        return s + ((a // b) * 2 - 1) * b
    if b % a == 0:
        return s + ((b // a) * 2 - 1) * a
    elif a > b:
        s += (a // b) * 2 * b
        return solve(s, a % b, b)
    else:
        s += (b // a) * 2 * a
        return solve(s, a, b % a)

n, x = map(int, input().split())
print(solve(n, n - x, x))
n = int(input())
ac = 0
wa = 0
tle = 0
re = 0
for i in range(n):
  s = input()
  if (s == "AC"):
    ac += 1
  elif (s == "WA"):
    wa += 1
  elif (s == "TLE"):
    tle += 1
  elif(s == "RE"):
    re += 1
    
print("AC x "+ac)
print("WA x "+wa)
print("TLE x "+tle)
print("RE x "+re)

### FIXED CODE ###

n = int(input())
ac = 0
wa = 0
tle = 0
re = 0
for i in range(n):
  s = input()
  if (s == "AC"):
    ac += 1
  elif (s == "WA"):
    wa += 1
  elif (s == "TLE"):
    tle += 1
  elif(s == "RE"):
    re += 1
    
print("AC x {0}".format(ac))
print("WA x {0}".format(wa))
print("TLE x {0}".format(tle))
print("RE x {0}".format(re))
n,k=map(int,input().split())
l=list(map(int,input().split()))
c=0
for i in l:
  if l>=k:
    c+=1
print c

### FIXED CODE ###

n,k=map(int,input().split())
l=list(map(int,input().split()))
c=0
for i in l:
  if i>=k:
    c+=1
print(c)
import math
MOD = 1000000007

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

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

l = 1
for i in A:
    l = lcm(l, i)

l %= MOD

ans = 0
for i in A:
    ans += l*pow(i, MOD-2, MOD)
    ans %= MOD

print(ans)


### FIXED CODE ###

MOD = 1000000007

def lcm(x, y):
    return (x * y) // gcd(x, y)

def gcd(x, y):
    if y == 0:
        return x
    return gcd(y, x%y)

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

l = 1
for i in A:
    l = lcm(l, i)

l %= MOD

ans = 0
for i in A:
    ans += l*pow(i, MOD-2, MOD)
    ans %= MOD

print(ans)
N = int(input())
if N < 105:
    S = 0
elif N < 135:
    S = 1
elif N < 165:
    S = 2
elif N < 189:
    S = 3
elif N < 195:
    S= 4
else:
    S = 5
print(S)

### FIXED CODE ###

lst = list(map(int,input().split()))
A = lst[0]
B = lst[1]
S = (A-1)*(B-1)
print(S)
n, m = map(int, input().split())

g = [[] for _ in range(n)]

for _ in range(m):
    x, y = map(int, input().split())
    x -= 1
    y -= 1
    g[x].append(y)

dp = [-1] * n

def dfs(i):
    if dp[i] != -1:
        return dp[i]

    tmp = 0
    for j in g[i]:
        tmp = max(tmp, dfs(j) + 1)

    dp[i] = tmp
    return tmp

for i in range(n):
    dfs(i)

print(max(dp))



### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 9)

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

g = [[] for _ in range(n)]

for _ in range(m):
    x, y = map(int, input().split())
    x -= 1
    y -= 1
    g[x].append(y)

dp = [-1] * n

def dfs(i):
    if dp[i] != -1:
        return dp[i]

    tmp = 0
    for j in g[i]:
        tmp = max(tmp, dfs(j) + 1)

    dp[i] = tmp
    return tmp

for i in range(n):
    dfs(i)

print(max(dp))
n = int(input())
a = list(map(int,input().split()))
print(max(a)-min(a)

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
print(max(a)-min(a))
s = input()
for x in map(chr, range(ord('a'), ord('z')+1)):
    p = None
    for i, c in enumerate(s):
        if c!=x: continue
        if p:
            print(p+1, i+1)
            exit()
	p = i

print(-1, -1)

### FIXED CODE ###

s = input()
for x in list(map(chr, range(ord('a'), ord('z')+1))):
    p = None
    for i, c in enumerate(s):
        if c!=x: continue
        if p is not None and i-p<=2:
            print(p+1, i+1)
            exit()
        p = i

print(-1, -1)
def resolve():
    import bisect
    import math
    n = int(input())
    a = list(map(int, input().split()))
    a1 = {}
    for i in range(len(a)):
        if a[i] in a1:
            a1[a[i]] += 1
        else:
            a1[a[i]] = 1
    a = sorted(list(a1.keys()))
    ans = [1]*len(a)

    if len(a) != 1:
        for i in range(len(a)):
            if a[i] > a[-1]/a[0]:
                break
            if ans[i] == 1:
                for j in range(i+1, n):
                    if a[j] % a[i] == 0:
                        ans[j] = 0
    ans1 = 0
    for j in range(len(a)):
        if ans[j] == 1 and a1[a[j]] == 1:
            ans1 += 1
    print(ans1)
resolve()

### FIXED CODE ###

def resolve():
    n = int(input())
    a = list(map(int, input().split()))
    a1 = {}
    for i in range(len(a)):
        if a[i] in a1:
            a1[a[i]] += 1
        else:
            a1[a[i]] = 1
    a = sorted(list(a1.keys()))
    ans = [1] * a[-1]

    for i in a:
        if ans[i-1] == 1:
            for j in range(i-1, len(ans), i):
                ans[j] = 0
            ans[i-1] =1
    ans1 = 0
    for i in a:
        if a1[i] == 1:
            ans1 += ans[i-1]
    print(ans1)
resolve()
N,M = map(int,input().split())
Alist = list(map(int, input().strip().split()))
r = [0]*N
r[0] = Alist[0]
for i in range(1,len(Alist)):
    r[i] = r[i-1] + Alist[i]
for i in range(len(r)):
    r[i] = r[i]%M
r.sort()
p = []
m = 0
for i in range(1,len(r)):
    m = m+1
    if r[i-1] != r[i]:
        p.append(m)
        m = 0
def combi(n):
    if n == 0:
        return 0
    if n == 1:
        return 0
    else:
        return (n*(n-1))/2
s = 0
for i in range(len(p)):
    s = s + combi(p[i])
s = s + p[0]
print(int(s))

### FIXED CODE ###

N,M = map(int,input().split())
Alist = list(map(int, input().strip().split()))
r = [0]*N
r[0] = Alist[0]
for i in range(1,len(Alist)):
    r[i] = r[i-1] + Alist[i]
for i in range(len(r)):
    r[i] = r[i]%M
r.sort()
p = []
m = 0
for i in range(len(r)-1):
    m = m+1
    if r[i] != r[i+1]:
        p.append(m)
        m = 0
    if i == len(r)-2:
        p.append(m+1)
x = 0
for i  in range(len(r)):
    if r[i] == 0:
        x = x +1
def combi(n):
    if n == 0:
        return 0
    if n == 1:
        return 0
    else:
        return (n*(n-1))/2
s = 0
for i in range(len(p)):
    s = s + combi(p[i])
s = s + x
print(int(s))