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

MOD=10**9+7
N=int(input())

clist=[]
for i in range(N):
  c=int(input())
  clist.append(c)  
#print(clist)

c2list=clist[:1]
for i in range(1,N):
  if clist[i]!=c2list[-1]:
    c2list.append(clist[i])
#print(c2list)
N2=len(c2list)

cdic={}
for i in range(N2):
  c=c2list[i]
  if not c in cdic:
    cdic[c]=[i]
  else:
    cdic[c].append(i)
#print(cdic)

dp=[1]+[0]*(N2-1)
for i in range(1,N2):
  c=c2list[i]
  dp[i]=dp[i-1]
  
  for j in reversed(cdic[c]):
    if j<i:
      dp[i]+=dp[j]
      break
    
#print(dp)
print(dp[-1]%MOD)

### FIXED CODE ###

MOD=10**9+7
N=int(input())

clist=[]
for i in range(N):
  c=int(input())
  clist.append(c)  
#print(clist)

c2list=clist[:1]
for i in range(1,N):
  if clist[i]!=c2list[-1]:
    c2list.append(clist[i])
#print(c2list)
N2=len(c2list)

cdic={}
for i in range(N2):
  c=c2list[i]
  if not c in cdic:
    cdic[c]=[i]
  else:
    cdic[c].append(i)
#print(cdic)

dp=[1]+[0]*(N2-1)
for i in range(1,N2):
  c=c2list[i]
  dp[i]=dp[i-1]
  
  if len(cdic[c])<5:
    for j in reversed(cdic[c]):
      if j<i:
        dp[i]+=dp[j]
        break
  else:
    l,r=0,len(cdic[c])
    while(l<=r):
      mid=(l+r)//2
      if cdic[c][mid]<i and cdic[c][mid+1]>=i:
        dp[i]+=dp[cdic[c][mid]]
        break
      elif cdic[c][mid]>=i:
        r=mid-1
      elif cdic[c][mid+1]<i:
        l=mid+1
      else:
        print("error")
    
#print(dp)
print(dp[-1]%MOD)
### BUGGY CODE ###

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

from math import factorial, sqrt

# 約数の個数
def num_div(num):
    total = 1
    # 終点はルート切り捨て+1
    end = int(sqrt(num)) + 1
    for i in range(2, end+1):
        cnt = 0
        # 素因数分解：小さい方から割れるだけ割って指数をカウント
        while num % i == 0:
            num //= i
            cnt += 1
        # 指数+1をかけていくと約数をカウントできる
        total *= (cnt + 1)
        # 最後までそのまま来たやつは素数なので2つ
        if i == end and total == 1:
            return 2
    return total

# 約数の列挙
def num_div_set(N):
    # 1とその数はデフォで入れとく
    s = {1, N}
    # 終点はルート切り捨て+1
    end = int(sqrt(N)) + 1
    for i in range(2, end+1):
        # 割り切れるなら、iとN/iを追加
        if N % i == 0:
            s.add(i)
            s.add(N // i)
    return s

N = int(input())

num = factorial(N)

cnt = 0
for i in num_div_set(num):
        if num_div(i) == 75:
            cnt += 1
print(cnt)


### FIXED CODE ###

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

"""
解説参考
・まず素因数分解で階乗全部バラす
・そこからいい感じの組み合わせを探して数える
"""

N = int(input())

# 階乗の素因数分解：ひとつずつ分解したものを合算
e = [0] * (N+1)
# 階乗の各値ループ
for i in range(2, N+1):
    num = i
    # 素因数分解するループ
    for j in range(2, N+1):
        while num % j == 0:
            num //= j
            e[j] += 1

# 約数75(各指数+1をかける)を取りうる素因数の組み合わせを探していく
nums = set()
# 指数が4, 4, 2
for p in range(2, N+1):
    for q in range(2, N+1):
        for r in range(2, N+1):
            if (e[p] >= 4 and e[q] >= 4 and e[r] >= 2
                    and p != q and q != r and r != p):
                nums.add(pow(p, 4) * pow(q, 4) * pow(r, 2))
# 指数が14, 4 or 24, 2
for p in range(2, N+1):
    for q in range(2, N+1):
        if e[p] >= 14 and e[q] >= 4 and p != q:
            nums.add(pow(p, 14) * pow(q, 4))
        if e[p] >= 24 and e[q] >= 2 and p != q:
            nums.add(pow(p, 24) * pow(q, 2))
# 指数が74
for p in range(2, N+1):
    if e[p] >= 74:
        nums.add(pow(p, 74))  

print(len(nums))
### BUGGY CODE ###

N = int(input())
A = []
B = [0 for i in range(N)]
A = list(map(int,input().split()))
for i in range(N):
    for j in range(N-1):
        if i+1 == A[j]:
            B[i] += 1
    print(B[i])

### FIXED CODE ###

N = int(input())
A = []
B = [0 for i in range(N)]
j = 0
A = list(map(int,input().split()))
list.sort(A)
T = A[0]
for i in range(N-1):
    if A[i] != T and i != N-2:
        B[T-1] = i - j
        T = A[i]
        j = i
    elif i == N-2:
        if A[i] == T:
            B[T-1] = i - j + 1
        else:
            B[T-1] = i - j
            B[A[i]-1] = 1
for i in range(N):
    print(B[i])
### BUGGY CODE ###

n, k = map(int, input().split())
a = list(map(int, input().split()))
for j in range(k):
  b = [0]*n
  for i in range(n):
    for e in range(max(0, i-a[i]), min(n, i+a[i]+1)):
      b[e] += 1
  a = b
  if a.count(n) == n:
    break
print(" ".join(list(map(str, a))))
      
  

### FIXED CODE ###

n, k = map(int, input().split())
a = list(map(int, input().split()))
for j in range(min(k, 41)):
  b = [0]*n
  for i in range(n):
    l = max(0, i-a[i])
    r = min(n, i+a[i]+1)
    b[l] += 1
    if r < n:
      b[r] -= 1
  for i in range(1, n): 
    b[i]+=b[i-1]
  a = b

print(" ".join(list(map(str, a))))
### BUGGY CODE ###

#!/usr/bin/env python3
import sys
import collections

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

d = collections.Counter(A)

for i in range(Q):
    B,C = list(map(int, input().split()))
    if B in d:
        val = d[B]
        if C in d:
            d[C] = d[C] + d[B]
        else:
            d[C] = d[B]
        d.pop(B)

    ans = 0
    for k, v in d.items():
        ans += k * v
    
    print(ans)

### FIXED CODE ###

#!/usr/bin/env python3
import sys
import collections

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

d = collections.Counter(A)
ans = 0
for k, v in d.items():
    ans += k * v

for i in range(Q):
    B,C = list(map(int, input().split()))
    if B in d:
        val = d[B]
        ans -= B * d[B]
        ans += C * d[B]
        if C in d:
            d[C] = d[C] + d[B]
        else:
            d[C] = d[B]
        d.pop(B)

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

n = int(input())
lis = [i+1 for i in range(n-1)]
print(sum(lis))

### FIXED CODE ###

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

n, q = list(map(int, input().split()))
s = input().split()[0]
lr_list = [list(map(int, input().split())) for _ in range(q)]

count_ac_list = [s[:i+1].count('AC') for i in range(n)]
count_list = [str(count_ac_list[r-1] - count_ac_list[l-1]) for l, r in lr_list]

print('\n'.join(count_list))


### FIXED CODE ###

n, q = list(map(int, input().split()))
s = input().split()[0]
lr_list = [list(map(int, input().split())) for _ in range(q)]

count_ac_list = [0] * n
for i in range(n-1):
    # print('{}: {}'.format(i, s[i:i+2]))
    if s[i:i+2] == 'AC':
        count_ac_list[i+1] = count_ac_list[i] + 1
    else:
        count_ac_list[i+1] = count_ac_list[i]

count_list = [str(count_ac_list[r-1] - count_ac_list[l-1]) for l, r in lr_list]

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

import sys
stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

S=list(ns())
M=[0]*len(S)

for i in range(len(S)):
    if(S[i]=='R'):
        k=0
        while(S[i+k]!='L'):
            k+=1
        M[i+k-(k%2)]+=1
                      
    else:
        k=0
        while(S[i-k]!='R'):
            k+=1
        M[i-k+(k%2)]+=1

print(*M)

### FIXED CODE ###

import sys
stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

S=list(ns())
M=[0]
M2=[-1]
ans=[0]*len(S)


for i in range(len(S)-1):
    if(S[i]=='R' and S[i+1]=='L'):
        M.append(i)
    if(S[i]=='L' and S[i+1]=='R'):
        M2.append(i)

M2.append(len(S)-1)

for i in range(1,len(M)):
    ans[M[i]]=(M[i]-M2[i-1])//2+(M[i]-M2[i-1])%2+(M2[i]-M[i])//2
    ans[M[i]+1]=(M[i]-M2[i-1])//2+(M2[i]-M[i])//2+(M2[i]-M[i])%2
print(*ans)
### BUGGY CODE ###

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

dp = [10**9+7]*N
dp[0] = 0

# 足場 i までにたどり着くまでに最小のコスト
for i in range(1,N):
    #for j in range(max(i-K,0),i)はジャンプして位置iまで行ける足場の範囲
    for j in range(max(i-K,0),i):
        dp[i] = min(dp[i],dp[j]+abs(h[i]-h[j]))

print(dp[-1])

### FIXED CODE ###

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

dp = [0]*N

#iは知りたいdp[i]
for i in range(1,N):
    #for j in range(max(i-K,0),i)はジャンプできる段数
    dp[i] = min(dp[j]+abs(h[j]-h[i]) for j in range(max(i-K,0),i))
print(dp[N-1])
### BUGGY CODE ###

t = raw_input()
W, H = map(int, t.split(' '))
p, q = [], []
for i in xrange(W):
    p.append(int(raw_input()))
for j in xrange(H):
    q.append(int(raw_input()))

node = [
    (i, j, min(p[i-1] if i > 0 else 100000005, q[j-1] if j > 0 else 100000005)) for i in xrange(W+1) for j in xrange(H+1)
]
cost = 0
for i in xrange(W*H+W+H):
    cost += node[i+1][2]
print cost

### FIXED CODE ###


import bisect
cost = 0
t = raw_input()
W, H = map(int, t.split(' '))
p, q = [], []
sum_p = []
for i in xrange(W):
    tmp = int(raw_input())
    p.append((i, tmp))
p.sort(key=lambda a: a[1])
pp = [each[1] for each in p]
for i in xrange(W):
    if not sum_p:
        sum_p.append(pp[i])
    else:
        sum_p.append(sum_p[-1]+pp[i])
cost += sum(pp)
for j in xrange(H):
    new = int(raw_input())
    cost += new
    minus = bisect.bisect_right(pp, new)
    cost += (W-minus) * new
    cost += sum_p[minus-1] if minus > 0 else 0

print cost
### BUGGY CODE ###

import sys
N = int(sys.stdin.readline())
for n in range(1,N+1):
  if n < 6:
    x,y,z = 0,0,0
  else:
    x = int((n / 6)**0.5)
    y = int((((n -1)/3) - 1/9)**0.5 - 1/3 + 1)
    z = int((n - 5)**0.5 + 1)
  ans = 0
  for i in range(1,x+1):
    for j in range(i,y+1):
      if i % 2 == j % 2:
        d = 2
        if n % 2 == 0:
          c = 0
        else:
          c = 1
      else:
        d = 1
        if n % 2 == 0:
          c = 10000
        else:
          c = 0    
      for k in range(j + c, z+1, d):
        p = (i + j + k)**2 - i*(j + k) - j*k
        if n < p:
          break
        if n == p:
          if i == j:
            if j == k:
              ans += 1
            else:
              ans += 3
          else:
            if i == k:
              ans += 3
            else:
              if j == k:
                ans += 3
              else:
                ans += 6
  print(ans)

### FIXED CODE ###

import sys
N = int(sys.stdin.readline())
if N < 6:
  x, y, z = 0, 0, 0
else:
  x = int((N / 6)**0.5)
  y = int(round(((((N -1)/3) - 1/9)**0.5 - 1/3)+ 0.5, 0))
  z = int((N - 5)**0.5 + 1)            
n = [0]*(N+1)
for i in range(1,x+1):
  for j in range(i,y+1):
    for k in range(j, z+1):
      p = int((i + j + k)**2 - i*(j + k) - j*k)
      if N < p:
        break
      if i == j:
        if j == k:
          n[p] += 1
        else:
          n[p] += 3
      else:
        if i == k:
          n[p] += 3
        else:
          if j == k:
            n[p] += 3
          else:
            n[p] += 6
for i in range(1,N+1):
  print(n[i])
### BUGGY CODE ###

N = int(input())



for n in range(1,N+1):
    if n < 6:
        print(0)
    else:
        M =int((n-2)**0.5)
        count = 0
        for x in range(1,M+1):
            #P=x**2+y**2+z**2+x*y+y*z+z*x
            for y in range(1,M+1):
                #Q=x**2+y**2+z**2+x*y+y*z+z*x
                for z in range(1,M+1):
                    #R = x**2+y**2+z**2+x*y+y*z+z*x
                    if x**2+y**2+z**2+x*y+y*z+z*x == n:
                        count = count + 1
                    else:
                        pass
        print(count)



### FIXED CODE ###

N = int(input())
lst = [0]*(N+1)

for x in range(1,101):
    for y in range(1,101):
        for z in range(1,101):
            p = (x+y)*(x+z)+y**2+z**2
            if p > N:
                break
            else:
                lst[p] += 1
for i in range(1,N+1):
    print(lst[i])
### BUGGY CODE ###

S=list(map(str,input()))
ZERO=[]
T=[]
U=[]
CK=[]
odd=0
for i in range(len(S)):
  T.append(1)
for i in range(1,len(S)):
  if S[i-1]=="R" and S[i]=="R":
    ZERO.append(i-1)
  if S[i]=="L" and S[i-1]=="L":
    ZERO.append(i)
for i in range(len(ZERO)):
  CK.append(T[ZERO[i]])
U=T[:]
while sum(CK)!=0:
  for i in range(1,len(S)):
    if T[i-1]>0 and S[i-1]=="R":
      U[i]=U[i]+T[i-1]
      U[i-1]=U[i-1]-T[i-1]
    if T[i]>0 and S[i]=="L":
      U[i-1]=U[i-1]+T[i]
      U[i]=U[i]-T[i]
  odd=odd+1
  for i in range(len(ZERO)):
    CK[i]=U[ZERO[i]]
  T=U[:]
if odd%2==0:
  print(" ".join(map(str,T)))
else:
  for i in range(1,len(S)):
    if T[i-1]>0 and S[i-1]=="R":
      U[i]=U[i]+T[i-1]
      U[i-1]=U[i-1]-T[i-1]
    if T[i]>0 and S[i]=="L":
      U[i-1]=U[i-1]+T[i]
      U[i]=U[i]-T[i]
  T=U[:]
  print(" ".join(map(str,T)))

### FIXED CODE ###

S=list(map(str,input()))
N=len(S)
Q=[0]*N
R=[]
R1=[0]*N
L1=[0]*N
L=[]
V=[0]*N
for i in range(0,N):
  if S[i]=="R" and S[i+1]=="L":
    R.append(i)
  elif S[i]=="L" and S[i-1]=="R":
    L.append(i)
  else: V[i]=1

for i in R+L:
  Q[i]=1

x=0
for r in R:
  while x!=r:
    R1[x]=r
    x=x+1
x=N-1
for l in reversed(L):
  while x!=l:
    L1[x]=l
    x=x-1

for i in range(N):
  if V[i]==1:
    if S[i]=="R":
      if (R1[i]-i)%2==0:
        Q[R1[i]]=Q[R1[i]]+1
      else:
        Q[R1[i]+1]=Q[R1[i]+1]+1
    else:
      if (i-L1[i])%2==0:
        Q[L1[i]]=Q[L1[i]]+1
      else:
        Q[L1[i]-1]=Q[L1[i]-1]+1

print(*Q)
### BUGGY CODE ###

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

if 0 in a_list:
  print(0)
  
else:
  num = 1
  for a in a_list:
    num *= a
  if num > 1E18:
    print(-1)
  else:
  	print(num)

### FIXED CODE ###

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

if 0 in a_list:
  print(0)
  
else:
  flg = True
  num = 1
  for a in a_list:
    num *= a
    if num > 1E18:
      print(-1)
      flg = False
      break

  if flg:
    print(num)
### BUGGY CODE ###

from bisect import bisect_left


N, Q = map(int, input().split(" "))
check_points = [input() for _ in range(N)]
querys = [int(input()) for _ in range(Q)]
time = {}
for q in querys:
    time[q] = -1
b_left = bisect_left
for line in check_points:
    s, f, x = map(int, line.split(" "))
    start = s-x
    end = f-x
    left = b_left(querys, start)
    right = b_left(querys, end)
    for q in querys[left:right]:
        if q >= end:
            break
        if time[q] == -1 or time[q] > x:
            time[q] = x

for q in querys:
    print(time[q])


### FIXED CODE ###

from bisect import bisect_left
from operator import itemgetter

N, Q = map(int, input().split(" "))
check_points = [tuple(map(int, input().split(" "))) for _ in range(N)]
querys = [int(input()) for _ in range(Q)]
time = [-1 for _ in range(Q)]
jump = [-1 for _ in range(Q)]
check_points = sorted(check_points, key=itemgetter(2))
b_left = bisect_left

for line in check_points:
    s, f, x = line
    start = s-x
    end = f-x
    left = b_left(querys, start)
    right = b_left(querys, end)
    while left < right:
        if time[left] == -1:
            time[left] = x
            jump[left] = right
            left += 1
        else:
            left = jump[left]

for t in time:
    print(t)
### BUGGY CODE ###

from collections import defaultdict, deque, Counter
from operator import itemgetter
from bisect import bisect_left, bisect_right, insort_left, insort_right
# import sys
# input = sys.stdin.readline
# sys.setrecursionlimit(10 ** 6)
MOD = 10 ** 9 + 7
# INF = float("inf")



# 素因数分解
def prime_factorize(n):
    a = defaultdict(int)
    while n % 2 == 0:
        a[2] += 1
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a[f] += 1
            n //= f
        else:
            f += 2
    if n != 1:
        a[n] += 1
    return a

def main():
    n = int(input())
    A = list(map(int, input().split()))
    l = defaultdict(int)
    for a in A:
        c = prime_factorize(a)
        for k, v in c.items():
            l[k] = max(l[k], v)
    # print(l)
    ans = 0
    lcm = 1
    for k, v, in l.items():
        lcm *= k ** v
    # print(lcm)
    for a in A:
        ans += lcm // a
        ans %= MOD
    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10 ** 6)
MOD = 10 ** 9 + 7
# INF = float("inf")


# 最大公約数
def gcd(a, b):
    if a < b:
        a, b = b, a
    while a % b != 0:
        a, b = b, a % b
    return b


# 最小公倍数
def lcm(a, b):
    return a * b // gcd(a, b)


def main():
    n = int(input())
    A = list(map(int, input().split()))
    l = 1
    for a in A:
        l = lcm(l, a)
    c = 0
    for a in A:
        c += pow(a, MOD - 2, MOD)
    ans = l * c % MOD
    print(ans)


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

s=input()
s=s[::-1]

n=len(s)
modlist=[[0 for i in range(13)]for _ in range(n+1)]

#13で割ったあまりの判定方法
if s[0]!="?":
    modlist[0][int(s[0])]=1
elif s[0]=="?":
    for  i in range(10):
        modlist[0][i]=1
for i in range(1,n):
    if s[i]!="?":
        add=(int(s[i])*(10**(i)))%13
        for  j in range(13):
            modlist[i][j]+=modlist[i-1][(j-add)%13]
            modlist[i][j]%(10**9+7)
            

    else:
        for nums in range(10):
                add=nums*(10**i)%13
                for  j in range(13):
                    modlist[i][j]+=modlist[i-1][(j-add)%13]
                    modlist[i][j]=modlist[i][j]%(10**9+7)

print(modlist[-2][5])                
            

### FIXED CODE ###

def xgcd(a, b):
    x0, y0, x1, y1 = 1, 0, 0, 1
    while b != 0:
        q, a, b = a // b, b, a % b
        x0, x1 = x1, x0 - q * x1
        y0, y1 = y1, y0 - q * y1
    return a, x0, y0
def modinv(a, m):
    g, x, y = xgcd(a, m)
    return x % m
def main():
    s=list(input())
    mod=10**9+7
    K=modinv(10,13)
    U=[[0 for i in range(10) ]for k in range(13)]
    for i in range(13):
        for j in range(10):
            U[i][j]=((i-j)*K)%13

    dp=[[0 for k in range(13)] for i in range(len(s))]
    #dp[i][j]=初めのindex=i番目まで見たときに、あまりがjになるような方法の総数
    num=s[0]
    if s[0]=="?":
        for i in range(10):
            dp[0][i]=1
    else:
        number=int(s[0])
        dp[0][number]=1

    for i in range(1,len(s)):
        for k in range(13):
            if s[i]=="?":
                for j in range(10):
                    dp[i][k]+=dp[i-1][U[k][j]]%mod
            else:
                number=int(s[i])
                dp[i][k]=dp[i-1][U[k][number]]%mod
    print(dp[len(s)-1][5]%mod)
if __name__ == "__main__":
    main()
### BUGGY CODE ###

S = input()

N = 13
# dp[k] -> 13で割った余りがKのパターン数
dp = [0] * N
dp[0] = 1

# 後ろから解くアルゴリズム
# 1?2?3   0 -> 3 -> ?3 -> 2?3 -> ...
mod = 10**9 + 7

mul = 1
for i in range(len(S))[::-1]:
    # 次の状態
    nextDP = [0] * N
    if S[i] == '?':
        for k in range(10):
            for j in range(N):
                nextDP[(k * mul + j) % N] += dp[j]
                nextDP[(k * mul + j) % N] %= mod
    else:
        k = int(S[i])
        for j in range(N):
            nextDP[(k * mul + j) % N] += dp[j]
            nextDP[(k * mul + j) % N] %= mod
    mul *= 10
    mul %= N
    dp = nextDP

print(dp[5])

### FIXED CODE ###

S = input()

N = 13
# dp[k] -> 13で割った余りがKのパターン数
dp = [0] * N
dp[0] = 1

# 後ろから解くアルゴリズム
# 1?2?3   0 -> 3 -> ?3 -> 2?3 -> ...
mod = 10**9 + 7

mul = 1
for i in range(len(S))[::-1]:
    # 次の状態
    nextDP = [0] * N
    if S[i] == '?':
        for k in range(10):
            for j in range(N):
                nextDP[(k * mul + j) % N] += dp[j]
                nextDP[(k * mul + j) % N] %= mod
    else:
        k = int(S[i])
        for j in range(N):
            nextDP[(k * mul + j) % N] += dp[j]
            nextDP[(k * mul + j) % N] %= mod
    mul *= 10
    mul %= N
    dp = nextDP

print(dp[5])
### BUGGY CODE ###

#16:15
n = int(input())
xyi = []
for i in range(n):
  xyi.append(list(map(int,input().split())) + [i])
xyi.sort()
road = [[] for _ in range(n)]
for j in range(n-1):
  z1 = xyi[j][2]
  z2 = xyi[j+1][2]
  d  = xyi[j+1][0] - xyi[j][0]
  road[z1].append([d,z2])
  road[z2].append([d,z1])
xyi.sort(key = lambda x: x[1])
for j in range(n-1):
  z1 = xyi[j][2]
  z2 = xyi[j+1][2]
  d  = xyi[j+1][1] - xyi[j][1]
  road[z1].append([d,z2])
  road[z2].append([d,z1])
pre = [i for i in range(n)]
ans = 0
seen = [0 for _ in range(n)]
seen[0] = 1
now = road[0]
import heapq
heapq.heapify(now)
ans = 0
while now:
  d,z = heapq.heappop(now)
  if seen[z] == 1:
    continue
  seen[z] = 1
  ans += d
  for x in road[z]:
    if seen[x[1]] == 0:
      heapq.heappush(now,x)
#print(seen)
#print(road)
print(ans)

### FIXED CODE ###

#16:15
n = int(input())
xyi = []
for i in range(n):
  xyi.append(list(map(int,input().split())) + [i])
xyi.sort()
road = []
for j in range(n-1):
  road.append([xyi[j+1][0]-xyi[j][0],xyi[j][2],xyi[j+1][2]])
xyi.sort(key = lambda x: x[1])
for j in range(n-1):
  road.append([xyi[j+1][1]-xyi[j][1],xyi[j][2],xyi[j+1][2]])
road.sort()
pre = [i for i in range(n)]
ans = 0
for k in range(2*n-2):
  d,I,J = road[k]
  ii = []
  jj = []
  while pre[I] != I:
    ii.append(I)
    I = pre[I]
  for Is in ii:
    pre[Is] = I
  while pre[J] != J:
    jj.append(J)
    J = pre[J]
  for Js in jj:
    pre[Js] = J
  if I != J:
    pre[J] = I
    ans += d
print(ans)
### BUGGY CODE ###

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

for i in range(1,N+1):
  print(list.count(i))
  i+=1

### FIXED CODE ###

from collections import Counter

N=int(input())
list = list(map(int, input().split()))
i=1
counter = Counter(list)

for i in range(1,N+1):
  print(counter[i])
### BUGGY CODE ###

na,nb,nm = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
TA = []
for i in range(nm):
    m1, m2, m3 = map(int,input().split())
    T = a[m1-1]+b[m2-1]-m3
    TA.append(T)
for i in range(na):
    for j in range(nb):
        T = a[i] + b[j]
        TA.append(T)
print(min(TA))

### FIXED CODE ###

na,nb,nm = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
TA = []
for i in range(nm):
    m1, m2, m3 = map(int,input().split())
    T = a[m1-1]+b[m2-1]-m3
    TA.append(T)
T = min(a) + min(b)
TA.append(T)
print(min(TA))
### BUGGY CODE ###

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

comb = 0
for i in range(len(b)):
  num = a.count(b[i])
  comb += num*(num-1)//2

[print(comb-a.count(a[i])+1) for i in range(len(a))]

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
b = [0]*(n+1)
cnt = 0

for i in range(n):
    b[a[i]] += 1
for i in range(1,n+1):
    cnt += b[i]*(b[i]-1)//2
for i in range(n):
    if(b[a[i]]>1):
        print(cnt - b[a[i]]*(b[a[i]]-1)//2 + (b[a[i]]-1)*(b[a[i]]-2)//2)
    else:
        print(cnt)
### BUGGY CODE ###

N = int(input())
A = []
c = 0
for n in input().split():
  i = int(n)
  A.append(i)
for i in range(N):
  Ai = A[i]
  flg = True
  for j in range(N):
    if i == j:
      continue
    Aj = A[j]
    if Ai % Aj == 0:
      flg = False
  if flg:
    c += 1
print(c)
    
    

### FIXED CODE ###

N = int(input())
c=[0]*8**7
for a in input().split():
    c[int(a)] += 1
i=r=0
for t in c:
    if t:
        c[::i]=[0]*-(-8**7//i)
    i+=1
    r+=t==1
print(r)
### BUGGY CODE ###


count = int(input())
num = []
num = input().split()

total = 1
for i in range(count):
    if total == 0:
        break
    total = int(num[i])*total
    
if total > 10**18:
    total = -1
    
print(total)

### FIXED CODE ###

# coding: utf-8
# Your code here!

count = int(input())
num = []
num = input().split()

hantei = 0
for i in range(count):
    if int(num[i]) == 0:
        hantei = 1
        total = 0
    else:
        continue
      #print("z")
      
if hantei == 0:
    total = 1
    for i in range(count):
        total = int(num[i])*total
        if total > 10**18:
            total = -1
            break
    
print(total)
### BUGGY CODE ###

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

S = []
for i in range(1, N+1):
    stu = A.index(i) + 1
    S.append(stu)

S = [str(S[i]) for i in range (N)]
print(' '.join(S))


### FIXED CODE ###

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

ans = ['a' for i in range(N)]
for i in range (N):
    k = A[i] - 1
    ans[k] = str(i+1)

print(' '.join(ans))