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

n = int(input())
list_a = list((map(int, input().split())))
memo = 0
memo_list = [0]
for i in range(0,n):
    memo += list_a[i]
    memo_list.append(memo)
#print(memo_list)
ans_pre_list = []
for number in set(memo_list):
    if memo_list.count(number) > 1:
        ans_pre_list.append(memo_list.count(number))
#print(ans_pre_list)
ans = 0
for number in ans_pre_list:
    ans += number * (number-1) / 2
print(int(ans))


### FIXED CODE ###

n = int(input())
list_a = list((map(int, input().split())))
memo = 0
memo_dict = {0:1}
for i in range(0,n):
    memo += list_a[i]
    if memo in memo_dict:
        memo_dict[memo] += 1
    else:
        memo_dict[memo] = 1
ans = 0
for number in memo_dict.values():
    ans += number * (number-1) / 2
print(int(ans))
### BUGGY CODE ###

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

answerList = [0] * 9999

for i in range(N[0]):
    if i > 0:
        for j in range(N[0]):
            if j + 1 > i > 0:
                calculateList = [abs(j + 1 - i),
                                 abs(N[1] - i) + 1 + abs(j + 1 - N[2]),
                                 abs(N[2] - i) + 1 + abs(j + 1 - N[1])]
                answerList[min(calculateList)] = answerList[
                                                     min(calculateList)] + 1

for i in range(N[0] - 1):
    print(answerList[i + 1])

### FIXED CODE ###

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

answerList = []

for i in range(N[0]):
    answerList.append(0)

for i in range(N[0]):
    if i > 0:
        for j in range(N[0]):
            if j + 1 > i > 0:
                calculateList = [abs(j + 1 - i),
                                 abs(N[1] - i) + 1 + abs(j + 1 - N[2]),
                                 abs(N[2] - i) + 1 + abs(j + 1 - N[1])]
                answer = min(calculateList)
                answerList[answer] = answerList[answer] + 1

for i in range(N[0] - 1):
    print(answerList[i + 1])
### BUGGY CODE ###

N = int(input())
ans = 0
for i in range(1, N + 1):
	if i ** 2 <= N and i ** 2 >= ans:
		ans = i * i
print(ans)

### FIXED CODE ###

N = int(input())
ans = 0
for i in range(1, 32000):
	if i ** 2 <= N and i ** 2 >= ans:
		ans = i * i
print(ans)
### BUGGY CODE ###

n = int(input())
l = []
def f(n, l):
  for i in range(1, n+1):
    sum = 0
    l.append(i)
    for j in range(len(l), 0, -1):
      if not sum + l[j-1] > n:
        sum += l[j-1]
      
      if sum == n:
        return i

print(f(n, l))

### FIXED CODE ###

n = int(input())
l = []

def f(n, l):
  sum = 0
  for i in range(1, n+1):
    sum += i
    if sum >= n:
      return i

print(f(n, l))
### BUGGY CODE ###

import math
#N = int(input())
N, M =  map(int,input().split())
#W =list(map(int,input().split()))
a = [(int(input())) for i in range(M)]


from operator import mul
from functools import reduce

def comb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

def stair_count(start,end):
    #print(start,end)
    aida = end - start
    total = 0
    i = aida
    #print("aida/2={}".format(aida/2))
    kazu = 0
    while i >= kazu:
        total += comb(i,kazu)
        kazu += 1
        i -= 1
    return total

start = 0
answer = 1
for i in a:
    #print("i={}".format(i))
        if i == start:
            print(0)
            exit()
        else:
            answer = (answer * stair_count(start, i-1))
            start = i+1
answer = (answer * stair_count(start, N))
    #print("answer={}".format(answer))
print(answer%1000000007)


### FIXED CODE ###

#N = int(input())
N, M =  map(int,input().split())
#W =list(map(int,input().split()))
a = [(int(input())) for i in range(M)]

import sys

sys.setrecursionlimit(100000)
memo  =[-1]*(N+2)
def stair_count(n):
    if memo[n]!= -1:
        return memo[n]
    if n==0 or n==1:
        memo[n] =1
        return memo[n]
    memo[n] = stair_count(n-1) + stair_count(n-2)
    return memo[n]

start = 0
answer = 1
for i in a:
        if i == start:
            print(0)
            exit()
        else:
            n = i-1-start
            answer = (answer * stair_count(n))
            start = i+1
n = N -start
answer = (answer * stair_count(n))
print(answer%1000000007)
### BUGGY CODE ###

n,p = map(int, input().split())
s = input()
ans = 0
for i in range(len(s)):
    for j in range(i+1, len(s)+1):
        if int(s[i:j]) % p == 0:
            ans += 1
print(ans)

### FIXED CODE ###

n,p = map(int, input().split())
s = input()
ans = 0
ruisekiwa = [0]*(n+1)
ten = 1

if 10 % p == 0:
    for i in range(n):
        if int(s[i]) % p == 0:
            ans += i+1
else:
    for i in range(0, n)[::-1]:
        a =  int(s[i]) * ten % p
        ruisekiwa[i] = (ruisekiwa[i+1] + a) % p
        ten *= 10
        ten %= p

    cnt = [0]*p
    for i in range(0, n+1)[::-1]:
        ans += cnt[ruisekiwa[i]]
        cnt[ruisekiwa[i]] += 1

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

N,Q=(int(i) for i in input().split())
x=input()
a=[]
for i in range(0,Q):
  a.append([int(j) for j in input().split()])
  answer=0
  l=x[a[i][0]-1:a[i][1]]
  for j in range(0,len(l)-1):
    if (l[j]=="A"):
      if (l[j+1]=="C"):
        answer+=1
  print(answer)

### FIXED CODE ###

N,Q=(int(i) for i in input().split())
x=input()
a=[]

j=0
s=[0]
t=0
while (j<N-1):
  if (x[j]=="A") and (x[j+1]=="C"):
    t+=1
    s.append(t)
  else:s.append(t)
  j+=1
for i in range(0,Q):
  a.append([int(j) for j in input().split()])
  p=s[a[i][1]-1]-s[a[i][0]-1]
  print(p)
### BUGGY CODE ###

def LCS(str1,str2):
    A = [[0 for _ in range(len(str2)+1)]for __ in range(len(str1)+1)]
    for i in range(len(str1)):
        for j in range(len(str2)):
            if(str1[i]==str2[j]):
                A[i+1][j+1] = A[i][j]+1
            elif(A[i+1][j] > A[i][j+1]):
                A[i+1][j+1] = A[i+1][j]
            else:
                A[i+1][j+1] = A[i][j+1]
    return A[-1][-1]
 
 
m = int(input())
for i in range(m):
    str1 = input()
    str2 = input()
    print(LCS(str1,str2))


### FIXED CODE ###

def LCS(str1,str2):
    A = [0 for _ in range(len(str2)+1)]
    for i in range(len(str1)):
        A_copy = A[:]
        for j in range(len(str2)):
            if(str1[i]==str2[j]):
                A[j+1] = A_copy[j]+1
            elif(A[j] > A[j+1]):
                A[j+1] = A[j]
    print(A[-1])


m = int(input())
for i in range(m):
    str1 = input()
    str2 = input()
    LCS(str1,str2)
### BUGGY CODE ###

n=int(input())
a=list(input())
mini=3*10**5
for i in range(n):
    temp=0
    x=a[:i].count("W")
    y=a[i+1:].count("E")
    temp=x+y
    mini=min(mini,temp)
print(mini)

### FIXED CODE ###

n=int(input())
a=input()
import collections 
e=a.count("E")
w=0
mini=n
for i in range(n):
    if a[i]=="E":
        e-=1
    if i!=0 and a[i-1]=="W":
        w+=1
    mini=min(mini,e+w)
print(mini)
### BUGGY CODE ###

score = int(input())
keta = 0
answer = 0
alpha = 7
if score % 2 == 0 or score % 10 == 5:
    print(-1)
elif score == 999983:
    print(999982)
else:
    while answer == 0:
        if alpha % score != 0:
            alpha = alpha*10 + 7
        else:
            answer = 1
        keta += 1
    print(keta)

### FIXED CODE ###

k = int(input())
mod = 7 % k
if k % 2 == 0:
    print(-1)
else:
    ans = 1
    while mod != 0:
        mod = (10*mod + 7) % k
        ans += 1
        if ans >= 10**7:
            print(-1)
            break
    if ans < 10**7:
        print(ans)
### BUGGY CODE ###

N = int(input())
a_list = list(map(int, input().split()))
a_list_unique = list(set(a_list))
cnt = 0
a_dict = {}
for i in a_list_unique:
    a_dict[i] = a_list.count(i)
    if i <= a_dict[i]:
        cnt +=  a_dict[i] - i
    else:
        cnt += a_dict[i]
print(cnt)

### FIXED CODE ###

import sys
input = sys.stdin.readline
from collections import Counter


N = int(input())
a_list = list(map(int, input().split()))
a_list_unique = list(set(a_list))
a_cnt = Counter(a_list)
cnt = 0
for i in a_list_unique:
    a_dict = a_cnt[i]
    if i <= a_dict:
        cnt +=  a_dict - i
    else:
        cnt += a_dict
print(cnt)
### BUGGY CODE ###

dic = tuple()
n = int(input())
for i in range(n):
    ins, op = input().split()
    if ins == 'insert':
        dic += (op,)
    if ins == 'find':
        print({True: 'yes', False: 'no'}[op in dic])

### FIXED CODE ###

import sys
dic = set()
L = sys.stdin.readlines()

for Ins in L[1:]:
    ins, op = Ins.split()
    if ins == 'insert':
        dic.add(op)
    if ins == 'find':
        print('yes' if op in dic else 'no')
### BUGGY CODE ###

#import sys
#sys.setrecursionlimit(10 ** 7)

'''
#import numpy as np
import math, string, itertools, fractions, heapq, collections, re, array, bisect, copy, functools, random
from collections import deque, defaultdict, Counter
from heapq import heappush, heappop
from itertools import permutations, combinations, product, accumulate, groupby
from bisect import bisect_left, bisect_right, insort_left, insort_right
from operator import itemgetter as ig
#sys.setrecursionlimit(10 ** 7)
'''
#inf = 10 ** 20
'''
INF = float("INF")
mod = 10 ** 9 + 7
"""dd = [(-1, 0), (0, 1), (1, 0), (0, -1)];
ddn = dd + [(-1, 1), (1, 1), (1, -1), (-1, -1)];
ddn9 = ddn + [(0, 0)]
for dx, dy in dd:
        nx = j + dx; ny = i + dy
            if 0 <= nx < w and 0 <= ny < h:"""

def wi(): return list(map(int, sys.stdin.readline().split()))
def wip(): return [int(x) - 1 for x in sys.stdin.readline().split()]  # WideIntPoint
def ws(): return sys.stdin.readline().split()
def si(): return int(sys.stdin.readline())  # SingleInt
def ss(): return input()
def hi(n): return [si() for _ in range(n)]
def hs(n): return [ss() for _ in range(n)]  # HeightString
def s_list(): return list(input())
def mi(n): return [wi() for _ in range(n)]  # MatrixInt
def mip(n): return [wip() for _ in range(n)]
def ms(n): return [ws() for _ in range(n)]
def num_grid(n): return [[int(i) for i in sys.stdin.readline().split()[0]] for _ in range(n)]  # NumberGrid
def grid(n): return [s_list() for _ in range(n)]

'''
def main():
    N, M = map(int, input().split())
    a = [int(input()) for _ in range(M)]
    dp = [1] * N
    if 1 in a:
        dp[0] = 0
        for i in range(1,N):
            if i+1 in a:
                dp[i] = 0
            else:
                dp[i] = dp[i-1] + dp[i-2]
        print(dp[N-1] % (10**9+7))
    else:
        for i in range(1,N):
            if i+1 in a:
                dp[i] = 0
            else:
                dp[i] = dp[i-1] + dp[i-2]
        print(dp[N-1] % (10**9+7))

if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    N, M = map(int, input().split())
    a = [int(input()) for _ in range(M)]
    b = set(a)
    dp = [1] * N
    if 1 in a:
        dp[0] = 0
        for i in range(1, N):
            if i+1 in b:
                dp[i] = 0
            else:
                dp[i] = dp[i-1] + dp[i-2]
        print(dp[N-1] % (10**9+7))
    else:
        for i in range(1, N):
            if i+1 in b:
                dp[i] = 0
            else:
                dp[i] = dp[i-1] + dp[i-2]
        print(dp[N-1] % (10**9+7))


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

# -*- coding: utf-8 -*-
import sys

S = input()
Q = int(input())
rev_flg = False

for i in range(Q):
  q = input().split(" ")
  if len(q)==1:
    # T=1のときは文字列を反転する
    rev_flg = not(rev_flg)
  if len(q)==3:
    # print("T=2, S=",S)
    # T=2のときは
    # F=1なら先頭に文字列Cを追加
    if int(q[1])==1:
      if rev_flg==False:
      	S = q[2] + S
      else:
        S = S + q[2]
    # F=2なら最後に文字列を追加
    if int(q[1])==2:
      if rev_flg==False:
        S = S + q[2]
      else:
        S = q[2] + S
  
if rev_flg==True:
  print(S[::-1])
else:
  print(S)

### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys
from collections import deque

S = input()
Q = int(input())
rev_flg = False

output = deque()
output.append(S)

for i in range(Q):
  q = input().split(" ")
  if len(q)==1:
    # T=1のときは文字列を反転する
    rev_flg = not(rev_flg)
    # print(rev_flg)
  if len(q)==3:
    # print("T=2, S=",S)
    # T=2のときは
    # F=1なら先頭に文字列Cを追加
    if int(q[1])==1:
      if rev_flg==False:
        output.appendleft(q[2])
      else:
        output.append(q[2])
    # F=2なら最後に文字列を追加
    if int(q[1])==2:
      if rev_flg==False:
        # S = S + q[2]
        output.append(q[2])
      else:
        # S = q[2] + S
        output.appendleft(q[2])
  
output_s = "".join(list(output))

if rev_flg==True:
  print(output_s[::-1])
  #print(S[::-1])
else:
  #print(S)
  print(output_s)
### BUGGY CODE ###

from statistics import mean, median,variance,stdev
import sys
import math
import fractions

def j(q):
    if q==1: print("YES")
    else:print("NO")
    exit(0)


def ct(x,y):
    if (x>y):print("")
    elif (x<y): print("")
    else: print("")

def ip():
    return int(input())

#n = ip()                              #入力整数1つ
#n,k= (int(i) for i in input().split())      #入力整数横2つ
x,y,z = (int(i) for i in input().split())    #入力整数横3つ
#n,m,x,y= (int(i) for i in input().split())  #入力整数横4つ
#a = [int(i) for i in input().split()]        #入力整数配列
#a = input()                                  #入力文字列
#a = input().split()                          #入力文字配列

#jの変数はしようできないので注意
for i in range(x,y+1):
    if i <x+z:
        print(i)
    elif i > y-z:
        print(i)

### FIXED CODE ###

from statistics import mean, median,variance,stdev
import sys
import math
import fractions

def j(q):
    if q==1: print("AC")
    else:print("WA")
    exit(0)


def ct(x,y):
    if (x>y):print("")
    elif (x<y): print("")
    else: print("")

def ip():
    return int(input())

#n = ip()                              #入力整数1つ
#x,y= (int(i) for i in input().split())      #入力整数横2つ
a,b,k = (int(i) for i in input().split())    #入力整数横3つ
#n,m,x,y= (int(i) for i in input().split())  #入力整数横4つ
#a = [int(i) for i in input().split()]        #入力整数配列
#a = input()                                  #入力文字列
#a = input().split()                          #入力文字配列

#jの変数はしようできないので注意
#全足しにsum変数使用はsum関数使用できないので注意
c = [ i for i in range(a,min(b,a+k))]
d = [ i for i in range(max(b-k+1,a),b+1)]
e = set()
for i in range(len(c)):
    e.add(c[i])
for i in range(len(d)):
    e.add(d[i])
e = list(e)
e.sort()
for i in range(len(e)):
    print(e[i])
### BUGGY CODE ###

import sys
from math import factorial

mod = 10**9 + 7


def Cmb(n, k):
    return factorial(n) // (factorial(n - k) * factorial(k))


n, m = list(map(int, input().split()))
a = [int(input()) for _ in range(m)]
l = len(a)

if 1 in [a[i + 1] - a[i] for i in range(l - 1)]:
    print(0)
    sys.exit()

b = [-1] + a + [n + 1]
c = []
for bi, bi2 in zip(b[:-1], b[1:]):
    c.append((bi2 - 1) - (bi + 1))  # width 2 を取れる数


def count(n):
    ret = 0
    for i in range(n // 2 + 1):
        ret += Cmb(n - i, i) % mod
    return ret


ans = 1
for ci in c:
    ans *= count(ci) % mod
    ans %= mod

print(ans)


### FIXED CODE ###

mod = 10**9 + 7

n, m = list(map(int, input().split()))
a = set([int(input()) for _ in range(m)])

dp = {}
for i in range(n + 1):
    dp[i] = 1
dp[1] = 0 if 1 in a else 1
for i in range(2, n + 1):
    if i in a:
        dp[i] = 0
    else:
        dp[i] = dp[i - 1] % mod + dp[i - 2] % mod
        dp[i] %= mod

print(dp[n] % mod)
### BUGGY CODE ###

import heapq
n,m = map(int,input().split())
l = [0]*n
for i in range(n):
  l[i] = list(map(int,input().split()))
l.sort()

L = [[] for i in range(m+1)]
for i in range(n):
  if l[i][0] <= m:
    L[l[i][0]].append(l[i][1])

a = []
ans = 0
for i in range(m):
  key = i+1
  for j in L[key]:
    a.append(-j)
  if a != []:
    heapq.heapify(a)
    ans += heapq.heappop(a)
print(-ans)

### FIXED CODE ###

from heapq import *
n,m = map(int,input().split())
l = [[] for i in range(m+1)]
for i in range(n):
  a,b = map(int,input().split())
  if a < m+1:
    l[a].append(b)

ans = 0
a = []
for i in range(1,m+1):
  for j in l[i]:
    heappush(a,-j)
  if a:
    ans -= heappop(a)
print(ans)
### BUGGY CODE ###

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

def main():

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

    ans = 1

    for i in A:
        if A == 0:
            ans = 0
            break
        ans *= i
        if ans > 10 ** 18:
            ans = -1

    print(ans)


if __name__ == "__main__":
    main()

### FIXED CODE ###

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

def main():

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

    ans = 1

    if 0 not in A:
        for i in A:
            ans *= i
            if ans > 10 ** 18:
                ans = -1
                break

    else:
        ans = 0

    print(ans)


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

L, R = map(int, input().split())

answer = 5000
for i in range(L, R+1):
    for j in range(i+1, R+1):
        if (i*j)%2019 < answer:
            answer = (i*j)%2019
print(answer)

### FIXED CODE ###

import heapq

L, R = map(int, input().split())

if R - L >= 2019:
    print(0)
else:
    answer = 5000
    for i in range(L, R + 1):
        for j in range(i + 1, R + 1):
            if (i * j) % 2019 < answer:
                answer = (i * j) % 2019
    print(answer)
### BUGGY CODE ###

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

ret = 0
lim = [0] * (N+1)
for i in range(len(lim)):
    if i == 0:
        lim[i] = 2**i - A[i]
    else:
        lim[i] = 2*lim[i-1] - A[i]
    if lim[i] < 0:
        print(-1)
        exit(0)

for d in reversed(range(N+1)):
    if A[d] > 2**d:
        print(-1)
        exit(0)
    if d == N:
        n = min(A[d], 2**d)
    else:
        n = min(A[d] + min(n, lim[d]), 2**d)
    ret +=n
# ret = 0
# for d in range(N+1):
#     if d == 0:
#         n = 2**d - A[d]
#     else:
#         n = 2*n - A[d]
#
#     if n<=0:
#         print(-1)
#         exit(0)
#     ret += n


print(ret)

### FIXED CODE ###

import os
from collections import defaultdict

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

pow2 = defaultdict(int)

ret = 0
lim = [0] * (N + 1)
# for i in range(N + 1):
#     pow2[i] = 2 ** i

for i in range(N + 1):
    if i == 0:
        r = 1 - A[i]
    else:
        r = 2 * lim[i - 1] - A[i]
    if r < 0:
        print(-1)
        exit(0)
    lim[i] = r

for d in reversed(range(N + 1)):
    # if A[d] > pow2[d]:
    #     print(-1)
    #     exit(0)
    if d == N:
        #n = min(A[d], pow2[d])
        n = A[d]
    else:
        #n = min(A[d] + min(n, lim[d]), pow2[d])
        n = A[d] + min(n, lim[d])
    ret += n

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

# import math


def make_divisor_list(num):
    if num <= 0:
        # return []
        return make_divisor_list(-num)
    elif num == 1:
        return [1]
    else:
        divisor_list = [1]
        for i in range(2, num // 2 + 1):
            if num % i == 0:
                divisor_list.append(i)
        divisor_list.append(num)
        return divisor_list


# print(make_divisor_list(24))

N, X = [int(x) for x in input().split()]
xlist = [int(x) for x in input().split()]

# print(xlist)

shiftedX = [x - X for x in xlist]

# print(shiftedX)

divisor_set_list = [set(make_divisor_list(x)) for x in shiftedX]
# print(divisor_set_list)

div_set = divisor_set_list[0]

for s in divisor_set_list:
    div_set = div_set & s

# print(div_set)

print(max(div_set))


### FIXED CODE ###

# import math


def gcd(a, b):
    a = abs(a)
    b = abs(b)
    if b > a:
        return gcd(b, a)
    if a % b == 0:
        return b
    else:
        return gcd(b, a % b)

# print(make_divisor_list(24))


N, X = [int(x) for x in input().split()]
xlist = [int(x) for x in input().split()]

# print(xlist)

shiftedX = [x - X for x in xlist]

# print(shiftedX)

maxDivisor = shiftedX[0]
for n in shiftedX:
    maxDivisor = gcd(maxDivisor, n)

print(maxDivisor)
### BUGGY CODE ###

N,K=map(int, input().split())
P=list(map(int, input().split()))
 
ans=0
for i in range(N):
  try:
    ans=max(ans,sum(P[i:i+K]))
  except:
    break
print((ans+K)/2)

### FIXED CODE ###

import sys

N,K=map(int,input().split())
P=list(map(int,input().split()))
Q=[(1+p)/2 for p in P]
temp=sum(Q[:K])
ans=temp
for i in range(N):
  try:
    temp=temp-Q[i]+Q[i+K]
    ans=max(ans,temp)
  except:
    pass
else:
  print(ans)
### BUGGY CODE ###

import sys
inputs = sys.stdin.readline
N, Q= map(int,inputs().split())
V = [list(map(int,inputs().split())) for p in [0]*N]
V.sort(key = lambda x:(x[2]))

for q in [0]*Q:
	m = int(inputs())
	for n in range(N):
		if V[n][0] - V[n][2] <=m and m <= V[n][1] - V[n][2] -1:
			print(V[n][2])
			break
	else:
		print(-1)

### FIXED CODE ###

import sys
from operator import itemgetter
def main():
	inputs = sys.stdin.readline
	N, Q= map(int,inputs().split())
	E = [None]*2*N
	for n in range(N):
		a,b,c = map(int,inputs().split())
		E[2*n] = (a - c, 1, c)
		E[2*n + 1] = (b - c, -1, c)
	E.sort(key=itemgetter(0))
	tuple(tuple(E))
	mini = 1000000001
	kouho = {1000000001}
	my_add = kouho.add
	my_discard = kouho.discard
	q = 0
	d = int(inputs())
	flag = False
	cont = False
	for e in E:
		while e[0] > d:
			if cont == True:
				print(mini-(mini//1000000001)*1000000002)
			else:
				mini = min(kouho)
				print(mini-(mini//1000000001)*1000000002)
			cont = True
			q = q + 1
			if q > Q-1:
				flag = True
				break
			d = int(inputs())
		if flag == True:
			break
		if e[1] == 1:
			my_add(e[2])
			if mini > e[2]:
				mini = e[2]
		elif e[1] == -1:
			my_discard(e[2])
			if mini == e[2]:
				cont = False
	for t in [None]*(Q-q):
		print(-1)
main()
### BUGGY CODE ###

R, G, B, N = map(int, input().split())

ans = 0
for r in range(3000 // R + 1):
    if N - r * R < 0:
        break
    for g in range(3000 // G + 1):
        tmp = N - r * R - g * G
        if tmp < 0:
            break
        if tmp % B == 0 and tmp // B >= 0:
            ans += 1

print(ans)


### FIXED CODE ###

R, G, B, N = map(int, input().split())

ans = 0
for r in range(N // R + 1):
    for g in range((N - R * r) // G + 1):
        tmp = N - r * R - g * G
        if tmp % B == 0:
            ans += 1

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

import numpy as np
S = input()
mod = 10 ** 9 + 7

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


### FIXED CODE ###

#!python3

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

# input
S = input()

MOD = 10 ** 9 + 7


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

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


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

n = input()
l = len(n)
a = [0 for _ in range(2019)]
a[0] = 1
now = 0
for i in range(l)[::-1]:
  now += (10**(l-1-i))*int(n[i])
  now %= 2019
  a[now] += 1
  #print(now)
ans = 0
for d in range(2019):
  ans += a[d] * (a[d]-1) // 2
print(ans)

### FIXED CODE ###

n = input()
l = len(n)
a = [0 for _ in range(2019)]
a[0] = 1
now = 0
ten = [1]
for i in range(l-1):
  ten.append(ten[-1]*10%2019)
ten.reverse()
for i in range(l)[::-1]:
  now += ten[i]*int(n[i])
  now %= 2019
  a[now] += 1
  #print(now)
ans = 0
for d in range(2019):
  ans += a[d] * (a[d]-1) // 2
print(ans)
### BUGGY CODE ###

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


### FIXED CODE ###

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