Harryxun/stf_run huggingface dataset:
N = int(input())
A = list(map(int, input().split()))
l = [0] * 100000
for i in A:
    l[i] += 1
c = 0
nums = [0] * N
for i in range(N):
    nums[i] = l[i] * (l[i] - 1) / 2
s = sum(nums)
for i in range(N):
    a = A[i]
    print(int(s - (l[a] * (l[a] - 1)) / 2 + (l[a] - 1) * (l[a] - 2) / 2))


### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
l = [0] * 10000001
for i in A:
    l[i] += 1
s = 0
for i in range(N + 1):
    i = l[i]
    s += i * (i - 1) // 2
for a in A:
    a = l[a]
    print(s - (a * (a - 1) // 2) + ((a - 1) * (a - 2) // 2))
class UnionFind():
  def __init__(self, n):
    self.n = n
    self.root = [-1]*n
    self.rank = [0]*n
    
  def find_root(self, e):
    if self.root[e] < 0:
      return e
    else:
      r = self.find_root(self.root[e])
      self.root[e] = r
      return r
    
  def combine(self, e1, e2):
    root1 = self.find_root(e1)
    root2 = self.find_root(e2)
    if root1 == root2:
      pass
    elif self.rank[root1] < self.rank[root2]:
      self.root[root1] += self.root[root2]
      self.root[root2] = root1
      self.rank[root1] = self.rank[root2] + 1
    elif self.rank[root2] < self.rank[root1]:
      self.root[root2] += self.root[root1]
      self.root[root1] = root2
      self.rank[root2] = self.rank[root1] + 1
    else:
      self.root[root2] += self.root[root1]
      self.root[root1] = root2
      self.rank[root2] += 1
      
  def in_the_same_group(self, e1, e2):
      r1 = self.find_root(e1)
      r2 = self.find_root(e2)
      if r1 == r2:
        return True
      return False
  

NMK = input().split()
N = int(NMK[0])
M = int(NMK[1])
K = int(NMK[2])
uf = UnionFind(N)
from collections import defaultdict

friend_list = [0]*N
for _ in range(M):
  AB = input().split()
  A = int(AB[0])-1
  B = int(AB[1])-1
  uf.combine(A,B)
  friend_list[A] += 1
  friend_list[B] += 1

block_list = [0]*N
for _ in range(K):
  CD = input().split()
  C = int(CD[0])-1
  D = int(CD[1])-1
  if uf.in_the_same_group(C, D):
    block_list[C] += 1
    block_list[D] += 1

ans = []
if M == 0 and K == 0:
  ans = ["0"] * N
else:
  for i in range(N):
    cnt = -uf.root[uf.find_root(i)] - 1 - friend_list[i] - block_list[i]
    ans.append(str(cnt))
print(" ".join(ans))

### FIXED CODE ###

class UnionFind():
 def __init__(self,n):
   self.n=n
   self.root=[-1]*(n+1)
   self.rank=[0]*(n+1)
 def FindRoot(self,x):
   if self.root[x]<0:
     return x
   else:
     self.root[x]=self.FindRoot(self.root[x])
     return self.root[x]
 def Unite(self,x,y):
   x=self.FindRoot(x)
   y=self.FindRoot(y)
   if x==y:
     return
   else:
     if self.rank[x]>self.rank[y]:
       self.root[x]+=self.root[y]
       self.root[y]=x
     elif self.rank[x]<=self.rank[y]:
       self.root[y]+=self.root[x]
       self.root[x]=y
       if self.rank[x]==self.rank[y]:
         self.rank[y]+=1
 def isSameGroup(self,x,y):
   return self.FindRoot(x)==self.FindRoot(y)
 def Count(self,x):
   return -self.root[self.FindRoot(x)]
 
n,m,k=map(int,input().split())
t=UnionFind(n+1)
cnt=[0]*(n+1) #各iについて、iと同一の連結成分に属する友達関係の人、ブロック関係の人の数を数える
for _ in range(m):
 a,b=map(int,input().split())
 cnt[a]+=1 #各iについて、iと同一の連結成分に属する友達関係の人の数を数える
 cnt[b]+=1
 t.Unite(a,b)
for _ in range(k):
 a,b=map(int,input().split())
 if t.isSameGroup(a,b)==True:
   cnt[a]+=1 #各iについて、iと同一の連結成分に属するブロック関係の人の数を数える
   cnt[b]+=1
ans=[0]*(n+1)
for i in range(1,n+1):
 ans[i]=(t.Count(i)-1)-cnt[i] #答えは(各iが属する連結成分のサイズ)-1-((iと同一の連結成分に含まれているiと友達関係にある人の数)+(iと同一の連結成分に含まれているiとブロック関係にある人の数)となる
print(*ans[1:])
a = list(map(int, input().split()))
b=""
while (len(a)!=0):
    x=min(a)
    b+=(str(x)+" ")
    a.remove(x)
print(b)

### FIXED CODE ###

a = list(map(int, input().split()))
b=""
while (len(a)!=0):
    x=min(a)
    b+=(str(x)+" ")
    a.remove(x)
print(b.rstrip())
a,b=input(),split()
print(a+b)

### FIXED CODE ###

a,b=input().split()
print(b+a)
N = int(input())
num = list(map(int, input().split()))
ans = num.prod()

### FIXED CODE ###

N = int(input())
num = list(map(int, input().split()))
answer = 1
if 0 in num:
  print(0)
else:
  for i in range(N):
    if answer*num[i] <= 10**18:
      answer = answer*num[i]
      if i == N-1:
        print(answer)
    else:
      print(-1)
      break
a,b = map(int,input().split())
x = [2,3,4,5,6,7,8,9,10,11,12,1]
if x.index(a)>x.index(b):
    print("Alice")
elif x.index(a)==x.index(b):
    print("Draw")
else:
    print("Bob")

### FIXED CODE ###

a,b = map(int,input().split())
x = [2,3,4,5,6,7,8,9,10,11,12,13,1]
if x.index(a)>x.index(b):
    print("Alice")
elif x.index(a)==x.index(b):
    print("Draw")
else:
    print("Bob")
n = int(input())
if n%2==0 or n%5==0:
  print(-1)
else:
  a = 7
  flag = 0
  while flag==0:
    if a%n==0:
      print(count+1)
      flag = 1
    else:
      count+=1
      a = a*10
      a = a+7
      a = a%n

### FIXED CODE ###

k=int(input())
n=7
for i in range(k+1):
    if n%k==0:
        print(i+1)
        exit()
    n=(10*n+7)%k
print(-1)
# input
N = int(input())
X = list(map(int, input().split()))

# process/output
L = min(X)
R = max(X)

ans = int(float('inf'))
for i in range(L, R+1):
    cost = 0
    for x in X:
        cost += (x-i)**2
    
    if cost < ans:
        ans = cost

print(ans)


### FIXED CODE ###

# input
N = int(input())
X = list(map(int, input().split()))

# process
L = min(X)
R = max(X)

ans = float('inf')
for i in range(L, R+1):
    cost = 0
    for x in X:
        cost += (x-i)**2
    
    if cost < ans:
        ans = cost

# output
print(int(ans))
from collections import deque

def bfs(neighbor,start):
    order = [0 for i in range(N)]
    visited = [0 for i in range(N)]
    visited[start] = 1
    q = deque([start])
    num = 1
    while q:
        path = q.popleft()
        order[path] = num
        visited[path] = 1
        num += 1
        for v in neighbor[path]:
            if visited[v] == 1:
                continue
            q.append(v)
    order = [[i,order[i]] for i in range(len(neighbor))]
    order.sort(key=lambda x:x[1])
    return [order[i][0] for i in range(len(order))]


N = int(input())
node = [[0,i] for i in range(N)]
ab = []
neigh = [[0 for i in range(N)] for j in range(N)]
for i in range(N-1):
    ai,bi = map(int,input().split())
    node[ai-1][0] += 1
    node[bi-1][0] += 1
    neigh[ai-1][bi-1] = 1
    neigh[bi-1][ai-1] = 1
    ab.append([ai-1,bi-1])
c = list(map(int,input().split()))
c.sort(reverse=True)
node.sort(key=lambda x:x[0],reverse=True)
m = max([node[i][0] for i in range(N)])
max_node = [node[i][1] for i in range(N) if node[i][0] == m]
ans1 = 0
for nn in max_node:
    can = 0
    bbb = bfs(neigh,nn)
    cn = [[c[i],bbb[i]] for i in range(N)]
    #cn.sort(key=lambda x:x[1])
    for i in range(N-1):
        can += min(cn[ab[i][0]][0],cn[ab[i][1]][0])
    if can > ans1:
        ans1 = can
        ans2 = ' '.join([str(cn[i][0]) for i in range(N)])

        
print(ans1)

print(ans2)


### FIXED CODE ###

N = int(input())
print(180*(N-2))
N, K = map(int, input().split())
h = [int(input()) for i in range(N)]

# 小さい順にソートする
#def sort(h):
#    if len(h) <= 1:
#        return h
#    base = h[-1]
#    low_temp = [];
#    high_temp = [];
#    base_count = 1
#    for i in range(len(h)-1):
#        if h[i] < base:
#            low_temp.append(h[i])
#        elif h[i] > base:
#            high_temp.append(h[i])
#        else:
#            base_count += 1
#    low = sort(low_temp)
#    high = sort(high_temp)
#    return low + [base]*base_count + high

h.sort()
hantei = 10**10
for i in range(N-K+1):
    temp = h[i:i+K]
    if (temp[-1] - temp[0]) < hantei:
        hantei = temp_dif

print(hantei)


### FIXED CODE ###

N, K = map(int, input().split())
h = [int(input()) for i in range(N)]
h.sort()
print(min(h[i+K-1] - h[i] for i in range(N-K+1)))
import sys
import collections

n, m = map(int, sys.stdin.readline().split())
p = list(range(n))
r = [set([i]) for i in range(n)]


def li_(): return [int(x)-1 for x in sys.stdin.readline().split()]


def find(x):
    if p[x] != x:
        p[i] = find(p[x])
    return p[x]


def union(x, y):
    x, y = find(x), find(y)
    tmp = r[y]
    for i in tmp:
        if p[i] != p[x]:
            p[i] = x
    r[x] = r[x] | r[y]
    r[y] = r[x]


flist = [0] * m
elist = [0] * m
for i in range(m):
    flist[i], elist[i] = li_()

flist.reverse()
elist.reverse()

ans = [0] * m
ans[0] = int(n*(n-1)/2)

for i in range(m-1):
    a, b = flist[i], elist[i]
    if find(a) != find(b):
        union(a, b)
    tmp = ans[0]
    c = sorted(collections.Counter(p).values(), reverse=True)
    for j in c:
        if j == 1:
            break
        tmp -= int(j * (j - 1) / 2)
    ans[i + 1] = tmp
    if tmp == 0:
        break

for i in range(m):
    print(ans[m-i-1])


### FIXED CODE ###


import sys
import collections

n, m = map(int, sys.stdin.readline().split())
p = list(range(n))
r = [1] * n


def li_(): return [int(x)-1 for x in sys.stdin.readline().split()]


def find(x):
    global p
    if p[x] != x:
        p[x] = find(p[x])
    return p[x]


def union(x, y):
    x, y = find(x), find(y)
    if y > x:
        x, y = y, x
    p[y] = x
    r[x] += r[y]
    r[y] = r[x]


flist = [0] * m
elist = [0] * m
for i in range(m):
    flist[i], elist[i] = li_()

flist.reverse()
elist.reverse()

ans = [0] * m
ans[0] = int(n*(n-1)/2)

for i in range(m-1):
    a, b = flist[i], elist[i]
    if find(a) != find(b):
        ans[i + 1] = ans[i] - r[find(a)]*r[find(b)]
        union(a, b)
    else:
        ans[i+1] = ans[i]
    if ans[i+1] == 0:
        break

for i in range(m):
    print(ans[m-i-1])
from collections import deque
de = deque()
n,m,q = map(int,input().split())
queries = []
for i in range(q):
    a,b,c,d = map(int,input().split())
    queries.append((a,b,c,d))
de.append([1])
maxscore = 0
while de: 
    li = de.popleft()
    if len(li) < m:
        for i in range(li[-1],11):
            new_li = li + [i]
            de.append(new_li)
    else:
        score = 0
        for i in range(q):
            a,b,c,d = queries[i]
            if li[b-1]-li[a-1] == c:
                score += d
        maxscore = max(maxscore,score)
print(maxscore)


### FIXED CODE ###

from collections import deque
de = deque()
n,m,q = map(int,input().split())
queries = []
for i in range(q):
    a,b,c,d = map(int,input().split())
    queries.append((a,b,c,d))
de.append([1])
maxscore = 0
while de: 
    li = de.popleft()
    if len(li) < n:
        for i in range(li[-1],m+1):
            new_li = li + [i]
            de.append(new_li)
    else:
        score = 0
        for i in range(q):
            a,b,c,d = queries[i]
            if li[b-1]-li[a-1] == c:
                score += d
        maxscore = max(maxscore,score)
print(maxscore)
# D
n, m = map(int, input().split())
a = list(map(int, input().split()))
match_list = [[1,2],[2,5],[3,5],[4,4],[5,5],[6,6],[7,3],[8,7],[9,6]]

use_list = []
# for i in match_list:
#     if i[0] in a:
#         use_list.append(i)
use_list = match_list
use_list.sort(key=lambda x:x[1])
print(use_list)
ans_list = []
num = n // use_list[0][1]
while n > 0:
    if n % use_list[0][1] == n:
        n += use_list[0][1]
        ans_list.pop(0)
        
        for i in use_list:
        break
    elif n >= use_list[0][1]:
        n -= use_list[0][1]
        ans_list.append(str(use_list[0][0]))

ans_list.sort()
ans_list.reverse()
print(''.join(map(str, ans_list)))

### FIXED CODE ###

# D
n,m = map(int, input().split())
b = [0,2,5,5,4,5,6,3,7,6]
a = [0]+list(map(int, input().split()))
f = [-1]*10010
f[0]=0
for i in range(1,n+1):
    for j in range(1,m+1):
        x = a[j]
        if(i-b[x]<0):
            continue
        f[i] = max(f[i],f[i-b[x]]*10 + x)
print(f[n])
N = int(input())

X = [[[-1]*N] for i in range(N)]
for i in range(N):
    a = int(input())
    for i in range(a):
        b, c = map(int, input().split())
        X[i][b-1] = c
ans = 0
for i in range(2**N):
    Y = [0]*(N)
    for j in range(N):
        if ((i >> j) & 1):
            Y[j] = 1
    for j in range(N):
        if Y[j] == 1:
            for k in range(N):
                if X[j][k] == -1:
                    continue
                if X[j][k] != Y[j]:
                    Y[j] = 0
    ans = max(ans, sum(Y))

print(ans)

### FIXED CODE ###

N = int(input())

X = [[-1]*N for i in range(N)]
for i in range(N):
    a = int(input())
    for j in range(a):
        b, c = map(int, input().split())
        X[i][b-1] = c
ans = 0
for i in range(2**N):
    Y = [0]*(N)
    for j in range(N):
        if ((i >> j) & 1):
            Y[j] = 1
    flag = True
    for j in range(N):
        if Y[j] == 1:
            for k in range(N):
                if X[j][k] == -1:
                    continue
                if X[j][k] != Y[k]:
                    flag = False
    if flag:
        ans = max(ans, sum(Y))

print(ans)
# -*- coding: utf-8 -*-

#整数値入力 1文字の入力
def input_one_number():
    return int(input())

#整数値龍力　複数の入力
def input_multiple_number():
    return map(int, input().split())

#整数値龍力　複数の入力(配列)
def input_multiple_number_as_list():
    return list(map(int, input().split()))



#複数の最小公倍数
def calc_lcm_list(l):
    lcm = l[0]
    for i in range(1, N):
        lcm = lcm * l[i] // fractions.gcd(lcm, l[i])
    return lcm


import fractions
N = input_one_number()
lstA = input_multiple_number_as_list()

gcd = calc_lcm_list(lstA)

ans = 0
for a in lstA:
    ans += (gcd // a)

print(ans %= 1000000007)


### FIXED CODE ###

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

#整数値入力 1文字の入力
def input_one_number():
    return int(input())

#整数値龍力　複数の入力
def input_multiple_number():
    return map(int, input().split())

#整数値龍力　複数の入力(配列)
def input_multiple_number_as_list():
    return list(map(int, input().split()))

def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a
def lcm(a,b):
    return a*b//gcd(a,b)

def calc_gcd_list(l):
    gcd = l[0]
    for i in range(1, N):
        gcd = gcd(gcd, l[i])
    return gcd

def calc_lcm_list(l):
    lcm = 1
    for i in l:
        lcm = lcm * i // gcd(lcm, i)
    return lcm


N = input_one_number()
lstA = input_multiple_number_as_list()
lcm = calc_lcm_list(lstA)
pow = 10**9 +7
print(sum(lcm//a for a in lstA)%pow)
code="""
#include <iostream>
using namespace std;
int main()
{
  int x; cin>>x;
  cout<<x*x*x<<endl;
}
"""

import os,tempfile
(_,filename)=tempfile.mkstemp(".cpp")

f=open(filename,"w")
f.write(code)
f.close()

os.system("g++ -std=c++11 {} -o a.out".format(filename))
os.system("./a.out")

### FIXED CODE ###

code="""
#include <iostream>
using namespace std;
int main()
{
  int x; cin>>x;
  cout<<x*x*x<<endl;
}
"""

import os,tempfile
(_,filename)=tempfile.mkstemp(".cpp")

f=open(filename,"w")
f.write(code)
f.close()

os.system("g++ -std=c++0x {} -o ./a.out".format(filename))
os.system("./a.out")
N = int(input())
uvw = [list(map(int, input().split())) for i in range(N - 1)]
R = [-1] * N
Q = [[] for i in range(N)]
for i in range(N - 1):
    Q[uvw[i][0] - 1].append([uvw[i][1], uvw[i][2]])
    Q[uvw[i][1] - 1].append([uvw[i][0], uvw[i][2]])
def func(i, s, d, l):
    
    if R[i] != -1:
        return

    if R[i] == -1:
        if l %2 == 0:
            R[i] = s
        else:
            R[i] = d
            s = d
            d = s
    for j in range(len(Q[i])):
        func(Q[i][j-1][0] - 1, s, d, Q[i][j-1][1])

func(uvw[0][0] - 1, 0, 1, Q[0][0][1])
print(R)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 6)
N = int(input())
uvw = [list(map(int, input().split())) for i in range(N - 1)]
R = [-1] * N
Q = [[] for i in range(N)]
for i in range(N - 1):
    Q[uvw[i][0] - 1].append([uvw[i][1], uvw[i][2]])
    Q[uvw[i][1] - 1].append([uvw[i][0], uvw[i][2]])

def func(i, s, d, l):
    
    if R[i] != -1:
        return

    if R[i] == -1:
        if l %2 == 0:
            R[i] = s
        else:
            R[i] = d
            tmp = s
            s = d
            d = tmp
    for j in range(len(Q[i])):
        func(Q[i][j][0] - 1, s, d, Q[i][j][1])

func(uvw[0][0] - 1, 0, 1, 0)
for i in range(len(R)):
    print(R[i])
a = list(map(int,[input() for i in range(4)]))

if max(a[-1]) - min(a[-1]) > a[-1]:
  print(":(")
else:
  print("Yay!")


### FIXED CODE ###

a = list(map(int,[input() for i in range(6)]))

if max(a[:-1]) - min(a[:-1]) > a[-1]:
  print(":(")
else:
  print("Yay!")
a,b = map(int,input().split()))
print(a if a<=b else a-1)

### FIXED CODE ###

a,b = map(int,input().split())
print(a if a<=b else a-1)
S = input()
ans = 0
cnt = 0
for i in range(len(S)):
  if S[i] == "A" or S[i] =="G" or S[i] =="C" orS[i] =="T":
    cnt += 1
  else:
    ans = max(ans,cnt)
    cnt = 0
print(ans)

### FIXED CODE ###

S = input()
ans = 0
cnt = 0
for i in range(len(S)):
  if S[i] == "A" or S[i] =="G" or S[i] =="C" or S[i] =="T":
    cnt += 1
  else:
    ans = max(ans,cnt)
    cnt = 0

print(max(ans,cnt))
N, M = map(int, input().split())
matrix=[[0]*N for i in range(N)]
for i in range(M):
    a, b = map(int, input().split())
    matrix[a-1][b-1]=1
    matrix[b-1][a-1]=1
import itertools 
count=0
result=1
for i in itertools.permulations(range(1, N+1)):
    if i==1:
        for j in range(N-1):
            result+=matrix[i[j]][i[j+1]]
            if result=1:
                count+=1
            else:
                result=1
    else:
        break
print(count)

### FIXED CODE ###


import itertools

N, M = map(int, input().split())
adj_matrix = [[0]* N for _ in range(N)]

for i in range(M): #隣接行列
    a, b = map(int, input().split())
    adj_matrix[a-1][b-1] = 1
    adj_matrix[b-1][a-1] = 1

cnt = 0

for each in itertools.permutations(range(N)):
    if each[0] != 0:
        break
    factor = 1
    for i in range(N-1):
        factor *= adj_matrix[each[i]][each[i+1]]
    cnt += factor

print(cnt)
s = list(input())
k = int(input())
S = s
cnt = 0
cnt_2 = 0
flow = 0
flow_2 = 0


for i in range(len(s)):
    if s[flow] == s[flow+1]:
        cnt += 1
        flow += 2
    else:
        flow += 1

    if flow >= len(s)-1:
        break
# --------------------------

for i in range(len(s)):
    S.append(s[i])

for i in range(len(S)):
    if S[flow_2] == S[flow_2+1]:
        cnt_2 += 1
        flow_2 += 2
    else:
        flow_2 += 1

    if flow_2 >= len(S)-1:
        break

if k == 1:
    print(cnt)
else:
    print(cnt + (cnt_2 - cnt) * (k-1))






### FIXED CODE ###

s = list(input())
k = int(input())
S = s.copy()
S_3 =s.copy()
cnt = 0
cnt_2 = 0
cnt_3 = 0


for i in range(1, len(s)):
    if s[i-1] == s[i]:
        cnt += 1
        s[i] = "A"

# --------------------------

for i in range(len(s)):
    S.append(S[i])

for i in range(1, len(S)):
    if S[i-1] == S[i]:
        cnt_2 += 1
        S[i] = "A"

# if k == 1:
#     print(cnt)
# else:
#     print(cnt + (cnt_2 - cnt) * (k-1))

# ---------------------------------------

for i in range(len(S)):
    S_3.append(S_3[i])

for i in range(1, len(S_3)):
    if S_3[i-1] == S_3[i]:
        cnt_3 += 1
        S_3[i] = "A"

# --------------------------------------

if k == 1:
    print(cnt)
elif k == 2:
    print(cnt_2)
elif k == 3:
    print(cnt_3)
elif cnt_2 - cnt == cnt_3 - cnt_2:
    print(cnt + (cnt_2 - cnt) * (k-1))
else:
    if k % 2 == 0:
        print(int(cnt + (cnt_2 - cnt) * (k / 2) + (cnt_3 - cnt_2) * (k / 2 - 1)))
    else:
        print(int(cnt + (cnt_2 - cnt) * ((k - 1) / 2) + (cnt_3 - cnt_2) * ((k - 1) / 2)))
def mapint_inp():
    return map(int, input().split())

def intinp():
    return int(input())

N, K = mapint_inp()

l = list(range(N+1))
mn_list = []
for i in range(K, N+2):
    mn_list.append(sum(l[:i]))

r = l[::-1]
mx_list = []
for i in range(K, N+2):
    mx_list.append(sum(r[:i]))

ans = 0
for j in range(N):
    ans += mx_list[j]-mn_list[j]+1

print(ans)

### FIXED CODE ###

def mapint_inp():
    return map(int, input().split())

def intinp():
    return int(input())

R = intinp()

import math

p = math.pi

print(2*p*R)
a,b = map(int,raw_input().split())
m = a
if a>b:
    m = b
max = 0
for i in range(1,m+1):
    if a % i == 0 and b % i == 0:
        max = i
print max

### FIXED CODE ###

l = map(int,raw_input().split())
l.sort()
a,b = l
max = 0
while True:
    tmp = a%b
    if tmp == 0:
        max = b
        break
    a = b
    b = tmp
print max
n=int(input())
a=list(map(int,input().split()))
a.sort()
ans=[-1,0]
i=0
while i<n-1:
    res=0
    while a[i+res]-a[i]<=2:
        res+=1
    if res>ans[1]:
        ans[1]=res
        ans[0]=i
    i+=res
print(ans[1])

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
a.sort()
ans=[-1,0]
i=0
while i<=n-1:
    res=0
    cnt=0
    while i+res<=n-1 and a[i+res]-a[i]<=2:
        if a[i+res]==a[i]:
            cnt+=1
        res+=1
    if res>ans[1]:
        ans[1]=res
        ans[0]=i
    i+=cnt
print(ans[1])
import numpy as np

H, N = map(int, input().split())
AB = [list(map(int, input().split())) for i in range(N)]

# インデックスはライフ 値はそれを以下にする最小MP
dp = [np.inf for i in range(H+1)]
dp[0] = 0

for i in range(1, H+1):
    quietus_MP = np.inf
    for j in AB:
        if i-j[0] >= 0:
            dp[i] = min(dp[i-j[0]]+j[1], dp[i])
        # 一回で倒せて一番MP使わない魔法
        if j[0] > i:
            quietus_MP = min(j[1], quietus_MP)
    # 一回で倒す場合
    dp[i] = min(quietus_MP, dp[i])

print(dp[-1])

### FIXED CODE ###

import numpy as np

H, N = map(int, input().split())
AB = np.array([list(map(int, input().split())) for i in range(N)])
A = AB[:, 0]
B = AB[:, 1]

# インデックスはライフ 値はそれを以下にする最小MP
dp = np.array([10**10 for i in range(H+1)], dtype=int)
# dp = np.array([np.inf for i in range(H+1)], dtype=int)
dp[0] = 0

for i in range(1, H+1):
    # print(np.maximum(i-A, 0))
    dp[i] = min(dp[np.maximum(i-A, 0)] + B)

print(dp[-1])
from math import gcd
n = int(input())
def lcm2(x):
    return x * 2 // gcd(x, 2)
print(lcm2(n))

### FIXED CODE ###

def main():
    a, b = 2, int(input())
    ta, tb = a, b
    if b == 0: print(0)
    while a%b != 0:
       a, b = b, a%b
    print(int((ta*tb)/b))
main()
import sys
sys.setrecursionlimit=10**12

def modinv(a,m=10**9+7):
    if a==0: return 1
    else:
        b=m
        (x, lastx) = (0, 1)
        (y, lasty) = (1, 0)
        while b != 0:
            q = a // b
            (a, b) = (b, a % b)
            (x, lastx) = (lastx - q * x, x)
            (y, lasty) = (lasty - q * y, y)
        return lastx % m

def cur(p):
    for x in neighbor[p]:
        try:
            par[x]=p
            neighbor[x].remove(p)
        except: sys.exit()
        descend[p]+=cur(x)
    try:
        return descend[p]
    except: sys.exit()
def cur2(p):
    for x in neighbor[p]:
        ans[x]=ans[p]*descend[x]*modinv(n-descend[x])
        ans[x]%=mod
        cur2(x)

mod=10**9+7
n=int(input())
neighbor=[set()  for _ in range(n+1)]
descend=[1]*(n+2)
par=[-1]+[0]*n

for _ in range(n-1):
    a,b=map(int,input().split())
    neighbor[a].add(b)
    neighbor[b].add(a)
cur(1)


ans=[1]*(n+1)
ans1=1
for i in range(1,n+1):
    ans1=ans1*i*modinv(descend[i])
    ans1%=mod
ans[1]=ans1

cur2(1)

for i in range(1,n+1):
    print(ans[i])

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)

def modinv(a,m=10**9+7):
    if a==0: return 1
    else:
        b=m
        (x, lastx) = (0, 1)
        (y, lasty) = (1, 0)
        while b != 0:
            q = a // b
            (a, b) = (b, a % b)
            (x, lastx) = (lastx - q * x, x)
            (y, lasty) = (lasty - q * y, y)
        return lastx % m

def cur(p):
    if neighbor[p]==[]: return
    for x in neighbor[p]:
        par[x]=p
        neighbor[x].remove(p)
        cur(x)
    descend[par[p]]+=descend[p]

def cur2(p):
    for x in neighbor[p]:
        ans[x]=ans[p]*descend[x]*modinv(n-descend[x])
        ans[x]%=mod
        cur2(x)

mod=10**9+7
n=int(input())
neighbor=[set()  for _ in range(n+2)]
descend=[1 for i in range(n+1)]
par=[0]+[0]*(n+1)

for _ in range(n-1):
    a,b=map(int,input().split())
    neighbor[a].add(b)
    neighbor[b].add(a)

cur(1)


ans=[1]*(n+1)
ans1=1
for i in range(1,n+1):
    ans1=ans1*i*modinv(descend[i])
    ans1%=mod
ans[1]=ans1

cur2(1)

for i in range(1,n+1):
    print(ans[i])
n=int(input())
a=list(map(int,input().split()))
t=[0 for i in range(n)]
for i in a:
  b=a[i]
  t[b-1]=t[b-1]+1
for j in range(n):
  print(t[j])

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split(" ")))
t=[0 for i in range(n)]
for i in range(n-1):
  b=a[i]
  t[b-1]=t[b-1]+1
for j in range(n):
  print(t[j])