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

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

for i in range(m):
    
    l,r = map(int,input().split())

    lst = [x for x in range(l,r+1)]
    if i == 0:
        sekishugo=set(lst)

    else:
       sekishugo = sekishugo.intersection(set(lst))

print(len(sekishugo))


### FIXED CODE ###

n,m = map(int,input().split())
ans_l = None
ans_r = None
for i in range(m):
    
    l,r = map(int,input().split())

    
    if i == 0:
        ans_l = l
        ans_r = r

    else:
        ans_r = min(r,ans_r)
        ans_l = max(l,ans_l)
        
    if ans_r - ans_l < 0:
        print(0)
        exit()


print(ans_r-ans_l+1)
### BUGGY CODE ###

def solve():
    a = input()
    a = list(a)
    q = int(input())
    
    for _ in range(q):
        _q = [i for i in input().split()]
        t, f, c =0, 0, 0
        t = int(_q[0])
        if t == 2:
            f, c = int(_q[1]), _q[2]
        
        if t == 1:
            a = list(reversed(a))
        elif t == 2:
            if f == 1:
                a.insert(0, c)
            elif f == 2:
                a.append(c)
    
    print("".join(a))


if __name__ == "__main__":
    solve()

### FIXED CODE ###

def solve():
    a = input()
    q = int(input())
    
    top = []
    tail = []
    rev = 0
    for _ in range(q):
        _q = [i for i in input().split()]
        t, f, c =0, 0, 0
        t = int(_q[0])
        if t == 2:
            f, c = int(_q[1]), _q[2]
        
        if t == 1:
            rev = 1 - rev
        elif t == 2:
            if (f + rev) % 2 == 1:
                top.append(c)
            else:
                tail.append(c)
                
    if rev == 1:
        a = a[::-1]
        _top = tail
        tail = top
        top = _top
    
    print("".join(list(reversed(top))), end="")
    print(a, end="")
    print("".join(tail))


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

import numpy as np
a,b=list(map(int,input().split()))

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def cf(x1,x2):
    cf=[]
    for i in range(1,gcd(x1,x2)+1):
        if x1 % i == 0 and x2 % i == 0:
            cf.append(i)
    return cf

def di(z):
  for i in range(2,int(np.sqrt(z))+1):
    if z % i == 0:
      return False
  return True

tmp=cf(a,b)
sum=0
for j in range(len(tmp)):
  if di(tmp[j]):
    sum += 1

print(sum)

### FIXED CODE ###

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

def cf(x1,x2):
    cf=[]
    n =max(x1,x2)
    m=min(x1,x2)
    for i in range(1,int(m**0.5)+1):
        if m % i == 0:
          if n % i == 0:
            cf.append(i)
          if i != m//i and n % (m//i) == 0:
            cf.append(m//i)
    return cf

def is_prime(z):
  for i in range(2,int(z**0.5)+1):
    if i*i > z:
      break
    if z % i == 0:
      return False
  return True

tmp=cf(a,b)
sum=0
y=[]
for k in tmp:
  if is_prime(k):
    sum += 1

print(sum)
### BUGGY CODE ###

n,m=list(map(int, input("").split()))
h=list(map(int, input("").split()))
a=[]
b=[]
for i in range(m):
    ai,bi=list(map(int, input("").split()))
    a.append(ai)
    b.append(bi)
ma=0
out=0
for i in range(n):
    ma=h[i]
    q=h[i]
    for j in range(m):
        if i==a[j]-1 or i==b[j]-1:
            if i==a[j]-1:
                if h[b[j]-1] >= ma:
                    ma=10**9+1
                    break
            else:
                if h[a[j]-1] >= ma:
                    ma=10**9+1
                    break
    if ma==q:  
        out+=1
print(out)

### FIXED CODE ###

n,m=list(map(int, input("").split()))
h=list(map(int, input("").split()))
o=[]
for i in range(n):
    o.append(1)
for i in range(m):
    a,b=list(map(int, input("").split()))
    if h[a-1] <=h[b-1]:
        o[a-1]=0
    if h[a-1] >=h[b-1]:
        o[b-1]=0
print(sum(o))
### BUGGY CODE ###

n = int(input())
a = [int(i) for i in input().split()]
ball = []

for i in reversed(range(1,n+1)):
    if a[i-1] == 1: 
        ball.append(i)
        for j in range(1,int(i**0.5//1)+1):
            if i%j == 0:
                a[j-1] = 0 if a[j-1] == 1 else 1
                if i/j != j: 
                    a[i//j-1] = 0 if a[i//j-1] == 1 else 1

m = len(ball)
print(m)
if m != 0:
    for b in ball:
        print(b,end=" ")
    else:
        print("")

### FIXED CODE ###

n = int(input())
a = [int(i) for i in input().split()]
ball = [0]*n
ans = []

for i in range(n,0,-1):
    cnt = 0
    x = i
    while x <= n:
        if ball[x-1] == 1:
            cnt += 1
        x += i
    if cnt%2 != a[i-1]:
        ball[i-1] = 1
        ans.append(i)

m = len(ans)
print(m)
if m != 0:
    for b in ans:
        print(b,end=" ")
    else:
        print("")
### BUGGY CODE ###

N = int(input())
H = list(map(int,input().split()))
count = [0] * len(H)
j = 0
k = 0
for i in range(len(H)-1):
    j = i
    while H[i]>=H[i+1]:
        #print(H[i])
        i += 1 
        k += 1
        if i >=len(H)-1:
            break
    count[j] = k
    k = 0
print(max(count))

### FIXED CODE ###

N = int(input())
H = list(map(int,input().split()))
count = [0] * len(H)
i = 0
k = 0
while i < len(H)-1:
    while H[i]>=H[i+1]:
        i += 1 
        k += 1
        if i >=len(H)-1:
            break
    count[i] = k
    i += 1
    k = 0
print(max(count))
### BUGGY CODE ###

def resolve():
    N, K, Q = list(map(int, input().split()))
    A = [int(input()) for _ in range(Q)]
    for i in range(N):
        if K + A.count(i+1) - Q > 0:
            print('Yes')
        else:
            print('No')

    return


resolve()

### FIXED CODE ###

def resolve():
    N, K, Q = list(map(int, input().split()))
    A = [int(input()) for _ in range(Q)]
    points = [0] * N
    for i in range(Q):
        points[A[i]-1] += 1

    for i in range(N):
        if K + points[i] - Q > 0:
            print('Yes')
        else:
            print('No')

    return

resolve()
### BUGGY CODE ###

def maxHeapify(heap, i):
    while (i + 1) * 2 <= len(heap):
        left = (i + 1) * 2 - 1
        right = (i + 1) * 2
        largest = left if heap[left] > heap[i] and left <= len(heap) else i
        largest = right if heap[right] > heap[largest] and right <= len(heap) else largest
        if largest != i:
            heap[i], heap[largest] = heap[largest], heap[i]
            maxHeapify(heap, largest)

def buildMaxHeap(heap):
    for i in range(len(heap) // 2, -1, -1):
        maxHeapify(heap, i)

n = int(input())
heap = list(map(int, input().split()))
buildMaxHeap(heap)
print('', *heap)

### FIXED CODE ###

def maxHeapify(heap, i):
    left = (i + 1) * 2 - 1
    right = (i + 1) * 2
    largest = left if left < len(heap) and heap[left] > heap[i] else i
    largest = right if right < len(heap) and heap[right] > heap[largest] else largest
    if largest != i:
        heap[i], heap[largest] = heap[largest], heap[i]
        maxHeapify(heap, largest)

def buildMaxHeap(heap):
    for i in range(len(heap) // 2, -1, -1):
        maxHeapify(heap, i)

n = int(input())
heap = list(map(int, input().split()))
buildMaxHeap(heap)

out = ''
for key in heap:
    out += (' {}'.format(str(key)))
print(out)
### BUGGY CODE ###

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


class Node(object):
    def __init__(self, key, prev=None, nex=None):
        self.key = key
        self.prev = prev
        self.next = nex


class DoublyLinkedLiset(object):
    def __init__(self):
        self.nil = Node(None)
        self.nil.next = self.nil
        self.nil.prev = self.nil

    def insert(self, x):
        X = Node(x)
        X.next = self.nil.next
        self.nil.next.prev = X
        self.nil.next = X
        X.prev = self.nil

    def listSearch(self, x):
        cur = self.nil.next
        while (cur != self.nil and cur.key != x):
            cur = cur.next

        return cur

    def deleteNode(self, X):
        if X == self.nil:
            return
        X.prev.next = X.next
        X.next.prev = X.prev
        del X

    def deleteFirst(self):
        self.deleteNode(self.nil.next)

    def deleteLast(self):
        self.deleteNode(self.nil.prev)

    def deleteKey(self, x):
        self.deleteNode(self.listSearch(x))

    def printList(self):
        cur = self.nil.next
        ret = []

        while cur.key is not None:
            ret.append(cur.key)
            cur = cur.next

        print(' '.join(ret))


if __name__ == '__main__':

    n = int(input())
    dll = DoublyLinkedLiset()

    for _ in range(n):
        command = input().split(" ")
        if command[0] == "insert":
            dll.insert(command[1])
        elif command[0] == "delete":
            dll.deleteKey(command[1])
        elif command[0] == "deleteFirst":
            dll.deleteFirst()
        elif command[0] == "deleteLast":
            dll.deleteLast()

    dll.printList()



### FIXED CODE ###

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

from collections import deque

if __name__ == '__main__':
    n = int(input())
    L = deque()

    for _ in range(n):
        command = input().split(" ")
        if command[0] == "insert":
            L.appendleft(command[1])
        elif command[0] == "delete":
            try:
                L.remove(command[1])
            except:
                pass
        elif command[0] == "deleteFirst":
            L.popleft()
        elif command[0] == "deleteLast":
            L.pop()

    print(" ".join(L))
### BUGGY CODE ###

# -*- coding: utf-8 -*-
import sys
S=sys.stdin.readline().strip()
N=len(S)
mod=10**9+7

dp=[ [ 0 for j in range(13) ] for i in range(N) ]

for i,x in enumerate(S[::-1]):  #i桁目
    if i==0:
        if x!="?":
            x=int(x)
            dp[i][(x*10**i)%13]=1
        else:
            for x in range(10):
                dp[i][(x*10**i)%13]=1
    else:
        if x!="?":
            x=int(x)
            for j in range(13):
                dp[i][(x*pow(10,i,13)+j)%13]+=dp[i-1][j]
        else:
            for j in range(13):
                for x in range(10):
                    dp[i][(x*pow(10,i,13)+j)%13]+=dp[i-1][j]
print dp[N-1][5]%mod


### FIXED CODE ###

S=raw_input()
S=S[::-1]
l=len(S)

dp=[ 0 for j in range(13) ]
dp[0]=1

mod=10**9+7

dp2=[ 0 for _ in range(13) ]

keta=1

for i in range(1,l+1):
	dp2=[0]*13
	for j in range(13):
		if dp[j]!=0:
			if S[i-1]=="?":
				for k in range(10):
					next=(k*keta+j)%13 
					dp2[next]+=dp[j]
					dp2[next]%=mod
			else:
				k=int(S[i-1])
				next=(k*keta+j)%13
				dp2[next]+=dp[j]
				dp2[next]%=mod

	dp=dp2
	keta=(keta*10)%13

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

from collections import deque

n,m = map(int, input().split())
g = [[] for _ in range(n+1)]
reached = list(range(1,n+1))
misi = [0 for _ in range(n+1)]

q = []

def bfs(x):
	q.append(x)
	while(len(q) != 0):
		now = q.pop(0)
#		print(now)
		for k in g[now]:
			if(misi[k] == 0):
#				print(now,"->",k)
				misi[k] = now
				reached.remove(k)
				q.append(k)

for i in range(m):
	a,b = map(int, input().split())
	g[a].append(b)
	g[b].append(a)

misi[1] = 1
reached.remove(1)
bfs(1)

#print("---")
#print(reached)
if(len(reached)==0):
	print("Yes")
	for i in range(2,n+1):
		#print(i,":misi",misi[i])
		print(misi[i])
else:
	print("no")

### FIXED CODE ###

from collections import deque

n,m = map(int, input().split())
g = [[] for _ in range(n+1)]
reached = list(range(1,n+1))
misi = [0] * (n+1)

#q = []

def bfs(x):
	q = deque()
	q.append(x)
	while(len(q) != 0):
		now = q.popleft()
#		print(now)
		for k in g[now]:
			if(misi[k] == 0):
#				print(now,"->",k)
				misi[k] = now
				#reached.remove(k)
				q.append(k)

for i in range(m):
	a,b = map(int, input().split())
	g[a].append(b)
	g[b].append(a)

misi[1] = 1
reached.remove(1)
bfs(1)

#print("---")
#print(reached)
if(True):
	print("Yes")
	for i in range(2,n+1):
		#print(i,":misi",misi[i])
		print(misi[i])
else:
	print("no")
### BUGGY CODE ###

k=int(input())

def gcd(l,m,n):
  f=min(l,m,n)
  while l%f!=0 or m%f!=0 or n%f!=0:
    f=f-1
  return f

sum=0
for l in range(1,k+1):
  for m in range(l,k+1):
    for n in range(m,k+1):
      if l==m==n:
        sum=sum+gcd(l,m,n)
      elif l==m or m==n:
        sum=sum+gcd(l,m,n)*3
      else:
        sum=sum+gcd(l,m,n)*6

print(sum)

### FIXED CODE ###

k=int(input())
 
def gcd(l,m,n):
  f=min(l,m,n)
  while l%f!=0 or m%f!=0 or n%f!=0:
    f=f-1
  return f
 
sum=0
for l in range(1,k+1):
  for m in range(l,k+1):
    for n in range(m,k+1):
      if l==m==n:
        sum=sum+gcd(l,m,n)
      elif l==m or m==n:
        sum=sum+gcd(l,m,n)*3
      else:
        sum=sum+gcd(l,m,n)*6
 
print(sum)
### BUGGY CODE ###

a, b, x = map(int,input().split())

count = 0
for i in range(a, b+1):
#    print(i)
    if i%x == 0:
        count += 1


 #  print('--------')
print(count)



### FIXED CODE ###

a, b, x = map(int,input().split())



## ことごとくTLEする件
# forを回すからだめなのかも→回さないですませるには？
# bまでに約数いくつあるか出す → a-1 までに約数いくつあるか出す→引き算



## まず、aが割り切れるかどうか判定
## aが割り切れるなら、最小値はa
## 割り切れないなら、a+（除数 - あまり ) が最小値

#### divmodを使ってみよう！！


result = 0

a_x = divmod(a,x)  ## a/x の商と余り
## a = x * a_x[0] + a_x[1]
if a_x[1]==0:  ## 割り切れるとき
    first = a
else:  ## 割り切れないとき
    first = x * (a_x[0]+1)
    first2 = a + (x - a_x[1])  ## 検算用


b_x = divmod(b-first, x)

result = b_x[0]+1

print(result)






"""
名答だと思ったがだめだった

count = 0
first = 0
for i in range(a, b+1):
#    print(i)
    if i%x == 0:
        first = i
        count = 1
        break
    
if count != 0:
    result  = (b-first) // x +1

else :
    result = 0


print(result)



"""
### BUGGY CODE ###

import queue
n,q = map(int,input().split())
l = [0 for i in range(n)]
l2 = [queue.Queue() for i in range(n)]
l3 = [0 for i in range(n)]
l3[0] = 1
for i in range(n-1):
    a,b = map(int,input().split())
    l2[b-1].put(a-1)
    l2[a-1].put(b-1)
for i in range(q):
    c,d = map(int,input().split())
    l[c-1] += d
ans = [0 for i in range(n)]
ans[0] = l[0]
q1 = queue.Queue()
q1.put(0)
while not q1.empty():
    k = q1.get()
    q2 = l2[k]
    while not q2.empty():
        k1 = q2.get()
        if l3[k1] == 0:
            ans[k1] = ans[k] + l[k1]
            q1.put(k1)
            l3[k1] = 1
for x in ans:
    print(x,end=" ")

### FIXED CODE ###

from collections import deque
n,q = map(int,input().split())
l = [0 for i in range(n)]
l2 = [[] for i in range(n)]
l3 = [0 for i in range(n)]
l3[0] = 1
for i in range(n-1):
    a,b = map(int,input().split())
    l2[b-1].append(a-1)
    l2[a-1].append(b-1)
for i in range(q):
    c,d = map(int,input().split())
    l[c-1] += d
ans = [0 for i in range(n)]
ans[0] = l[0]
q1 = deque()
q1.append((0,-1))
while len(q1) > 0:
    k,g = q1.popleft()
    for j in l2[k]:
        if j == g:
            continue
        ans[j] = ans[k] + l[j]
        q1.append((j,k))
for x in ans:
    print(x,end=" ")
### BUGGY CODE ###

n = int(input())
import itertools
li = []
for i in range (n):
    li.append(sorted(list(input())))
li.sort()

def comb(x,y):
    d = itertools.combinations(x,y)
    return len(list(d))

cnt = 0
a = []
for i in range(n-1):
    if li[i] == li[i+1]:
        a.append(i+1)
        if i == n-2:
            a.append("1")
            cnt += comb(a,2)
        
    else: 
        a.append("1")
        cnt += comb(a,2)
        a = []
print(cnt)

### FIXED CODE ###

n = int(input())
from collections import Counter
li = []
for i in range (n):
    li.append(sorted(input()))
li.sort()
for i in range(n):
    li[i]="".join(li[i])

d = Counter(li)
L = list(d.values())

cnt = 0
for i in range(len(L)):
    cnt += L[i]*(L[i]-1)//2
print(cnt)
### BUGGY CODE ###

import itertools
from sys import stdin
N=list(map(int,stdin.readline().strip().split()))[0]
st=list(stdin.readline().strip())
count=0
stt=list(set(st))
num=list(stt)
# num=["0","1","2","3","4","5","6","7","8","9"]
# num = [s for s in num if s in stt ]
num_list= ["".join(i) for i in itertools.product(num,repeat=3)]

for number in num_list:
    cnt = 0
    for i in range(N):
        if number[cnt]==st[i]:
            cnt+=1
            if cnt==3:
                count += 1
                break


print(count)

### FIXED CODE ###

def main():
  N = int(input())
  S = list(map(int,input()))
  ans = 0
  for i in range(10):
    for j in range(10):
      for k in range(10):
        flg = False
        flg2 = False
        for x in range(N):
          if flg2:
            break
          if not flg:
            if S[x] == i:
              flg = True
          else:
            if S[x] == j:
              flg2 = True
              if k in S[x+1:]:
                ans +=1
  print(ans)
main()
### BUGGY CODE ###

n=int(input())
lisa=[]
ans=1
add=[]
for i in range(n):
    a=input()
    lisa.append(a)
    if ans<lisa.count(a):
        add=[]
    if ans<=lisa.count(a):
        ans=lisa.count(a)
        add.append(a)
add=sorted(list(set(add)))
for i in range(len(add)):
    print(add[i])

### FIXED CODE ###

n=int(input())
S=[]
ans=0
import collections
for i in range(n):
    s=input()
    S.append(s)
S=sorted(S)
c=collections.Counter(S)
ANS=[]
for i in range(n-1):
    if (S[i]!=S[i+1] and ans<c[S[i]]) or i==n-2:
        ans=c[S[i]]#Sの？番目がSにいくつあるのか
        ANS.append(ans)
inko=""
ans=max(ANS)
for i in range(n):
    if c[S[i]]==ans and S[i]!=inko:
        print(S[i])
        inko=S[i]
### BUGGY CODE ###

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, Q = MAP()

event = [None]*(2*N+Q)
Xl = [0]*N
for i in range(N):
    S, T, X = MAP()
    event[2*i] = (S-X, 1, X)
    event[2*i+1] = (T-X, 0, X)
    Xl[i] = X

t = 2*N
for i in range(Q):
    D = INT()
    event[t+i] = (D, 2, 0)


event.sort()
p = []
q = []
for t, c, x in event:
    if c == 0:
        heappush(q, x)
    elif c == 1:
        heappush(p, x)
    else:
        while q and p[0] == q[0]:
            heappop(p)
            heappop(q)
        print(-1 if not p else p[0])


### FIXED CODE ###

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, Q = MAP()

event = [None]*(2*N+Q)
Xl = [0]*N
for i in range(N):
    S, T, X = MAP()
    event[2*i] = (S-X, 1, X)
    event[2*i+1] = (T-X, 0, X)
    Xl[i] = X

t = 2*N
for i in range(Q):
    D = INT()
    event[t+i] = (D, 2, 0)


event.sort()
p = []
q = []
for t, c, x in event:
    if c == 0:
        heappush(q, x)
    elif c == 1:
        heappush(p, x)
    else:
        while q and p[0] == q[0]:
            heappop(p)
            heappop(q)
        print(-1 if not p else p[0])
### BUGGY CODE ###

from copy import deepcopy
H, W, K = [int(x) for x in input().split()]
c = [[int(x) for x in list(input())] for _ in range(H)]
c.reverse()

max_score = 0
for y in range(H):
    for x in range(W):
        board = deepcopy(c)
        board[y][x] = None  # 消す
        score = 0
        erased = True
        coeff = 1
        while erased:
            erased = False
            # 落下させる
            for i in range(1, H):
                for j in range(W):
                    k = i
                    while k > 0 and board[k - 1][j] == None:
                        k -= 1
                    board[k][j], board[i][j] = board[i][j], board[k][j]

            # 消す
            for i in range(H):
                cnt = 1
                num = board[i][0]
                for j in range(1, W):
                    if board[i][j] != None and board[i][j] == board[i][j - 1]:
                        num = board[i][j]
                        cnt += 1
                    else:
                        if cnt >= K:
                            erased = True
                            score += coeff * cnt * num
                            board[i][j - cnt : j] = [None] * cnt
                        cnt = 1
                if cnt >= K:
                    erased = True
                    score += coeff * cnt * num
                    board[i][j - cnt + 1 : j + 1] = [None] * cnt

            coeff *= 2

        max_score = max(max_score, score)

print(max_score)

### FIXED CODE ###

from copy import deepcopy
H, W, K = [int(x) for x in input().split()]
c = [[int(x) for x in list(input())] for _ in range(H)]
c.reverse()

max_score = 0
for y in range(H):
    for x in range(W):
        board = deepcopy(c)
        board[y][x] = None  # 消す
        score = 0
        erased = True
        coeff = 1
        while erased:
            erased = False
            # 落下させる
            for i in range(1, H):
                for j in range(W):
                    k = i
                    while k > 0 and board[k - 1][j] == None:
                        k -= 1
                    board[k][j], board[i][j] = board[i][j], board[k][j]

            # 消す
            for i in range(H):
                cnt = 1
                num = board[i][0]
                for j in range(1, W):
                    if board[i][j] != None and board[i][j] == board[i][j - 1]:
                        num = board[i][j]
                        cnt += 1
                    else:
                        if cnt >= K:
                            erased = True
                            score += coeff * cnt * num
                            board[i][j - cnt : j] = [None] * cnt
                        cnt = 1
                if cnt >= K:
                    erased = True
                    score += coeff * cnt * num
                    board[i][j - cnt + 1 : j + 1] = [None] * cnt

            coeff *= 2

        max_score = max(max_score, score)

print(max_score)
### BUGGY CODE ###

n = int(input())
l = list(map(int,input().split(" ")))
l.sort()
l.reverse()
cnt = 0 
for i in range(0,n):
    for j in range(i+1,n):
        if i == j:
            continue
        for k in range(j+1,n):
            if i == k and j == k:
                continue
            a = l[i]
            b = l[j]
            c = l[k]
            if a < b + c and b < a + c and c < a + b:
                cnt+=1
            else:
                break
print(cnt)

### FIXED CODE ###

n = int(input())
l = list(map(int,input().split(" ")))
l.sort()
cnt = 0 
import bisect
for i in range(0,n-2):
    a = l[i]
    for j in range(i+1,n-1):
        b = l[j]
        target = a + b 
  #      print("#",a,b)
        f1 = bisect.bisect_left(l,target,j+1,n)
        cnt+= f1 - 1- j
   #     print("cnt: ",cnt)
print(cnt)
### BUGGY CODE ###

import sys

input = sys.stdin.readline
n = int(input())
strs = [input() for i in range(n)]

ret = []
for str in strs:
  l = list(str.strip())
  l.sort()
  ret.append("".join(l))

count = 0
length = len(ret)
for index, content in enumerate(ret):
  if index < length - 1:
    for i in range(index+1, length):
      if ret[index] == ret[i]:
        count += 1
print(count)

### FIXED CODE ###

import sys

n = int(input())
originals = [input() for i in range(n)]

ret = {}
count = 0
for original in originals:
  str = "".join(sorted(list(original)))
  if str in ret:
    count += ret[str]
    ret[str] += 1
  else:
    ret[str] = 1
print(count)
### BUGGY CODE ###

n = int(input())
a = []
line = input()
for v in line.split():
    a.append(int(v))

for i in range(1, n +1):
    print(a.count(i))

### FIXED CODE ###

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

result = [0 for _ in range(n)]
for i in range(n - 1):
    result[a[i]-1] += 1

for v in result:
    print(v)