Harryxun/stf_run huggingface dataset:
def popcount(x):
    '''xの立っているビット数をカウントする関数
    (xは64bit整数)'''

    # 2bitごとの組に分け、立っているビット数を2bitで表現する
    x = x - ((x >> 1) & 0x5555555555555555)

    # 4bit整数に 上位2bit + 下位2bit を計算した値を入れる
    x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)

    x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f # 8bitごと
    x = x + (x >> 8) # 16bitごと
    x = x + (x >> 16) # 32bitごと
    x = x + (x >> 32) # 64bitごと = 全部の合計
    return x & 0x0000007f


n=int(input())
x=int(input(),2)

A=[]
for i in range(n):
    num=x^(2**i)
    cnt=0
    while num!=0:
        num %=popcount(num)
        cnt +=1
    A.append(cnt)

for i in A[::-1]:
    print(i)

### FIXED CODE ###

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


def popcnt(n):
    return bin(n).count("1")


def mod(n, cnt):
    if n == 0:
        return cnt
    n = n % popcnt(n)
    cnt += 1
    return mod(n, cnt)


n = int(readline())
x2 = list(readline().decode().rstrip())
x10 = int(''.join(x2), 2)

c = x2.count('1')
mod1 = x10 % (c + 1)
mod2 = x10 % (c - 1) if c - 1 != 0 else 0

for i in range(n):
    if x2[i] == '0':
        t = (mod1 + pow(2, n - i - 1, c + 1)) % (c + 1)
    else:
        if c - 1 != 0:
            t = (mod2 - pow(2, n - i - 1, c - 1)) % (c - 1)
        else:
            print(0)
            continue
    print(mod(t, 1))
N = int(input())
A = list(map(int, input().split()))
count = 0
x = -1
for i in range(1:N+1):
  if i in A:
    x = A[x+1:].index(i)
    count += 1
  else:
    break
if count != 0:
  print(count)
else:
  print(-1)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
count = 0
x = -1
num = 1
for i in range(N):
  if A[i] == num:
    count += 1
    num += 1
if count != 0:
  print(N-count)
else:
  print(-1)
n, m = map(int, input().split())
a = [int(i) for i in input().split()]
for i in range(m):
  b = max(a)
  c = a.index(b)
  a[c] = b//2
  if sum(a) == 0:
    print(0)
    exit()
print(sum(a))
  


### FIXED CODE ###

N, K, Q = map(int, input().split())
A = [0]*N
for i in range(Q):
  a = int(input())
  A[a-1]+=1
for j in range(N):
  if A[j] > Q-K :
    print("Yes")
  else:
    print("No")
cases=[]
while True:
    n = input()
    if n==0:
        break
    cases.append(n)

length=len(cases)

for n in range(length):
    print("Case "+str(n+1)+": "+str(cases[n]))

### FIXED CODE ###

index=1

while True:
    case=input()
    if int(case)==0:
        break
    else:
        print("Case "+str(index)+": "+case)
        index+=1
s = input()
l = 0
r = len(s)-1
c = 0
while l < r:
  c_l = 0
  c_r = 0
  while s[l] == "x":
    c_l += 1
    l += 1
  while s[r] == "x":
    c_r += 1
    r -= 1
  if s[l] != s[r]:
    print(-1)
    exit()
  c += abs(c_l-c_r)
  l += 1
  r -= 1
print(c)

### FIXED CODE ###

s = input()
l = 0
r = len(s)-1
c = 0
if s.count("x") == len(s):
  print(0)
  exit()
while l < r:
  c_l = 0
  c_r = 0
  while s[l] == "x":
    c_l += 1
    l += 1
  while s[r] == "x":
    c_r += 1
    r -= 1
  if s[l] != s[r]:
    print(-1)
    exit()
  c += abs(c_l-c_r)
  l += 1
  r -= 1
print(c)
import sys,math
def sieves(m):
    global S
    S = range(1,m+1,2)
    r = int(m**.5)
    h = len(S)
    S[0] = 0
    for i in range(h):
        x = S[i]
        if x>r: break
        if x and i+x<h: S[i+x:h:x] = [0]*((h-1-i-x)/x+1)
    S[0] = 2
    return
m = 50100
S = []
sieves(m)
for s in sys.stdin:
    n = int(s)
    for p1 in range(n/2-1,0,-1):
        if S[p1]: break
    for p2 in range((n+1)/2,m/2+1):
        if S[p2]: break
    print S[p1],S[p2]

### FIXED CODE ###

import sys
def primes(m):
    N = range(1,m+1,2)
    r = int(m**.5)
    h = len(N)
    N[0] = 0
    i=0
    while N[i]<=r:
        x = N[i]
        if x and i+x<h: N[i+x:h:x] = [0]*((h-1-i-x)/x+1)
        i += 1
    x = [2] + filter(None,N)
    return x

PRIMES = primes(50030)
for s in sys.stdin:
    n = int(s)
    for a in PRIMES:
        if a>n: break
        elif a<n: b = a
    print b,a
import math


def P(n, r):
    return math.factorial(n)//math.factorial(n-r)

def C(n, r):
    return P(n, r)//math.factorial(r)

n = int(input())
str_list = []
for i in range(n):
    str_list.append(list(sorted(input())))
str_list=sorted(str_list)
str_list.append("a")

ans=0
cnt=0
for i in range(n):
    if str_list[i]==str_list[i+1]:
        cnt+=1
    else:
        if cnt==1:
            ans+=1
            cnt = 0
        else:
            ans+=C(cnt+1,2)
            cnt=0

print(ans)


### FIXED CODE ###

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

n = int(input())
s = [''.join(sorted(input())).strip() for _ in range(n)]
c = Counter(s)
ans=sum(map(lambda x: x*(x-1)//2, c.values()))
print(ans)
def main():
    N, M = map(int, input().split())
    G = [[] for _ in range(N)]
    for _ in range(M):
        a, b, c = map(int, input().split())
        G[a - 1].append((b - 1, c))
    INF = 10 ** 40
    S = [-INF] * N
    S[0] = 0

    cur = set([0])
    def helper(n, s, hist):
        for g, gc in G[n]:
            if S[g] > s + gc or S[g] >= INF:
                continue
            S[g] = s + gc
            if g in hist:
                S[g] = INF
            hist.add(g)
            helper(g, S[g], hist)
            if g in hist:
                hist.remove(g)
    helper(0, 0, set())
    s = S[-1]
    return s if s < INF else 'inf'

print(main())


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)
def main():
    N, M = map(int, input().split())
    G = [[] for _ in range(N)]
    for _ in range(M):
        a, b, c = map(int, input().split())
        G[a - 1].append((b - 1, c))
    INF = 10 ** 40
    S = [-INF] * N
    S[0] = 0

    def helper(n, s, hist):
        for g, gc in G[n]:
            if S[g] >= s + gc or S[g] >= INF:
                continue
            S[g] = s + gc
            if g in hist:
                S[g] = INF
            hist[g] = hist.get(g, 0) + 1
            helper(g, S[g], hist)
            hist[g] -= 1
            if hist[g] == 0:
                del hist[g]
    helper(0, 0, {0: 1})
    s = S[-1]
    return s if s < INF else 'inf'

print(main())
result = 'Yes'
 
N = int(input())
for i in range(N):
    t,x,y = map(int,input().split())
    if t < (x+y) or t % 2 != ((x+y) % 2):
        result = 'No'
 
print(result)

### FIXED CODE ###

a,b=map(int,input().split())
print(['Even','Odd'][a*b%2==1])
N = int(input())
Cap = [int(input()) for X in range(0,5)]
Str = math.ceil(N/Cap[0])
for T in range(0,len(Cap)-1):
    Str += math.ceil(Cap[T]/Cap[T+1])
print(Str)

### FIXED CODE ###

import math
N = int(input())
Cap = [int(input()) for X in range(0,5)]
print(int(math.ceil(N/min(Cap))+4))
N,Y=map(int,input().split())

res10000=-1
res5000=-1
res1000=-1

for a in range(0,N+1):
    for b in range(0,N-a+1):
        total=a*10000+b*5000+(N-a-b)*1000
        if total == Y:
            res10000=a
            res5000=b
            res1000=N-a-b
            
print(res10000,res5000,res1000))

### FIXED CODE ###

n,y=map(int, input().split())
for p in range(n+1):
    for q in range(n-p+1):
        if 10000*p+5000*q+1000*(n-p-q)==y:
                print(p,q,n-p-q)
                exit()
print("-1 -1 -1")
def main():
    n, k = map(int, input().split())
    a, b = [0 for i in range(n)], [0 for i in range(n)]
    for i in range(n):
        x, y = input().split()
        a[i], b[i] = x, int(y)
    ans = solve(n, k, a, b)
    print(ans)


def solve(n, k, a, b):
    s = ''
    for i in range(n):
        s += a[i] * b[i]
    return s[k - 1]


if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    n, k = map(int, input().split())
    a, b = [0 for i in range(n)], [0 for i in range(n)]
    for i in range(n):
        a[i], b[i] = [int(x) for x in input().split()]
    ans = solve(n, k, a, b)
    print(ans)


def solve(n, k, a, b):
    ab = [[a[i], b[i]] for i in range(n)]
    ab.sort(key = lambda x:x[0])
    back = 0
    for i in range(n):
        back += ab[i][1]
        if back >= k:
            return ab[i][0]
    return 


if __name__ == '__main__':
    main()
s = input()
t = input()
l = len(t)
for i in range(len(s) - l + 1):
    m = -1
    f = True
    for j in range(l):
        if s[i:i+l][j] == '?' or s[i:i+l][j] == t[j]:
            pass
        else:
            f = False
    if f:
        m = i
if m < 0:
    print('UNRESTORABLE')
else:
    print((s[0:m] + t + s[m+l:]).replace('?', 'a'))


### FIXED CODE ###

import sys
s = input()
t = input()
l = len(t)
if t in s:
    print(s.replace('?', 'a'))
    sys.exit()
m = -1
for i in range(len(s) - l + 1):
    f = True
    for j in range(l):
        if s[i:i+l][j] == '?' or s[i:i+l][j] == t[j]:
            pass
        else:
            f = False
    if f:
        m = i
if m < 0:
    print('UNRESTORABLE')
else:
    print((s[0:m] + t + s[m+l:]).replace('?', 'a'))
import math
n=int(input())
T=[]
for  i in range(n):
	T.append(int(input()))

ans=T[0]
for i in range(1,len(T)):
	ans=ans*T[i]//math.gcd(int(ans),T[i])


print(int(ans))

### FIXED CODE ###

import fractions as math
n=int(input())
T=[]
for  i in range(n):
	T.append(int(input()))

ans=T[0]
for i in range(1,len(T)):
	ans=ans*T[i]//math.gcd(int(ans),T[i])


print(int(ans))
n = int(input())
a = [int(i) for i in input().split()]
k = 0
for _ in range(n):
  if a[k] == k+1:
    k += 1
  else:
    del a[k]
  print(a, k)
if k == 0:
  print(-1)
else:
  print(n - k)

### FIXED CODE ###

n = int(input())
a = [int(i) for i in input().split()]
k = 0
flg = False
for ai in a:
  if ai == k + 1:
    k += 1
  else:
    flg = True
if k == 0 and flg:
  print(-1)
else:
  print(n - k)
chars = input.split(" ")
print(chars[1]+char[0])


### FIXED CODE ###

chars = input().split(" ")
print(chars[1]+chars[0])
A,B,C,D = map(int,imput().split())
x = C // B
y = A // D
if x >= y:
  print("Yes")
elif y > x:
  print("No")

### FIXED CODE ###

A,B,C,D = map(int,input().split())
x = C // B
if C % B == 0:
    x = x-1
y = A // D
if A % D == 0:
    y = y-1
if x > y:
  print("No")
else:
  print("Yes")
import sys
sys.setrecursionlimit(200000)
 
n, k = map(int, input().split())
 
h = [int(i) for i in input().split()]
 
d = {}
 
def dp(p):
  if p in d:
    return d[p]
  if p == n-1:
    return 0
  m = min([dp(p+i)+abs(h[p]-h[p+i]) for i in range(1, min(n-p, k+1))])
  d[p] = m
  return m

print(dp(0))

### FIXED CODE ###

n, k = map(int, input().split())
h = list(map(int, input().split()))

dp = [0] * n
dp[1] = abs(h[1]-h[0])
for i in range(2, n):
  a = [0] * min(i,k)
  for j in range(1, min(i,k)+1): 
    a[j-1] = dp[i-j]+abs(h[i]-h[i-j])
  dp[i] = min(a)

print(dp[-1])
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys
import re
import math
import collections
import itertools
import functools
import logging

logging.basicConfig(level=logging.DEBUG, format="DBG: %(message)s")

def dbg(msg, *args, **kwargs):
    logging.debug(msg, *args, **kwargs)

Mat = collections.namedtuple("Mat", "r c")

def mat_mul(ms):
    return Mat(ms[0].r, ms[-1].c)

def cost(m1, m2):
    return m1.r * m1.c * m2.c

def solve(n, ms):
    if n == 1: return 0

    dp = {}
    for i in range(n):
        dp[(i,i)] = 0

    for l in range(2, n+1):
        for i in range(n-l+1):
            cost_min = math.inf
            for j in range(l-1):
                dbg("l, i, j: %d %d %d", l, i, j)
                m_lhs = mat_mul(ms[i:i+j+1])
                m_rhs = mat_mul(ms[i+j+1:i+l])
                dbg("m_lhs, m_rhs: %r %r", m_lhs, m_rhs)
                cost_lhs = dp[(i,i+j)]
                cost_rhs = dp[(i+j+1,i+l-1)]
                dbg("cost_lhs, cost_rhs: %d %d", cost_lhs, cost_rhs)
                cost_mul = cost(m_lhs, m_rhs)
                dbg("cost_mul: %d", cost_mul)
                cost_now = cost_mul + cost_lhs + cost_rhs
                dbg("cost_now: %d", cost_now)
                if cost_min > cost_now:
                    cost_min = cost_now
            dp[(i,i+l-1)] = cost_min

    dbg(dp)
    return dp[(0,n-1)]

def main():
    n = int(input())

    ms = []
    for _ in range(n):
        r,c = map(int, input().split())
        ms.append(Mat(r,c))

    print(solve(n, ms))

if __name__ == "__main__": main()

### FIXED CODE ###

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys
import re
import math
import collections
import itertools
import functools

DEBUG = True
DEBUG = False

def dbg(*args):
    if DEBUG:
        print("DBG: ", file=sys.stderr, end="")
        print(*args, file=sys.stderr)

Mat = collections.namedtuple("Mat", "r c")

def mat_mul(ms):
    return Mat(ms[0].r, ms[-1].c)

def cost(m1, m2):
    return m1.r * m1.c * m2.c

def solve(n, ms):
    if n == 1: return 0

    dp = {}
    for i in range(n):
        dp[(i,i)] = 0

    for l in range(2, n+1):
        for i in range(n-l+1):
            #cost_min = math.inf
            cost_min = float("inf")
            for j in range(l-1):
                dbg("l, i, j: %d %d %d", l, i, j)
                m_lhs = mat_mul(ms[i:i+j+1])
                m_rhs = mat_mul(ms[i+j+1:i+l])
                dbg("m_lhs, m_rhs: %r %r", m_lhs, m_rhs)
                cost_lhs = dp[(i,i+j)]
                cost_rhs = dp[(i+j+1,i+l-1)]
                dbg("cost_lhs, cost_rhs: %d %d", cost_lhs, cost_rhs)
                cost_mul = cost(m_lhs, m_rhs)
                dbg("cost_mul: %d", cost_mul)
                cost_now = cost_mul + cost_lhs + cost_rhs
                dbg("cost_now: %d", cost_now)
                if cost_min > cost_now:
                    cost_min = cost_now
            dp[(i,i+l-1)] = cost_min

    dbg(dp)
    return dp[(0,n-1)]

def main():
    n = int(input())

    ms = []
    for _ in range(n):
        r,c = map(int, input().split())
        ms.append(Mat(r,c))

    print(solve(n, ms))

if __name__ == "__main__": main()
s = input()
n = len(s)
nn = -(-n/2)
ans = 0
for i in range(nn):
    if not s[i] == s[n-i-1]:
        ans += 1
print(ans)

### FIXED CODE ###


s = input()
n = len(s)
nn = -(-n//2)
ans = 0
for i in range(nn):
    if not s[i] == s[n-i-1]:
        ans += 1
print(ans)
def merge_sort(arr):
    if len(arr) <= 1:
        return arr

    mid = len(arr) // 2
    # ここで分割を行う
    left = arr[:mid]
    right = arr[mid:]

    # 再帰的に分割を行う
    left = merge_sort(left)
    right = merge_sort(right)

    # returnが返ってきたら、結合を行い、結合したものを次に渡す
    return merge(left, right)


def merge(left, right):
    merged = []
    l_i, r_i = 0, 0

    # ソート済み配列をマージするため、それぞれ左から見ていくだけで良い
    while l_i < len(left) and r_i < len(right):
        # ここで=をつけることで安定性を保っている
        if left[l_i] <= right[r_i]:
            merged.append(left[l_i])
            l_i += 1
        else:
            merged.append(right[r_i])
            r_i += 1

    # 上のwhile文のどちらかがFalseになった場合終了するため、あまりをextendする
    if l_i < len(left):
        merged.extend(left[l_i:])
    if r_i < len(right):
        merged.extend(right[r_i:])
    return merged

n=input()
S=[]
for i in input().split():
    S.append(int(i))
S=merge_sort(S)
word=int(int(n)/2)
s=int(S[word])-int(S[word-1])
s2=int(S[word+1])-int(S[word])
print(s)


### FIXED CODE ###

import numpy as np
n=input()
S=[]
for i in input().split():
    S.append(int(i))
S=np.array(S)
word=int(int(n)/2)
asa=S.argsort()
s=int(S[asa[word]])-int(S[asa[word-1]])
print(s)
def solve():
    N = int(input())
    S = input()
    cnt = {}
    for c in S:
        cnt[c] = cnt.get(c, 0) + 1
    total_triplets = cnt['R'] * cnt['G'] * cnt['B']
    for stride in range(1, N):
        for i in range(0, N-2*stride):
            j = i + stride
            k = j + stride
            if S[i] != S[j] and S[j] != S[k] and S[k] != S[i]:
                total_triplets -= 1
    print(total_triplets)

if __name__ == "__main__":
    solve()

### FIXED CODE ###

def solve():
    N = int(input())
    S = input()
    cnt = {}
    for c in S:
        cnt[c] = cnt.get(c, 0) + 1
    total_triplets = cnt.get('R', 0) * cnt.get('G', 0) * cnt.get('B', 0)
    for stride in range(1, N):
        for i in range(0, N-2*stride):
            j = i + stride
            k = j + stride
            if S[i] != S[j] and S[j] != S[k] and S[k] != S[i]:
                total_triplets -= 1
    print(total_triplets)

if __name__ == "__main__":
    solve()
N = int(input())
A = list(map(lambda x: int(x),input().split()))

judge=False
#print(A)

for i in range(1,N):
    left = A[0]
    right = A[i]
    tmp_1=A[:]
    #print(tmp_1)
    tmp_1.remove(right)
    tmp_1.remove(left)
    tmp_2=[]
    isAble=True
    while isAble:
        #print(tmp_1)
        #print(tmp_2)
        x = right ^ left
        #print(x)
        if x in tmp_1:
            #print(x)
            left = right
            right = x
            tmp_1.remove(x)
            tmp_2.append(x)
        else:
            isAble=False

    if len(tmp_1)==0:
        judge=True
        break
    else:
        continue


ans = 'Yes' if judge else 'No'
print(ans)


### FIXED CODE ###

N,A,B,C,D = list(map(lambda x: int(x),input().split()))
S = " "+input()
def isAble():
    if "##" in S[A:C+1] or "##" in S[B:D+1]:
        return "No"
    if C>D:
        if "..." not in S[B-1:D+2]:
            return "No"
    return "Yes"

print(isAble())
n = int(raw_input())
p = [0 for i in range(0, 101)]
m = [[0 for i in range(0, 101)] for j in range(0, 101)]
for i in range(1,n+1):
 m[i][i] = 0
 p[i-1], p[i] = map(int, raw_input().split())

for m in range(2,n+1):
 for i in range(1,n-m+1+1):
  j = i + m - 1
  m[i][j] = 999999999999999
  for k in range(i,j-1+1):
   m[i][j] = min(m[i][j], m[i][k] + m[k+1][j] + p[i-1] * p[k] * p[j])

print m[1][n]

### FIXED CODE ###

n = int(raw_input())
p = [0 for i in range(0, 101)]
m = [[0 for i in range(0, 101)] for j in range(0, 101)]
for i in range(1, n+1):
    p[i-1], p[i] = map(int, raw_input().split())
     
for l in range(2, n+1):
    for i in range(1, n-l+2):
        j = i+l-1
        m[i][j] = float("inf")
        for k in range(i, j):
            m[i][j] = min(m[i][j], m[i][k] + m[k+1][j] + p[i-1]*p[k]*p[j])
 
print m[1][n]
aaa = [int(input()) for i in range(5)]

i = list()
b = 0
for a in aaa:
  n = 0
  n = 10 - int(str(a)[-1])
  if n % 10 != 0:i.append(n)
print(i)
print(sum(aaa) + sum(i) - max(i))

### FIXED CODE ###

aaa = [int(input()) for i in range(5)]

i = list()
b = 0
for a in aaa:
  n = 0
  n = 10 - int(str(a)[-1])
  if n % 10 != 0:i.append(n)
    
if len(i) == 0:
  h = 0
else:
  h = max(i)
print(sum(aaa) + sum(i) - h)
s = input()
lis = list(s)
count = 0
if s.count(lis[0]) == 2:
   count+=1
else:
    if s.count(lis[1]) == 2:
        count+=1
    else:
        if s.count(lis[2]) == 2:
            count+=1
        else if count == 3:
            print("YES")
        else:
            print("NO")



### FIXED CODE ###

s = input()
lst = list(s)
for c in s:
    k = s.count(c)
    if k != 2:
        print('No')
        exit()
print('Yes')
#ABC042B
N,L=map(int,input().split())

a=[]
for i in range(N)
    a.append(input())
    
a.sort()

print(''.join(a))

### FIXED CODE ###

a,b,c=(int(x) for x in input().split())
mylist=[a,b,c]
if mylist.count(5) == 2:
    if mylist.count(7) == 1:
        print('YES')
    else:
        print('NO')
else:
    print('NO')
s=int(input())
t=int(input())
list=[]
list.append(1)
list.append(2)
list.append(3)
del list[s-1]
del list[t-1]
print(*list)

### FIXED CODE ###

s=int(input())
t=int(input())
list=[]
list.append(1)
list.append(2)
list.append(3)
list.remove(s)
list.remove(t)
print(*list)
s = str(input())
k = int(input())
 
n = len(s)
l = [0] * n

for i in range(n-1):
    if s[i] == s[i+1] and l[i] == 0:
        l[i+1] = 1

if s.count(s[0]) == n:
    print(s*k//2)
elif s[0] != s[-1]:
    print(sum(l) * k)
else:
    a = 0
    b = 0
    ac = True
    bc = True
    for i in range(n):
        if s[i] == s[0] and ac == True:
            a += 1
        elif s[i] != s[0]:
            ac = False
        if s[n-i-1] == s[0] and bc == True:
            b += 1
        else: bc = False  
    sub = a//2 + b//2 - (a+b)//2
    print(sum(l)*k - sub*(k-1))
    

### FIXED CODE ###

s = str(input())
k = int(input())
 
n = len(s)
l = [0] * n

for i in range(n-1):
    if s[i] == s[i+1] and l[i] == 0:
        l[i+1] = 1

if s.count(s[0]) == n:
    print(n*k//2)
elif s[0] != s[-1]:
    print(sum(l) * k)
else:
    a = 0
    b = 0
    ac = True
    bc = True
    for i in range(n-1):
        if s[i] == s[0] and ac == True:
            a += 1
        elif s[i] != s[0]:
            ac = False
        if s[n-1-i] == s[n-1] and bc == True:
            b += 1
        else: bc = False  
    sub = a//2 + b//2 - (a+b)//2
    print(sum(l)*k - sub*(k-1))
N=int(input())
A=list(map(int,input().split()))

dict={}
dict[max(A)+1]=0
dict[1]=0
for a in A:
    if a in dict.keys():
        dict[a]+=1
    else:
        dict[a]=1
        if a+1 not in dict.keys():
            dict[a+1]=0

print(dict[1])
for a in A:
    print(dict[a+1])
    dict[a+1]=0


### FIXED CODE ###

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

dict={}

for a in A:
    if a in dict.keys():
        dict[a]+=1
    else:
        dict[a]=1
dict[N]=0

for i in range(1,N+1):
    if i in dict.keys():
        print(dict[i])
    else:
        print(0)
def solve(n, m, a, b):
    res = []
    for i in range(n):
        s = [a[i][j] * b[j] for j in range(m)]
        res.append(sum(s))
    return res

if __name__ == '__main__':
    n, m = [int(i) for i in input().split()]
    a = [[int(i) for i in input().split()] for _ in range(n)]
    b = [int(i) for i in input().split()] for _ in range(m)]
    for x in solve(n, m, a, b):
        print(x)

### FIXED CODE ###

n, m = [int(i) for i in input().split()]

matrix = []
for ni in range(n):
    matrix.append([int(a) for a in input().split()])

vector = []
for mi in range(m):
    vector.append(int(input()))

for ni in range(n):
    sum = 0
    for mi in range(m):
        sum += matrix[ni][mi] * vector[mi]

    print(sum)
n=input()
sei=n/2
tmp=n%2
if tmp==0:
    
else:
    sei=sei+1
print(sei)

### FIXED CODE ###

n=int(input())
sei=int(n/2)
tmp=n%2
if tmp==0:
    sei=sei
else:
    sei=sei+1
print(sei)
n=int(input())
aaa=[input().split() for i in range(n)]
s=map(int,aaa)
s.reverse()
sum=0
for i in range(n):
    if i%2==0:
        sum+=s[i]
    else:
        sum-=s[i]
print(int(sum))
        


### FIXED CODE ###

n=int(input())
s=list(map(int,input().split()))
s=sorted(s)
s.reverse()
sum=0
for i in range(n):
    if i%2==0:
        sum+=s[i]
    else:
        sum-=s[i]
print(int(sum))
S = input().split("/")
N = S[0] + S[1] + S[2]
if int(N) <= 20190430: print("Heisei")
else: print("TBD")     

### FIXED CODE ###

T, X = map(int, input().split())
print(T / X)
from functools import reduce

def gcd(x, y):
    y, x = sorted([x, y])
    while True:
        r = x % y
        if r == 0:
            print(x, y, r)
            return r
        else:
            print(x, y, r)
            x, y = y, r

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

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

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

p = lcm_list(l)
c = 0
z = 10 ** 9 + 7
for i in l:
  c += p // i
print(c % z)

### FIXED CODE ###

import fractions
from functools import reduce
 
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

N = int(input())
l = list(map(int, input().split(" ")))
 
p = lcm_list(l)
c = 0
for i in l:
  c += p // i
print(c % (10 ** 9 + 7))
N = int(input())
a = [int(s) for s in input().split()]
b = int(0)

for i in range(N):
  if a[i] <= a[int(i+1)]:
    pass
  else:
    b = b + (a[i] - a[int(i+1)])
    a[int(i+1)] = a[i]

print(b)

### FIXED CODE ###

N = int(input())
a = [int(s) for s in input().split()]
b = int(0)

for i in range(N-1):
  if a[i] <= a[int(i+1)]:
    pass
  else:
    b = b + (a[i] - a[int(i+1)])
    a[int(i+1)] = a[i]

print(b)