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

n=int(input())
if n == 1:
  print('0')
else:
  total = 0
  for i in range(n):
    total += i
  print(total)

### FIXED CODE ###

n=int(input())

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

# DP(配るDP)
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(1, K + 1):
    if i + j > N - 1:
      break
    t = dp[i] + abs(h[i + j] - h[i])
    if t < dp[i + j]:
      dp[i + j] = t
print(dp[N -1])


### FIXED CODE ###

n, k = [int(e) for e in input().split()]
h = [int(e) for e in input().split()]
cost = [0] * n
cost[1] = abs(h[1] - h[0])
for i in range(1, n):
  cost[i] = min(abs(h[i] - h[j]) + cost[j] for j in range(max(0, i - k), i))
print(cost[n - 1])
### BUGGY CODE ###

v,e,r = map(int,input().split())
d = [float('INF')]*v
d[r] = 0
edges=[]

for i in range(e):
  s,t,c = map(int,input().split())
  edges.append([s,t,c])

for i in range(v):
  for s,v,c in edges:
    if d[v] > d[s]+c:
      d[v] = d[s]+c

for i in d:
  if i == float('inf'):
    print('INF')
  else:
    print(i)


### FIXED CODE ###

from heapq import heappush, heappop
v,e,r = map(int,input().split())
edges=[[] for i in range(v)]
d = [float('INF')]*v

for i in range(e):
  s,t,c = map(int,input().split())
  edges[s].append([t,c])

que = []
heappush(que,(0,r))
d[r] = 0

while que:
  c, u = heappop(que)
  for v, s in edges[u]:
    if d[v] > s + c:
      d[v] = s + c
      heappush(que,(d[v],v))
for i in d:
  if i == float('inf'):
    print('INF')
  else:
    print(i)
### BUGGY CODE ###

n=int(input())
a=list(map(int,input().split()))
l=[0 for i in range(10**6+1)]
for i in range(n):
  l[a[i]]+=1
ans=0
for i in range(n):
  x=a[i]
  if l[a[i]]==1:
    flag=1
    for j in range(1,int(x**0.5)+2):
      if x%j==0:
        if x!=j and l[j]>0:
          flag=0
          break
        if x!=x//j and x%(x//j)==0 and l[x//j]>0:
          flag=0
          break
    if flag==1:
      ans+=1
print(ans)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
if n!=1 and len(set(a))==1:
  print(0)
  exit()
l=[0 for i in range(10**6+1)]
for i in range(n):
  l[a[i]]+=1
if n!=1 and min(a)>max(a)/2:
  ct=0
  for i in range(len(l)):
    if l[i]==1:
      ct+=1
  print(ct)
  exit()
d={}
ans=0
for i in range(n):
  x=a[i]
  if x not in d:
    if l[a[i]]==1:
      flag=1
      for j in range(1,int(x**0.5)+2):
        if x%j==0:
          if x!=j and l[j]>0:
            flag=0
            break
          if x!=x//j and x%(x//j)==0 and l[x//j]>0:
            flag=0
            break
      if flag==1:
        ans+=1
        d[x]=1
      else:
        d[x]=0
  else:
    ans+=d[x]
print(ans)
### BUGGY CODE ###

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

for i in range(n):
  print(a.index(i+1)+1,end=" "),


### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
ans = [0]*n

for i,name in enumerate(a):
  ans[name-1]=i+1

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

import numpy as np
h, w, d = map(int, input().split())
num = h * w
mass = np.array([[0, 0] for _ in range(num + 1)])
mp = np.zeros(num+1, dtype=int)
for i in range(h):
    for j, a in enumerate(list(map(int, input().split()))):
        mass[a] = [i, j]
for i in range(d+1, num+1):
    mp[i] = mp[i-d] + np.sum(abs(mass[i]-mass[i-d]))
    
q = int(input())
for _ in range(q):
    l, r = map(int, input().split())
    print(mp[r]-mp[l])


### FIXED CODE ###

import sys
input = sys.stdin.readline
h, w, d = map(int, input().split())
num = h * w
x = [0] * (num + 1)
y = [0] * (num + 1)
mp = [0] * (num + 1)
for i in range(h):
    for j, a in enumerate(map(int, input().split())):
        x[a], y[a] = [i+1, j+1]
for i in range(d+1, num+1):
    mp[i] = mp[i-d] + abs(x[i] - x[i-d]) + abs(y[i] - y[i-d])
q = int(input())
for _ in range(q):
    l, r = map(int, input().split())
    print(mp[r]-mp[l])
### BUGGY CODE ###

n,m=[int(x) for x in input().split()]
l=[[] for i in range(n)]
for i in range(m):
  a,b=map(int,input().split())
  l[a-1].append(b-1)
  l[b-1].append(a-1)
# print(l)

done=[0]*n


def dfs(j):
  que=[j]
  cnt=1
  done[j]=1
  while(que):
    now=que.pop(0)

    for i in l[now]:
      if done[i]!=1:
        que.append(i)
        done[i]=1
        cnt+=1

  return cnt

ma=0
for j in range(n):
  if done[j]!=1:
    now=dfs(j)
  else:
    now=0
  ma=max(now,ma)
  
print(ma)


### FIXED CODE ###

n,m=[int(x) for x in input().split()]
l=[[] for i in range(n)]
for i in range(m):
  a,b=map(int,input().split())
  l[a-1].append(b-1)
  l[b-1].append(a-1)
# print(l)

done=[0]*n


def dfs(j):
  que=[j]
  cnt=1
  done[j]=1
  while(que):
    now=que.pop(0)

    for i in l[now]:
      if done[i]!=1:
        que.append(i)
        done[i]=1
        cnt+=1

  return cnt

ma=0
for j in range(n):
  if done[j]!=1:
    now=dfs(j)
  else:
    now=0
  ma=max(now,ma)
  
print(ma)
### BUGGY CODE ###

#!/usr/bin/env python3
import sys

def solve(N: int, A: "List[int]"):
    from scipy.optimize import rosen, differential_evolution, minimize, basinhopping
    A = [a-i for i, a in enumerate(A, 1)]
    def f(b):
        return sum(abs(a-b) for a in A)
    res = differential_evolution(f, [[min(A), max(A)]])
    b = res.x[0]
    return min(f(int(round(b))), f(int(round(b+1))))

# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"    
    print(solve(N, A))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    #test()
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys

def solve(N: int, A: "List[int]"):
    A = sorted(a - i for i, a in enumerate(A))
    m = A[N//2]
    return sum(abs(a-m) for a in A)


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    print(solve(N, A))

def test():
    import doctest
    doctest.testmod()

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

from heapq import heappush, heappop
import sys
input = sys.stdin.readline

H, W, K = map(int, input().split())
x1, y1, x2, y2 = map(int, input().split())
c = [[i for i in input()] for _ in range(H)]

dist = [[[float('inf')] * 2 for _ in range(W)] for _ in range(H)]
dist[x1 - 1][y1 - 1] = [0, 0]

# (cost, x, y, mode)
q = [(0, x1 - 1, y1 - 1, 0), (0, x1 - 1, y1 - 1, 1)]
while q :
  ccost, cx, cy, cmode = heappop(q)
  if ccost > dist[cx][cy][cmode] :
    continue
  for i, (dx, dy) in enumerate(((-1, 0), (0, -1), (1, 0), (0, 1))) :
    nmode = i % 2
    nx, ny = cx + dx, cy + dy
    if cmode == nmode :
      ncost = ccost + 1
      if 0 <= nx < H and 0 <= ny < W and c[nx][ny] != '@' and ncost < dist[nx][ny][nmode] :
        heappush(q, (ncost, nx, ny, nmode))
        dist[nx][ny][nmode] = ncost
  ncost = (ccost + K - 1) // K * K
  if ncost < dist[cx][cy][cmode ^ 1] :
    dist[cx][cy][cmode ^ 1] = ncost
    heappush(q, (ncost, cx, cy, cmode ^ 1))
 
if min(dist[x2 - 1][y2 - 1]) == float('inf') :
  print(-1)
else :
  print((min(dist[x2 - 1][y2 - 1]) + K - 1) // K)

### FIXED CODE ###

from heapq import heappush, heappop
import sys
input = sys.stdin.readline

H, W, K = map(int, input().split())
x1, y1, x2, y2 = map(int, input().split())
c = [[i == '.' for i in input()] for _ in range(H)]

x1, y1, x2, y2 = x1 - 1, y1 - 1, x2 - 1, y2 - 1
INF = 1 << 60
dist = [INF] * (H * W * 2)

def pos(x, y, m) :
  return (x * W + y) * 2 + m
dist[pos(x1, y1, 0)] = dist[pos(x1, y1, 1)] = 0

q = [(0, pos(x1, y1, 0)), (0, pos(x1, y1, 1))]
while q :
  ccost, cpos = heappop(q)
  if ccost > dist[cpos] : continue
  cx = cpos // 2 // W
  cy = cpos // 2 % W
  cmode = cpos % 2
  dir = [
    [(-1, 0), (1, 0)],
    [(0, -1), (0, 1)]
  ]
  for dx, dy in dir[cmode] :
    nx, ny = cx + dx, cy + dy
    ncost = ccost + 1
    if 0 <= nx < H and 0 <= ny < W and c[nx][ny] and ncost < dist[pos(nx, ny, cmode)] :
      heappush(q, (ncost, pos(nx, ny, cmode)))
      dist[pos(nx, ny, cmode)] = ncost
      
  ncost = (ccost + K - 1) // K * K
  if ncost < dist[pos(cx, cy, cmode ^ 1)] :
    dist[pos(cx, cy, cmode ^ 1)] = ncost
    heappush(q, (ncost, pos(cx, cy, cmode ^ 1)))

ans = min(dist[pos(x2, y2, 0)], dist[pos(x2, y2, 1)])
if ans == INF :
  print(-1)
else :
  print((ans + K - 1) // K)
### BUGGY CODE ###

from collections import Counter

N = int(input())
lst = [int(x) for x in input().split()]
counters = Counter(lst)
dic = {}
for k, v in dict(counters).items():
    if v > 1:
        dic[k] = v

m = {}
for x in lst:
    n = m.get(x)
    if n is None:
        n = 0
        for k, v in dic.items():
            if k == x:
                v -= 1
            n += v * (v - 1) // 2

    m[x] = n
    print(n)


### FIXED CODE ###

from collections import Counter

N = int(input())
lst = [int(x) for x in input().split()]
dic = dict(Counter(lst))

ret = 0
for k, v in dic.items():
    ret += v * (v - 1) // 2


for x in lst:
    n = dic[x]
    if n == 1:
        print(ret)
    else:
        print(ret - (n * (n - 1) // 2) + ((n - 1) * (n - 2) // 2))
### BUGGY CODE ###

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

N = int(input())
a = list(map(int, input().split()))
c = collections.Counter(a)
one = c[1]
two = c[2]
three = c[3]

m = 301
memo = [[[-1] * m for _ in range(m)] for _ in range(m)]
memo[0][0][0] = 0.0


def sushi(x, y, z):
    if memo[x][y][z] >= 0:
        return memo[x][y][z]

    res = 0.
    if x > 0:
        res += sushi(x - 1, y, z) * x
    if y > 0:
        res += sushi(x + 1, y - 1, z) * y
    if z > 0:
        res += sushi(x, y + 1, z - 1) * z
    res = (res + N) / (x + y + z)
    memo[x][y][z] = res
    return res


ans = sushi(one, two, three)
print(ans)


### FIXED CODE ###

from collections import Counter, defaultdict
N = int(input())
A = list(map(int, input().split()))
C = Counter(A)

U = N + 1
inf = 1e18

dp = [[[inf] * U for _ in range(U)] for _ in range(U)]
dp[0][0][0] = 0.0

for c in range(N + 1):
    for b in range(N + 1):
        if c + b > N:
            break
        for a in range(N + 1):
            if a + b + c == 0:
                continue
            if a + b + c > N:
                break
            prob = 0
            E = N
            if a > 0:
                E += a * dp[a - 1][b][c]
                prob += a
            if b > 0 and a < N:
                E += b * dp[a + 1][b - 1][c]
                prob += b
            if c > 0 and b < N:
                E += c * dp[a][b + 1][c - 1]
                prob += c
            dp[a][b][c] = E / prob

x = C[1]
y = C[2]
z = C[3]
print(dp[x][y][z])
### BUGGY CODE ###

N = int(input())
sqrt_N = int(N ** 0.5) + 1

dividers_for_N = set([N])
ans_set = set([N - 1])

for i in range(2, sqrt_N + 1):
    if (N - 1) % i == 0:
        ans_set.add(i)
        ans_set.add((N - 1) // i)

    if N % i == 0:
        dividers_for_N.add(i)
        dividers_for_N.add(N // i)

for i in dividers_for_N:
    num = N
    while num % i == 0:
        num //= i
    if num % i == 1:
        ans_set.add(i)

ans = len(ans_set)

print(ans)

### FIXED CODE ###

N = int(input())
sqrt_N = int(N ** 0.5)

dividers_for_N = set()
ans_set = set()

for i in range(1, sqrt_N + 1):
    if (N - 1) % i == 0:
        ans_set.add(i)
        ans_set.add((N - 1) // i)

    if N % i == 0:
        dividers_for_N.add(i)
        dividers_for_N.add(N // i)

dividers_for_N -= {1}
ans_set -= {1}

for i in dividers_for_N:
    num = N
    while num % i == 0:
        num //= i
    if num % i == 1:
        ans_set.add(i)

ans = len(ans_set)

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

S=input()
N=len(S)

T=[]
T.append(0)
tmp=""
for i in range(N):
    s=S[N-1-i]
    tmp=s+tmp
    T.append(int(tmp))

x=dict()
for i in range(len(T)):
    val=T[i]%2019
    if val in x:
        x[val]+=1
    else:
        x[val]=1
ans=0
for idx in x:
    val=x[idx]
    ans+=((val*(val-1))//2)

print(ans)

### FIXED CODE ###

S=input()
N=len(S)
#「連続する区間」についての問題では、”累積和的なもの”をとるのが定石である。
#Sの連続する区間が、右からa文字分から、右からb文字分を取り除いたものであるとき
#その区間の整数が2019の倍数になるということは、s[a]とs[b]を2019で割ったあまりが等しい
#十分条件であることは分かったが、必要条件であるのか
#結論として必要条件でもある
#なぜなら2019と10は互いに素であるからである。

T=[]
T.append(0)
tmp=""
d=[0 for _ in range(2019)]
d[0]=1
r=0
t=1
for i in range(N):
    s=S[N-1-i]
    r+=int(s)*t
    r%=2019
    t*=10
    t%=2019 
    d[r]+=1

ans=0

print(sum(i*(i-1)//2 for i in d))
### BUGGY CODE ###

import numpy as np
from bisect import bisect_left, bisect_right
N,M = map(int,input().split())
A = list(map(int,input().split()))
A.sort()
A = np.array(A)
for i in range(M):
  B,C = map(int,input().split())
  if C <= A[0]:
    continue
  else:
    l = bisect_left(A,C)
    if l>=B:
      A[:l-B] = A[B:l]
      A[l-B:l] = C
    else:
      A[:l] = C
print(sum(A))

### FIXED CODE ###

import sys
input = sys.stdin.readline
N,M = map(int,input().split())
from collections import Counter
A = list(map(int,input().split()))
A=Counter(A)
cnt = [(0,0) for _ in range(len(A)+M)]
i = 0
for _ in A.most_common():
  cnt[i]=_
  i+=1
for j in range(M):
  B,C = map(int,input().split())
  cnt[i]=(C, B)
  i+=1
cnt.sort(key=lambda x:x[0],reverse=True)
nn = 0
ans = 0
for k in range(len(cnt)):
  d = min(N-nn,cnt[k][1])
  nn += d
  ans += d * cnt[k][0]
  if nn == N:
    break
print(ans)
### BUGGY CODE ###

from collections import deque
import sys
input = sys.stdin.readline
n=int(input())
g=[[] for i in range(n)]
for i in range(n-1):
    a,b=map(int,input().split())
    a-=1
    b-=1
    g[a].append(b)
    g[b].append(a)
q=deque([[0,[0]]])
v=[0]*n
v[0]=1
f=0
while q:
    p=q.popleft()
    #if p[1][-1]==n-1:
        #break
    v[p[0]]=1
    for i in g[p[0]]:
        if v[i]==0:
            v[i]=1
            #print(i)
            if i==n-1:
                r=p[1]+[i]
                f=1
                break
            q.append([i,p[1]+[i]])
    if f==1:
        break
fe=deque(r[:(-(-len(r)//2))])
v=[0]*n
v[r[(-(-len(r)//2))]]=1
for i in fe:
    v[i]=1
while fe:
    s=fe.popleft()
    for i in g[s]:
        if v[i]==0:
            fe.append(i)
            v[i]=1
x=sum(v)-1
y=n-x
if x>y:
    print('Fennec')
else:
    print('Snuke')


### FIXED CODE ###

import math
import sys
sys.setrecursionlimit(1000000)
N = int(input())
graph = {}
SCORE = 0
def dfs(visited,v,depth):
    visited[v] = depth
    for next_v in graph[v]:
        if  visited[next_v]  == -1 :
            dfs(visited,next_v,depth + 1)




for _ in range(N-1):
    a,b = map(int,input().split())
    if a not in graph:
        graph[a] = [b]
    else:
        graph[a].append(b)

    if b not in graph:
        graph[b] = [a]
    else:
        graph[b].append(a)

vF = [-1] * (N + 1)
vF[1] = 0
dfs(vF,1,0)
# print(vF)

vS = [-1] * (N + 1)
vS[N] = 0

dfs(vS,N,0)
# print(vS)

fc = 0
sc = 0

for f,s in zip(vF[1:N + 1],vS[1:N + 1]):
    if f <= s:
        fc += 1
    else:
        sc += 1

# print(fc,sc)
if fc > sc:
    print("Fennec")
else:
    print("Snuke")
### BUGGY CODE ###

n,k = map(int,input().split())
P = list(map(int,input().split()))
sum_a = 0
index = 0
for i in range(n):
    num = 0
    
    if (int(i)+k<=n):
        for j in range(int(i),int(i)+k):
            num += P[j]
        if(sum_a<num):
            index = i
            sum_a = num
            #print(sum_a,index)
total = 0.0
for m in range(index,index+k):
    mylist = list(range(P[m]+1))
    #print(sum(mylist))
    total += sum(list(range(P[m]+1)))/P[m]
print(total)

### FIXED CODE ###

n,k = map(int,input().split())
P = list(map(int,input().split()))
sum_a = 0
index = 0

for i in range(k):
    sum_a += P[i]
num = sum_a
for j in range(1,n-k+1):
    num += P[j+k-1]
    #print(num)
    num -= P[j-1]
    #print(num)
    if(sum_a<num):
        index = j
        sum_a = num

total = 0.0
for m in range(index,index+k):
    total += sum(list(range(P[m]+1)))/P[m]
print(total)
### BUGGY CODE ###

N = int(input())
a = sorted(list(map(int, input().split())))
val, ans = [], []
for i in a:
    if i in set(val):
        ans.append(i)
    else:
        val.append(i)
ans.sort()
if len(ans) == 0:
    print(0)
else:
    if ans.count(ans[-1]) >= 4:
        print(ans[-1]**2)
    elif ans.count(ans[-1]) == 3:
        print(ans[-1]*ans[-4])
    elif ans.count(ans[-1]) == 2:
        print(ans[-1]*ans[-3])
    else:
        print(ans[-1]*ans[-2])
    


### FIXED CODE ###

N = int(input())
a = list(map(int, input().split()))
val = set()
ans = []

for i in a:
    if i in val:
        ans.append(i)
    else:
        val.add(i)
ans.sort()
if len(ans) == 0:
    print(0)
else:
    if ans.count(ans[-1]) >= 4:
        print(ans[-1]**2)
    elif ans.count(ans[-1]) == 3:
        print(ans[-1]*ans[-4])
    elif ans.count(ans[-1]) == 2:
        print(ans[-1]*ans[-3])
    else:
        print(ans[-1]*ans[-2])
### BUGGY CODE ###

n=int(input())
p=[]*n
p=list(map(int,input().split()))
cnt=0
for i in range(n):

    for j in range(0,i+1):
        if p[j]<p[i]:
            break
        if i==j:
            cnt+=1
print(cnt)

### FIXED CODE ###

n=int(input())
p=[]*n
p=list(map(int,input().split()))
cnt=0
com=p[0]
for i in range(n):
    if com>=p[i]:
        cnt+=1
    com=min(com,p[i])
print(cnt)
### BUGGY CODE ###

import sys
input = sys.stdin.readline

N=int(input().rstrip('\n'))
A=[int(x) for x in input().rstrip('\n').split()]
res = 0
now = 0
for i in range(1,N+1):
  if i in A:
    res += 1
    now = A.index(i)
    A = A[now:]
  else:
    break
if res == 0:
  print(-1)
else:
  print(N-res)

### FIXED CODE ###

import sys
input = sys.stdin.readline

N=int(input().rstrip('\n'))
A=[int(x) for x in input().rstrip('\n').split()]
now = 0
for x in range(N):
  if A[x] == now+1:
    now += 1
if now == 0:
  print(-1)
else:
  print(N-now)
### BUGGY CODE ###

n,k=map(int,input().split())
P=[list(map(int,input().split())) for _ in range(n)]
X=sorted(list(map(lambda x:x[0],P)))
Y=sorted(list(map(lambda x:x[1],P)))
s=(X[0]-X[-1])*(Y[0]-Y[-1])
ans=0
for r in range(1,n):
  for l in range(r):
    for u in range(1,n):
      for b in range(u):
        c=0
        for p in P:
          if X[l]<=p[0]<=X[r] and Y[b]<=p[1]<=Y[u]:
            c+=1
        if c>=k:
          s=min(s,(X[r]-X[l])*(Y[u]-Y[b]))
        else:break
print(s)

### FIXED CODE ###

n,k=map(int,input().split())
P=[list(map(int,input().split())) for _ in range(n)]
X=sorted(list(map(lambda x:x[0],P)))
Y=sorted(list(map(lambda x:x[1],P)))
s=(X[0]-X[-1])*(Y[0]-Y[-1])
ans=0
for r in range(n-1,0,-1):
  for l in range(r):
    for u in range(n-1,0,-1):
      for b in range(u):
        c=0
        for p in P:
          if X[l]<=p[0]<=X[r] and Y[b]<=p[1]<=Y[u]:
            c+=1
        if c>=k:
          s=min(s,(X[r]-X[l])*(Y[u]-Y[b]))
        else:break
    if u==n-1 and b==0 and c<k:
      break
print(s)
### BUGGY CODE ###

# -*- coding: utf-8 -*-
import itertools
import numpy as np
import sys
input = sys.stdin.readline


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return set(divisors)


def sieve(n):
    is_prime = [True for _ in range(n+1)]
    is_prime[0] = False

    for i in range(2, n+1):
        if is_prime[i-1]:
            j = 2 * i
            while j <= n:
                is_prime[j-1] = False
                j += i
    table = [i for i in range(1, n+1) if is_prime[i-1]]
    return is_prime, table


def main():
    a, b = map(int, input().split())
    a_divisors = make_divisors(a)
    b_divisors = make_divisors(b)
    divisors = a_divisors & b_divisors

    _, table = sieve(max(divisors))

    result = divisors & set(table)

    # print(divisors)
    # print(result)

    size = len(result) + 1
    print(size)


if __name__ == '__main__':
    main()


### FIXED CODE ###

# -*- coding: utf-8 -*-
import math
import fractions


def prime_factorization(n):
    i = 2
    table = []
    while i * i <= n:
        while n % i == 0:
            n = n // i
            table.append(i)
        i += 1
    if n > 1:
        table.append(n)
    return list(set(table))


def main():
    a, b = map(int, input().split())

    gcd = fractions.gcd(a, b)
    table = prime_factorization(gcd)
    print(len(table) + 1)


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

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

list = list(range(1,n+1))
for _ in range(m):
  a,b=map(int,input().split())
  if H[a-1] > H[b-1] and b in list:
    list.remove(b)
  elif H[a-1] < H[b-1] and a in list:
    list.remove(a)
  elif H[a-1] == H[b-1]:
    if a in list and b in list:
      list.remove(a)
      list.remove(b)
    elif a in list:
      list.remove(a)
    elif b in list:
      list.remove(b)
print(len(list))

### FIXED CODE ###

n,m = map(int,input().split())
h = list(map(int,input().split()))
cnt = [0]*n
chk = [0]*n
ans = 0

for i in range(m):
  a,b = map(int, input().split())
  if h[a-1] > h[b-1]:
    cnt[a-1] += 1
  elif h[a-1] < h[b-1]:
    cnt[b-1] += 1
  chk[a-1] += 1
  chk[b-1] += 1
  
for i in range(n):
  if cnt[i] == chk[i]:
    ans += 1
    
print(ans)
### BUGGY CODE ###

h, w = map(int, input().split())
cells = [input() for _ in range(h)]

us = [[0] * w for i in range(h)]
ds = [[0] * w for i in range(h)]
ls = [[0] * w for i in range(h)]
rs = [[0] * w for i in range(h)]

for x in range(w):
    u_cnt = 0
    for y in range(h):
        us[y][x] = u_cnt
        if cells[y][x] == '.':
            u_cnt += 1
        else:
            u_cnt = 0
    d_cnt = 0
    for y in range(h - 1, -1, -1):
        ds[y][x] = d_cnt
        if cells[y][x] == '.':
            d_cnt += 1
        else:
            d_cnt = 0
for y in range(h):
    l_cnt = 0
    for x in range(w):
        ls[y][x] = l_cnt
        if cells[y][x] == '.':
            l_cnt += 1
        else:
            l_cnt = 0

    r_cnt = 0
    for x in range(w - 1, -1, -1):
        rs[y][x] = r_cnt
        if cells[y][x] == '.':
            r_cnt += 1
        else:
            r_cnt = 0

maxv = 0
for y in range(h):
    for x in range(w):
        if cells[y][x] == '#':
            continue
        maxv = max(maxv, us[y][x] + ds[y][x] + ls[y][x] +
                   rs[y][x] + (1 if cells[y][x] == '.' else 0))
print(maxv)


### FIXED CODE ###

h, w = map(int, input().split())
cells = [input() for _ in range(h)]

us = [[0] * w for i in range(h)]
ds = [[0] * w for i in range(h)]
ls = [[0] * w for i in range(h)]
rs = [[0] * w for i in range(h)]

for x in range(w):
    u_cnt = 0
    for y in range(h):
        us[y][x] = u_cnt
        if cells[y][x] == '.':
            u_cnt += 1
        else:
            u_cnt = 0
    d_cnt = 0
    for y in range(h - 1, -1, -1):
        ds[y][x] = d_cnt
        if cells[y][x] == '.':
            d_cnt += 1
        else:
            d_cnt = 0
for y in range(h):
    l_cnt = 0
    for x in range(w):
        ls[y][x] = l_cnt
        if cells[y][x] == '.':
            l_cnt += 1
        else:
            l_cnt = 0

    r_cnt = 0
    for x in range(w - 1, -1, -1):
        rs[y][x] = r_cnt
        if cells[y][x] == '.':
            r_cnt += 1
        else:
            r_cnt = 0

maxv = 0
for y in range(h):
    for x in range(w):
        if cells[y][x] == '#':
            continue
        maxv = max(maxv, us[y][x] + ds[y][x] + ls[y][x] +
                   rs[y][x] + (1 if cells[y][x] == '.' else 0))
print(maxv)
### BUGGY CODE ###

N = int(input()) 
A=list(map(int,input().split())) 
i=0 
s=[] 
for i in range(N): 
    s.append(0) 
for i in range(N): 
    s[i]=A.count(i+1) 
for i in range(N): 
    print(s[i])

### FIXED CODE ###

import collections
n = int(input())
base = map(int,input().split())
c = collections.Counter(base)
for i in range(1,n):
    print(c[i])
print(0)