peterverebics/CodeNet_Python_118 huggingface dataset:
N = int(input())
an = input().split()
An =[]
for a in an:
    An.append(int(a))
buka = []
for i in range (1,N):
    buka.append(An.count(i))
for b in buka:
    print(b)
n=int(input())
a=list(map(int,input().split()))
buka=[0]*n
for i in a:
  buka[i]=buka[i]+1
for i in buka:
  print(i)
import collections
import numpy as np

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

zero = np.zeros(n+1)
c = collections.Counter(a)

for val,key in c.items():
    zero[val] = key

for i in range(len(zero)):
    if i > 0:
        print(zero[i])
n = int(input())
a = list(map(int, input().split()))
sub = []
for i in range(0, n):
    sub.append(0)
for j in a :
    sub[j - 1] += 1
print(sub)
N = int(input())
As = list(map(int, input().split()))
sort_as = sorted(As)
shine = [x + 1 for x in range(N)]
c = 0
l = 0
for x in range(N):
  for y in range(len(As)):
    if As[y] < shine[x]:
      continue
    elif shine[x] < As[y]:
      l += 1
      break
    elif shine[x] == As[y]:
      c += 1
  print(c)
  c = 0
  del As[:l]
  l = 0
N = int(input())
a = list(map(int,input().split()))
M = N

mydict = {}
for i in range(N):
    mydict[i] = 0


for i in range(len(a)):
    if a[i] <= N:
        mydict[a[i]-1] += 1 
        N -= 1

for i in range(M):
    print(mydict[i])
n = int(input())
person = n * [0]
boss = list(map(int, input().split()))
for b in boss:
  person[b-1] += 1
for i in range(0, n):
  print(person[1])
n=int(input())
a=list(map(int,input().split()))
new=[0]*n 
i,j,k=0,0,0 
while(i<n-1):
    c=0
    j=i 
    while(j<n-1):
        if(a[i]==a[j]):
            c+=1
        else:
            break
        j+=1 
    i=j
    new[k]=c 
    k+=1 
for i in range(n):
    print(new[i])
N = int(input())
A = list(map(int, input().split()))
counter = [0] * N
for i in range(len(A)):
  for j in range(i-1):
    if A[i] == j:
      counter[j-1] += 1
for i in range(N):
  print(counter[i])
import collections

n = int(input())

l = list(map(int, input().split()))

c = collections.Counter(l)

print(c[1])
for i in l:
  print(c[i+1])
n = int(input())
a = list(map(int, input().split()))

num = [0] * n
for i in range(0,n):
    num[i-1] += 1
print(num[i])
num = int(input())
li = list(int(x) for x in input().split())
li2 = [0] * num
num = len(li)
for i in li:
  li2[i - 1] = li2[i - 1] + i
for j in range(num):
  print(li2[j])
import numpy as np

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

b = np.zeros(shape=(n), dtype=np.int)

for i in a:
  b[i] += 1

for i in range(n):
  if i == 0:
    continue
  print(b[i])
N = int(input())
A = list(map(int, input().split(' ')))
A.insert(0, 0)
last_time = -1
for a in A:
    if a != last_time:
        print(A.count(a + 1))
        last_time = a
    else:
        print(0)
N = int(input())
Ai = [int(x) for x in input().split()]
for i in Ai:
    print(Ai.count(i))
n = int(input())
a = list(int(i) for i in input().split())
lst = [0] * (n + 1)

for i in a:
    lst[i] += 1

for i in range(1, n):
    print(lst[i])
import collections
N=int(input())
a=list(map(int,input().split()))

c = collections.Counter(a)

for i in c.values():
    print(i)

l=N-len(c)
for j in range(l):
    print("0")
N = int(input())
X = [0]*N
A = list(map(int,input().split()))
for i in A:
    X[i] +=1
print(X,sep="\n")
N = int(input())
A = input().split()
for i in range(N):
  count = 0
  for j in range(N-1):
    if i+1 == int(A[j]):
      count += 1
    print(count)
import sys
def input():
    return sys.stdin.readline()[:-1]
N = int(input())
l = list(map(int, input().split()))
ANS = [0]*N

for i in range(N-1):
    k = l[i]
    ANS[k] += 1
for i in range(1,N):
    print(ANS[i])
N = int(input())
A = list(map(int, input().split()))

G = [0] * (N + 1)
for i, val in enumerate(A):
    G[val] += 1
print(G)

for i in range(1, N + 1):
    print(G[i])
n = int(input())

A = [int(x) for x in input().split()]
B = {}

for a in A:
    if a not in B:
        B[a] = 0
    B[a] += 1

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

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

S = [0] * N

for i in A:
    S[i] += 1 

for s in S[1:]:
    print(s)
import collections
N=int(input())
a=list(map(int,input().split()))

c = collections.Counter(a)
c2=sorted(c.items())

m=[i[1] for i in c2]

for k in m:
    print(k)
        
l=N-len(c)

for j in range(l):
    print("0")
N = int(input())
A = list(map(int, input().split()))
D = [0 for i in range(N)]

for i in A:
    D[i] += 1

print(*D, sep='\n')
N = int(input())
A = map(int, input().split())
A = list(A)
count=[0]*N
for i in range(N-1):
    for j in range(N-1):
        if i==j:
            continue
        elif A[i]-A[j]==-1:
            count[i]+=1
        
for i in range(N):
    print(str(count[i]))
import bisect

n = int(input())
a = list(map(int, input().split()))
for i in range(1, n + 1):
    bisleft = bisect.bisect_left(a, i)
    bisright = bisect.bisect_right(a, i)
    print(bisright - bisleft)
from collections import Counter

n = int(input())
a = list(map(int, input().split()))
d = Counter(a)
for i in d:
    print(d[i])
for i in range(n-len(d)):
    print(0)
from collections import deque
N=int(input())
A = deque(list(map(int, input().split())))

n = N-1
for i in range(N):
    if len(A)>0:
        ans =0
        while i+1==A[0]:
            x = A.popleft()
            ans += 1
            n -= 1
            if n ==0:
                break
        print(ans)
    else:
        print(0)
n = int(input())
b = list(map(int, input().split()))

for i in range(n):
  if (i+1) in b:
    c=0
    for j in range(len(b)):
      if b[j]==i+1:
        c += 1
      else:
        break
    print(c)
  else:
    print(0)
import collections
n = int(input())
A = list(map(int, input().split()))
cnt = collections.Counter(A)
for i in range(1,n):
  print(cnt[i])
from collections import Counter
n=int(input())
a=[int(i) for i in input().split()]
new=Counter(a)
for i in new.values():
    print(i)
[print(0) for j in range(1,n-len(new)+1)]
N=int(input())
A=list(map(int,input().split()))

A.sort()
if A[0]==0:
    A.remove(0)

l=len(A)
k=0

ans=1

m=max(A)

for i in range(l-1):
    if A[i+1]>A[i]:
        k=A[i]
        print(ans)
        while A[i+1]!=k+1:
            k=k+1
            print(0)
        ans=0
    else:
        ans=ans+1
ans=ans+1
print(ans)
    
   
for j in range(m+1,N+1):
    print(0)
import collections
N=int(input())
A=list(map(int,input().split()))
a=collections.Counter(A)
for i in range(N):
  print(a["i"])
N = int(input())
A_l = list(map(int, input().split()))

ans_l = [0]*N

i = 0
while i < N-1:
  ans_l[A_l[i]-1] += 1
  i += 1

i=0
while i < N-1:
  print(ans_l[i])
  i += 1
for i in range(1):
	n=int(input());
	l=list(map(int,input().split()))
	d=dict();
	for j in range(n):
		d[j]=0;
	for j in range(len(l)):
		if(d[j]==0):
			d[j]+=1;
		else:
			d[j]+=1;
	for j in d.values():
		print(j,sep="\n")
n = int(input())
a = [int(i) for i in input().split()]
ans = [0] * (n+1)
for i in a:
    ans[i] += 1
[print(i) for i in ans]
def main():
  N = int(input())
  A = [int(x) for x in input().split()]
  
  B = [0] * N    
  for i in range(N-1):
      B[A[N-i-2]] += 1
  
  for i in range(N):
    print(B[i])
    
if __name__ == '__main__':
  main()
N=int(input())
import collections
b=input().split()
c = collections.Counter(b)
c=c.values()

for item in c :
	print(item)
	N-=1
for i in range(N) :
	print('0')
n=int(input())
a=list(map(int,input().split()))
a1=[0]*(n+1)
for i in range(n-1):
    a1[a[i]]+=1
print(a1)
for j in range(1,n+1):
    print(a1[j])
N=int(input())
a = list(map(int, input().split()))
print(a.count(1))
for i in range(0,N-1):
    n=a.count(a[i]+1)
    print(n)
N = int(input())
list = [int(N) for N in input().split()]
for i in range(1,N):
    print(list.count(i+1))
N = int(input())
A = list(map(int,input().split()))

count = 1

print(A.count(count))

for i in range(N-1):
    if count == A[i]:
        count += 1
        print(A.count(count))
    else:
        print(0)
N = int(input())
a = list(map(int,input().split()))
buka_num=[]
for i in range(1,len(a)):
  buka_num.append(a.count(i))
buka_num.append(0)
print(buka_num)
# C - management
n = int(input())
a = list(map(int, input().split()))
ans = [0] * n
for i in range(n-1):
    ans[a[i]-1] += 1
print(ans)
import sys
input = sys.stdin.readline
N = int(input())
A = list(map(int,input().split()))
M = [A.count(x) for x in range(1,N)]
print('\n'.join(map(str,M)))
N = input()
a = list(map(int,input().split()))
print(N,a)
for i in range(int(N)-1):
	print(a.count(i+1))
from collections import Counter
from collections import defaultdict
n = int(input())
a = list(map(int,input().split()))
b = dict(Counter(a))
c = list(b.keys())
c.sort()
a.sort()
d = [b[i] for i in c] + [0]
d1 = defaultdict(lambda:-1)
c = [0]+c[:]
for i,j in enumerate(d):
    d1[c[i]] = j
e = defaultdict(lambda: 1)
print(d[0])
for i in range(n-1):
    #print(a[i],d,e)
    if e[a[i]]==1:
        e[a[i]]=0
        print(d1[a[i]])
    else:
        print(0)
N = int(input())
A = list(map(int,input().split()))
B = [0] * (N - 1)
for i in range(N - 1):
    B[A[i] - 1] += 1
for i in B:
    print(i)
N=int(input())
A=list(map(int,input().split()))
X=[0]*N
for i in range(N-1):
  X[A[i]]+=1
for i in range(N):
  print(X[i])
import numpy as np
N = int(input())
A_list = list(map(int, input().split()))
index = np.arange(1, N+1)
ans = ["{}\n".format(A_list.count(i)) for i in range(1, N+1)]
print(ans)
# abc163
n = int(input())
members = list(map(int,input().split()))

for i in range(1,len(members)):
    print(members.count(i))
from collections import deque

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

q = deque()
q.append(0)

while len(q) > 0:
    a = q.popleft()
    count = a_list.count(a+1)
    if count > 0:q.append(a+1)
    print(count)
    for i in range(a_list.count(a)-1):
        print(0)
import numpy as np

num = int(input())
sup_num = list(map(int,input().split()))
yn_num = list(np.zeros(num))
print(yn_num)
for x in sup_num:
  yn_num[x-1] +=1
print(list(yn_num))
N = int(input())
A = list(map(int, input().split()))
for i in range(len(A)):
    print(A.count(A[i] + 1))
N=int(input())
*A,=tuple(map(int,input().split()))

import bisect

for i in range(1,N+1):
    print(bisect.bisect_right(A,i)-bisect.bisect_left(A,i))
import collections

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

c = list(collections.Counter(a).values())
r = c + [0] * (n - len(c))

for i in r:
    print(i)
N = int(input())
A_list = list(map(int, input().split()))

a = 0
num = 0
while True:
    print(A_list.count(a+1))
    co = A_list.count(a) - 1
    for i in range(co):
        print(0)
    a += 1
    if a > A_list[-1]:
        break
from collections import defaultdict
n = int(input())
a = list(map(int,input().split()))
a = [0] + a
cnt = defaultdict(lambda :0)

for i in a:
    cnt[i - 1] += 1

for i in a:
    print(cnt[i - 1])
    cnt[i - 1] = 0
num = int(input())
l_a = input().split()
s_a = set(l_a)

dc = {}

l_s = []
for i in s_a:
  dc[i] = l_a[int(i)-1:].count(i)
  
index = 1
k = 0
l_key = sorted(dc.keys())

for i in l_key:
  while int(i) + k < index:
    print(0)
    k += 1
  print(dc[i])
  index += 1
  
while index <= num:
  print(0)
  index += 1
import collections 

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

c = collections.Counter(a)
print(c)

for i in range(1, n + 1):
  print(c[i])
import collections
N=int(input())
A=list(map(int,input().split()))
c=collections.Counter(A)
d=c.values()
for i in d:
  print(i)
for j in range(N-len(d)):
  print(0)
from collections import Counter
N = int(input())
funcionarios = list(map(int,input().split()))
for x in Counter(funcionarios).values():
    print(x)

print(0)
N = int(input())
A = list(map(int,input().split()))
l = [0]*N
for i in A:
  l[i-1] += 1
print(l,sep="\n")
n = int(input())
dict = {}
for i in map(int, input().split(" ")):
	dict[i] = dict.get(i, 0) + 1

for i in range(n):
	print(dict.get(i, 0))
import numpy as np

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

boss=[0]*N

for x in staff:
    boss[x-1] += 1
print(list)
n = int(input())
A =[int(x) for x in input().split()]
ans = [0] * n
for i in range(n-1):
    ans[A[i]] +=1

for i in ans:
    print(ans[i])
n = int(input())
a_list = map(int, input().split())

ans_dict = {}
for a in a_list:
    if not(a in ans_dict):
        ans_dict[a] = 0
    ans_dict[a] += 1

for i in range(1, n+1):
    if not(i in ans_dict):
        print(0)
    else:
        print(ans_dict[a])
n = int(input())
a = list(map(int, input().split()))

a.sort()
x = a[0]
counter = 1
for i in range(1, n-1):
  if x == a[i]:
    counter += 1
    continue
  else:
    print(counter)
    if x+1 == a[i]:
      x += 1
      counter = 1
    else:
      print(0)
      x += 1
      counter = 1
print(counter)
while x < n:
  print(0)
  x += 1
N=int(input())
A=list(map(int,input().split()))
A.insert(0,0)

for i in range(len(A)):
    print(A.count(A[i]+1))
n = int(input())
a = list(map(int, input().split()))
sorted(a)
length=len(a)

previous=1
count=0
for j in a+[n+1]:
    if j==previous:
        count+=1
    else:
        print(count)
        count=1
        for _ in range(j-previous-1):
            print(0)
        previous=j
n=int(input())
a=list(map(int,input().split()))
j=0
c=0
import sys

for i in range(1,n+1):
    while 1:
        if j==n-1:
            
            break
        if i!=a[j]:
            break
        else:
            c+=1
            j+=1
    print(c)
    c=0
N = int(input())
A = list(map(int, input().split()))

bukaList = []
for i in range(N-1):
    count = A.count(i+1)
    bukaList.append(count)


for k in range(N-1):
    print(bukaList[k])
N=int(input())
a=list(map(int,input().split()))
for i in range(N-1):
  print(a[i])
print(0)
N = int(input())
A = list(map(int, input().split()))

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

buka_num = []

for i in range(1, N+1):
	buka_num.append(A.count(i))

print(buka_num, sep='¥n')
N = int(input())
A = list(map(int, input().split()))
A.insert(0, 0)
for i in range(N):
    tmp = 0
    for j in range(i+1, N):
        if(i+1 == A[j]):
            tmp += 1
        if(i+1<A[j]):
            break
    print(tmp)
    if (tmp==0):
        for k in range(int(N-i-1)):
            print(0)
        break
n = int(input())
a = list(map(int, input().split()))
count = [0] * (n)
for i in range(len(a)):
    count[a[i] % n] += 1
count.sort(reverse=True)
for i in range(len(count)):
    print(count[i])
N=int(input())
A=list(map(int, input().split()))

i=1
for j in range(N-1):
  print(A.count(i))
  i+=1
from collections import defaultdict

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

d=defaultdict(int)
for item in a:
    d[item-1]+=1
print(d)
for i in range(n):
    print(d[i])
from collections import Counter

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

ct = Counter(As)

for i in range(n):
	if i in ct.keys():
		print(ct[i])
	else:
		print('0')
N= int(input())
A=list(map(int,input().split()))


cnt=[0]*N
for i in range(1,N):
  cnt[A[i-1]-1]=cnt[A[i-1]-1]+1
print(cnt)
N = int(input())
A = list(map(int, input().split()))
cnt1 = 0
cnt2 = 0
master = 0
masterA = []

while cnt2 < N-1:
    if 0 < A[cnt2]:
        master = master + 1
    cnt2 = cnt2 + 1

masterA.append(master)
cnt2 = 0
master = 0

while cnt1 < N-1:
    while cnt2 < N-1:
        if A[cnt1] < A[cnt2]:
            master = master + 1
        cnt2 = cnt2 + 1
    masterA.append(master)
    master = 0
    cnt2 = 0
    cnt1 = cnt1 + 1

print(masterA)

for i in masterA:
    print(i)
import numpy as np
import math as mt
N=int(input())
#R=map(int, input().split())
A=list(map(int,input().split()))
count=1
for i in range(0,N-1):
    if i==N-2:
        print(count)
    elif A[i]!=A[i+1]:
        print(count)
    else:
        count=count+1
n = int(input())
a = list(map(int, input().split()))
count = []
for i in range(1, n+ 1):
    if len(count) >= 1:
        count.append(0)
    else:
        
        count.append(a.count(i))
        a = a[a.index(a != i)]


for i in range(n):
    print(count[i])
from itertools import groupby
m = int(input())
a = list(map(int, input().split(' ')))
f = [len(list(group)) for key, group in groupby(a)]
for i in range(0, m):
    if i < len(f):
        print(f[i])
    else:
        print(0)
N = int(input())
A = list(map(int,input().split()))

for i in range(1,N):
    print(A.count(i))
N = int(input())
A = list(map(int,input().split()))
for i in range(1,N+1):
    print(A.count(i+1))
import collections
N = int(input())
ls = list(map(int,input().split()))
count = collections.Counter(ls)
for i in count.values():
    print(i)
print(0)
n = int(input())
l = [int(i) for i in input().split()]
d = {i: 0 for i in range(n)}
for i in l:
  d[i] += 1
for i in d:
  print(d[i])
import collections
N = int(input())
A = list(map(int,input().split()))
c = collections.Counter(A)
for i in range(N+1):
    print(c[i])
N = int(input())
Alist = list(map(int,input().split()))#iの上司

result = [0]*N

for i in range(N-1):#最後の社員に部下いない
    result[Alist[i]-1] +=1#上司の順番の要素に+1

print(result)
for i in range(N):
    print(result[i])
N = int(input())
A = list(map(int,input().split()))
for i in range(1,N+1):
    count = 0
    B =[]
    for j in range(len(A)):
        if A[j]==i:
            count =+ 1
        else:
            B.append(A[j])
    print(count)
    A = B
from collections import Counter
N = int(input())
a  = list(input().split())
fact_count = dict(Counter(a))
print(fact_count)
for i in range(1, N+1):
    try:
        print(fact_count[str(i)])
    except:
        print(0)
N=int(input())
A = list(map(int, input().split()))

from collections import Counter
S=Counter(A)

a=[0]*N
for x, v in S.items():
  a[x] += v

for ans in a:
  print(ans)
N = int(input())
A = list(map(int,input().split()))
for i in range(N):
    print(A.count(i))
#C
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
m=max(a)
a = Counter(a)
print(a)

for i in range(1, n + 1):
    if i <= m:
        print(a[i])
    else:
        print(0)
N = int(input())
A = list(map(int, input().split()))
sub = []

for i in range(N):
    sub.append(A.count(i+1))

for j in range(len(sub)):
    print(sub[i])
N = int(input())
# print(N)
List = list(map(int, input().split()))
print(List)

for i in range(N-1):
  j = i + 1
  print(List.count(j))

print(0)
n=int(input())
a=[int(i) for i in input().split()]
b={}

for i in range(n-1):
    if a[i] in b:
        b[a[i]]+=1
    else:
        b[a[i]]=1
c=0
for i in b.values():
    c+=1
    print(i)
if n-c>0:
    for i in range(n-c):
        print(0)
N = int(input())
A1 = [0]
Ai = [int(a) for a in input().split()]
A = A1+Ai

for ai in A:
    print([(a==ai+1) for a in A].count(True))
N = int(input())
A = list(map(int,input().split()))
A.append(N)
A.sort()
for i in range(1,N):
    count = 0
    while A[0] == i:
        A.pop(0)
        count += 1
    print(count)
n = int(input())
a = list(map(int, input().split()))
b = [0 for i in range(n)]

for i in range(n-1):
  b[a[i]-1] += 1

for j in range(n-1):
  print(b[j])
import collections
N = int(input())
A = input().split()
clist = collections.Counter(A)
for i in range(1,N):
  print(clist['i'])
N=int(input())
A=list(map(int,input().split()))
last=A[N-2]
for i in range(1,last+1):
    print(A.count(i))
for i in range(last+1,N+1):
    print(0)
import collections
from collections import Counter
n=int(input())
d=collections.deque()
l=list(map(int,input().split()))
d.extend(l)
d.appendleft(0)
c=dict(Counter(d))
s=set(d)
for x in d:
    if x+1 in s:
        print(c[x+1])
        s.remove(x+1)
    else:print(0)
import collections

n = input()
n = int(n)
alist = input().split(" ")
intalist = [int(s) for s in alist]

setalist = list(set(intalist))
# print(setalist)
c = collections.Counter(intalist)
# print(c)
for i in range(0,n):
    try:
        print(c[setalist[i]])
    except IndexError:
        print(0)
n = int(input())
a = list(map(int, input().split()))
l = []
for i in range(0, n):
    l.append(0)
for j in a:
    l[j-1] += 1
print(l)
n = int(input())

data = input().split()
jousi = [int(s) for s in data]

buka = [0]*n

for i in jousi:
  buka[i] += 1

for i in buka:
  print(i)
n = int(input())
a = list(map(int,input().split()))

for i in range(n):
    print(a.count(i))
N = int(input())
A = list(map(int, input().split())) # <- note that this has (N - 1) elements
print(A)
A_0 = [x - 1 for x in A]
print(A_0)
ans = [0] * N # <- represents number of immediate subordinates of each person

for i in range(0, N - 1):
    ans[A_0[i]] += 1

for i in range(0, N):
    print(ans[i])
import collections 

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

c = collections.Counter(A)
c_s = sorted(c.items(), key=lambda x:x[0])

for i in range(N):
    if(i < len(c_s)):
        print(c_s[i][1])
    else:
        print(0)
N = int(input())
A = [0]
A += list(map(int, input().split(' ')))
last_time = -1
for a in A:
    if a != last_time:
        print(A.count(a + 1))
        last_time = a
    else:
        print(0)
import collections
n = int(input())
a = list(map(int, input().split()))
c = collections.Counter(a)
for ret in c.values():
    print(ret)
print(0)
import collections

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

dict = collections.Counter(A)

list = list(dict.values())

for i in range(len(dict)):
    print(list[i])

for i in range(N - len(dict)):
    print('0')
N = int(input())
A_list = list(map(int, input().split()))
ans = ["{}\n".format(A_list.count(i)) for i in range(1, N+1)]
print(ans)
import collections
N = int(input())
ls = list(map(int,input().split()))
count = collections.Counter(ls)
for i in range(1,N+1):
    if i in count.items():
        print(count[i])
    else:
        print(0)
n=int(input())
a=list(map(int,input().split()))
l=[0]*(n+1)

for i in a:
  l[i]+=1
print(l[1])
for i in a:
  print(l[i+1])
import collections
n=int(input())
a=list(map(int, input().split()))
c=collections.Counter(a)
for i in range(n):
    print(c[i])
n=int(input())
a=list(map(int,input().split()))
import collections
c = collections.Counter(a)
x=list(c.values())
#print(x)
for i in range(len(x)):
  print(x[i])
for i in range(n-len(x)):
  print(0)
N, K = [int(i.strip()) for i in input().split(' ')]
MOD = 10 **9 + 7
count = 0
for i in range(K,N+2):
    MIN = i * (i-1)/2
    MAX = N * i -MIN
    c = MAX -MIN + 1
    count += int(c)

print(count%MOD)
N,K=map(int, input().split())
ans=0
mod=10**9+7
for i in range(K,N+2):
    if i==K:
        MIN=sum(list(range(0,K)))%mod
        MAX=sum(list(range(N,N-K,-1)))%mod
    else:
        MIN+=(i-1)%mod
        MAX+=(N+1-i)%mod
    ans+=(MAX-MIN+1)%mod
    ans%=mod

print(ans)
N, K = [int(n) for n in input().split()]

a = N - K + 2 + (N + 1)*(N-K+2)*(K+N+1) // 2 - ((N + 1) * (N + 2) * (2 * N + 3) - K * (K - 1) * (2 * K - 1)) // 6

print(a % 1000000007)
N,K=map(int, input().split());print((N-K+2)*((N-K+1)*(N+2*K)+6)//6%(10**9+7))
n,k = [int(x) for x in input().split()]
a = [0] * (n + 1)
for i in range(1,n+1):
  a[i] = a[i-1] + i
#print(a)
res = 0
for i in range(k,n+1):
  ma = a[n] - a[n-i]
  mi = a[i-1]
  res += ma - mi + 1
  #print(i,res,ma,mi)
res += 1
res %= 10 ** 9 + 7
print(res)
n, k = map(int, input().split())
 
mod = 10 ** 9 + 7
ans = 0
 
for i in range(k, n+2):
  ans += int(n*(n+1)/2 - (n-i)*(n - i + 1)/2 - (i-1)*i/2 + 1)
 
print(ans%mod)
n, k = map(int,input().split())
mod = 10 ** 9 + 7

ans = 0
for i in range(k, n+2):
    min_i = (i-1) * i // 2
    max_i = i * (2*n - i + 1) // 2
    ans += max_i - min_i + 1
    ans %= mod

print(ans)
N, K = map(int, input().split())

def sumLR(l, r):
	return (l+r)*(r-l+1)//2

mod = 10**9 + 7
count = 0

for n in range(K, N+2):
	max = sumLR(N-n+1, N)
	min = sumLR(0, n-1)
	count += max - min + 1
	count %= mod
print(count)
import sys
sys.setrecursionlimit(10000000)


def main():
    N, K = map(int, input().split())

    num = 0
    min_sum = sum(range(0, K))
    max_sum = sum(range(N + 1 - K ,N + 1))

    for i in range(N + 2 - K):
        num += max_sum - min_sum + 1
        max_sum += N - K - i
        min_sum += K + i

    D = 10 ** 9 + 7
    print(num % D)



if __name__ == '__main__':
    main()
def conta_casos(n, k):
    s = 0
    for i in range(k, n+2):
        s += i*(n-i+1)+1
    print(s % (1000000000+7))

a, b = [int(x) for x in input().split()]
conta_casos(a, b)