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

import math
import copy
from copy import deepcopy
import sys
import fractions
# import numpy as np
from functools import reduce
# import statistics
import decimal
import heapq
import collections
import itertools

sys.setrecursionlimit(100001)


# input = sys.stdin.readline
# sys.setrecursionlimit(10**6)

# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList


# ===CODE===

n = int(input())
d = getInputListInt()


def combinations_count(n, r):
    if n <= 1:
        return 0
    else:
        return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

dic = {}
dic_ans = {}
dic_comb = {}

for key in d:
    if key in dic:
        dic[key] += 1
    else:
        dic[key] = 1

tmp_keys = []
for key in dic:
    if dic[key] < 2:
        tmp_keys.append(key)

for k in tmp_keys:
    del dic[k]

tmp_len = len(dic)

for i in range(n):
    ans = 0
    tmp_key = d[i]

    if tmp_len == 0:
        print(0)
        continue

    if tmp_key in dic_ans:
        print(dic_ans[tmp_key])
    else:
        for k in dic:
            if k == tmp_key:
                tmp_dic_idx = dic[k]-1
                if tmp_dic_idx in dic_comb:
                    ans += dic_comb[tmp_dic_idx]
                else:
                    tmp_calc = combinations_count(tmp_dic_idx, 2)
                    ans += tmp_calc
                    dic_comb[tmp_dic_idx] = tmp_calc
            else:
                tmp_dic_idx = dic[k]
                if tmp_dic_idx in dic_comb:
                    ans += dic_comb[tmp_dic_idx]
                else:
                    tmp_calc = combinations_count(tmp_dic_idx, 2)
                    ans += tmp_calc
                    dic_comb[tmp_dic_idx] = tmp_calc
        print(ans)
        dic_ans[tmp_key] = ans




### FIXED CODE ###

import sys
import re
import math
import collections
import decimal
import bisect
import itertools

# import copy
# import heapq
# from collections import deque
# import decimal

# sys.setrecursionlimit(100001)
INF = sys.maxsize
# MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===


def main():
    n = ni()
    d = na()
    c = collections.Counter(d)

    total = 0
    for v in c.values():
        total += v * (v - 1) // 2

    for i in range(n):
        v = c[d[i]]

        print(int(total - v + 1))


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

#warshal-floydの練習だと思ってやる。
n,m=map(int,input().split())
A=[list(map(int,input().split()))for i in range(m)]
d=[[float('inf') for i in range(n)]for i in range(n)]

def wf(d):
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j]=min(d[i][j], d[i][k]+d[j][k])
#warshal floydする関数

# for t in range(n):
#     a,b=A[t]
#     a-=1
#     b-=1
#     d[a][b]=1
#Aにある経路を、おもみ1で計算。
count=0
for i in range(m):
    d=[[float('inf') for _ in range(n)]for _ in range(n)]
    for j in range(m):
        if i==j:
            p,q=A[j]
            p-=1
            q-=1
            #1箇所くっつけないでおく場所を指定し、そこの場所をp,qでmemo
        else:
            a,b=A[j]
            a-=1
            b-=1
            d[a][b]=1
            d[b][a]=1
    wf(d)
    if d[p][q]==float('inf'):
        count+=1
print(count)

### FIXED CODE ###

#union-findの練習だと思ってやる。
n,m=map(int,input().split())
A=[list(map(int,input().split()))for i in range(m)]

#union_find
#find, sunite, same, sizeを実装する。
def find(x):
    #findはrootを返す
    if par[x]<0:
        return x
    else:
        par[x]=find(par[x])
        return par[x]
def unite(x,y):
    #xとyの属する集合を合体
    #まずは根をとってくる
    x=find(x)
    y=find(y)
    if x==y:
        return False
    else:
        if par[x]>par[y]:
            x,y=y,x
        par[x]+=par[y]
        par[y]=x
def same(x,y):
    #xとyが同じ集合かどうか判定
    return find(x)==find(y)
def size(x):
    return -par[x]
#初期化

c=0
for i in range(m):
    par=[-1]*n
    for j in range(m):
        if i==j:
            r,s=A[j]
            r-=1
            s-=1
        else:
            p,q=A[j]
            p-=1
            q-=1
            unite(p,q)
    if same(r,s)==False:
        c+=1
print(c)
### BUGGY CODE ###

N = int(input())
X = input()

a = int(X, 2)
b = X.count("1")
k = 2 ** (N-1)

d = [0 for _ in range(b+2)]
for i in range(1, b+2):
    t = i
    cnt = 0
    while t > 0:
        if t % 2 == 1:
            cnt += 1
        t //= 2
    v = i % cnt
    d[i] = d[v] + 1

for i, ch in enumerate(X):
    if ch == "0":
        x = a + k
        y = b + 1
    else:
        x = a - k
        y = b - 1
    k //= 2

    if x == 0:
        print(0)
    else:
        print(d[x % y] + 1)


### FIXED CODE ###

N = int(input())
X = input()

a = int(X, 2)
b = X.count("1")

if b > 1:
    a1 = a % (b-1)
else:
    a1 = 0
a0 = a % (b+1)

for i in range(N):
    if X[i] == "1":
        if b == 1:
            print(0)
            continue
        t = (a1 - pow(2, N-1-i, b-1)) % (b-1)
    else:
        t = (a0 + pow(2, N-1-i, b+1)) % (b+1)
    
    ans = 1
    while t > 0:
        t %= bin(t).count("1")
        ans += 1
    print(ans)
### BUGGY CODE ###

import sys
import collections
import copy
import math
from collections import Counter

def verify_anagrams(first_word, second_word):
    def get_counter(s):
        return Counter(s.upper().replace(' ', ''))

    return get_counter(first_word) == get_counter(second_word)
input = sys.stdin.readline
N = int(input())
ans_list=["test"]
ans_num=[1]
for i in range(N):
    chk = input().strip()
    for j in range(len(ans_list)):
        if verify_anagrams(ans_list[j],chk):
            ans_num[j] +=1
            break
        if j == len(ans_list)-1:
            ans_list.append(chk)
            ans_num.append(1)
ans = 0
for i in range(len(ans_num)):
    ans += ans_num[i]*(ans_num[i]-1)//2
print(ans)


### FIXED CODE ###

import math
N = int(input())
s_dict = {}
ans = 0
for i in range(N):
    s = input()
    s = "".join(sorted(s))
    if s not in s_dict:
        s_dict[s] = 0
        s_dict[s] += 1
    else:
        ans += s_dict[s]
        s_dict[s] += 1
print(ans)
### BUGGY CODE ###

K=int(input())
ans=0
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

def gcd_list(numbers):
    return reduce(math.gcd, numbers)
  
for a in range(K):
  for b in range(K):
    for c in range(K):
      ans+=gcd(a+1,b+1,c+1)
print(ans)
      

### FIXED CODE ###

K=int(input())
ans=0
import math
from functools import reduce
 
def gcd(*numbers):
    return reduce(math.gcd, numbers)
 
def gcd_list(numbers):
    return reduce(math.gcd, numbers)
  
for a in range(K):
  for b in range(K):
    for c in range(K):
      ans+=gcd(a+1,b+1,c+1)
print(ans)
### BUGGY CODE ###

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

ans = 0
two_exp = 1
for i in range(60):
    one_cnt = 0
    zero_cnt = 0
    for a in A:
        if a >> i & 1:
            one_cnt += 1
        else:
            zero_cnt += 1
    ans += one_cnt * zero_cnt * two_exp
    ans %= MOD
    two_exp <<= 1
    two_exp %= MOD
print(ans)


### FIXED CODE ###

import numpy as np


def solve():
    ans = 0
    mask = 1
    for i in range(60):
        one_cnt = np.sum(A >> i & 1)
        tmp = one_cnt * (N - one_cnt)
        tmp %= MOD
        ans += tmp * mask
        ans %= MOD
        mask <<= 1
        mask %= MOD
    return ans


N, *A = map(int, open(0).read().split())
A = np.array(A, dtype=np.int64)
MOD = 1_000_000_007
print(solve())
### BUGGY CODE ###

n, m = list(map(int, input().split()))
city_nums = [[] for i in range(n)]
city_list = []
numbers = []

for i in range(m):
    pm, ym = list(map(int, input().split()))
    city_nums[pm-1].append(ym)
    city_list.append([pm,ym])
for i in range(m):
    cindex = len([1 for x in city_nums[city_list[i][0]-1] if x<city_list[i][1]])
    print("{:0=6}{:0=6}".format(city_list[i][0], cindex+1))

### FIXED CODE ###

n, m = list(map(int, input().split()))
city_list = []

for i in range(m):
    pm, ym = list(map(int, input().split()))
    city_list.append([i,pm,ym])

city_count = {}
city = {}

for i,p,y in sorted(city_list, key=lambda x: x[2]):
    if not p in city_count:
        city_count[p] = 1
    else:
        city_count[p] += 1
    city[i,p] = city_count[p]

for i,p,y in city_list:
    print("{:0=6}{:0=6}".format(p, city[i,p]))
### BUGGY CODE ###

N,P=map(int,input().split())

ans=int(P**(1/N))
ans+=1
while ans>0:
    if P%(ans**N)==0:
        break
    ans-=1

print(ans)

### FIXED CODE ###

N,P=map(int,input().split())

if N>=10**4:
    print(1)
else:
    ans=int(P**(1/N))
    ans+=1
    while ans>0:
        if P%(ans**N)==0:
            break
        ans-=1

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

N = int(input())
A = tuple(map(lambda n: int(n) - 1, input().split()))

minlen = 10**9
for k in range(1, N+1):
    # kは残す数
    A_ = A[:]
    for j in range(k):
        if j in A_:
            nf = A_.index(j)
            A_ = A_[nf:]
        else:
            break
    else:
        minlen = min(minlen, N - k)

if minlen >= N:
    print(-1)
else:
    print(minlen)

### FIXED CODE ###

N = int(input())
A = tuple(map(lambda n: int(n) - 1, input().split()))

rem = 0
bk = 0
for a in A:
    if a == rem:
        rem += 1
    else:
        bk += 1

if bk == N:
    print(-1)
else:
    print(bk)
### BUGGY CODE ###

# x*y == S
# を満たすx,yがあれば答えは0,0,x,0,0,y

S=int(input())
for i in range(int(S**0.5),S+1):
  if S%i>0:
    continue
  if S//i<10**9+1:
    print(0,0,i,0,0,S//i)
    break

### FIXED CODE ###

# (0,0),(a,b),(c,d)
# (10**9, 1)(x,y)
# 10**9 * y - x == S
# S = 10**9 * a + bとおくと
# y = a + 1
# x = 10**9- b

S=int(input())
if S==10**18:
  print(0,0,10**9,0,0,10**9)
  exit(0)
DIV=10**9
a = S//DIV
b = S%DIV
x = 10**9-b
y = a + 1
if x>10**9:
  print(x)
if y>10**9:
  print(y)
print(0,0,10**9,1,x,y)
### BUGGY CODE ###

S = input()
a = len(S)
L = [0]
for i in range(a):
    L.append(int(S[:i+1])%2019)
k = 0
#x文字目からy文字目
for x in range(1,a+1):
    for y in range(x,a+1):
        if (L[x-1]*(10**(y-x+1)) - L[y]) % 2019 == 0:
            k += 1
print(k)

### FIXED CODE ###

S = input()
a = len(S)
mod = 0
ten = 1
L = [0]*2019 #余りの列
L[0] = 1
for i in range(a-1,-1,-1):
    mod = (int(S[i])*(ten)+mod) %2019
    L[mod] += 1
    ten = (ten*10)%2019
ans = 0
for i in L:
  ans += i*(i-1)//2
print(ans)
### BUGGY CODE ###

n,m = map(int,input().split())
xyz = [list(map(int,input().split())) for i in range(n)]

dp = [[[[0,0,0] for k in range(8)] for j in range(n+1)] for i in range(n+1)]

for i in range(n):
    for j in range(1,i+2):
        for k in range(8):
            l,r = 0,0
            for d in range(3):
                if k>>d&1:
                    l += dp[i][j-1][k][d] + xyz[i][d]
                    r += dp[i][j][k][d]
                else:
                    l -= dp[i][j-1][k][d] + xyz[i][d]
                    r -= dp[i][j][k][d]
            if l > r:
                for d in range(3):
                    dp[i+1][j][k][d] = dp[i][j-1][k][d] + xyz[i][d]
            else:
                dp[i+1][j][k] = dp[i][j][k]

ans = 0
for k in range(8):
    a = 0
    for d in range(3):
        if k>>d&1:
            a += dp[n][m][k][d]
        else:
            a -= dp[n][m][k][d]
    ans = max(ans,a)
print(ans)


### FIXED CODE ###

n,m = map(int,input().split())
xyz = [list(map(int,input().split())) for i in range(n)]
ans = 0
for i in range(8):
    s = []
    for j in range(n):
        a = 0
        for k in range(3):
            if i>>k&1:
                a += xyz[j][k]
            else:
                a -= xyz[j][k]
        s.append(a)
    s.sort()
    ans = max(ans,sum(s[n-m:]))
print(ans)
### BUGGY CODE ###

import sys
def input():
    return sys.stdin.readline()[:-1]

H, W = map(int, input().split())
#B = [input() for _ in range(H)]
Close = set()
Open = []

Dx = [0,1,0,-1]
Dy = [1,0,-1,0]

for y in range(H):
    b = input()
    for x, c in enumerate(b):
        if c=="#":
            Open.append((y, x))
            Close.add((y, x))
ans = -1
while len(Open)>0:
    Open_ = []
    for y, x in Open:
        for dx, dy in zip(Dx, Dy):
            x_ = x+dx
            y_ = y+dy
            if 0<=x_<W and 0<=y_<H and (y_, x_) not in Close:
                Open_.append((y_, x_))
                Close.add((y_, x_))
    Open = Open_
    ans += 1
print(ans)


### FIXED CODE ###

H, W = map(int, input().split())
B = [input() for _ in range(H)]
BB = [[1<<30]*W for _ in range(H)]
for y in range(H):
    p=1<<30
    for x in range(W):
        p+=1
        if B[y][x]=="#":
            p=0
        BB[y][x] = p

    p = 1 << 30
    for x in range(W-1,-1,-1):
        p += 1
        if B[y][x] == "#":
            p = 0
        p = min(p, BB[y][x])
        BB[y][x] = p
#print(BB)
ans = 0
for x in range(W):
    p = 1 << 30
    for y in range(H):
        p = min(p+1, BB[y][x])
        BB[y][x] = p

    p = 1 << 30
    for y in range(H - 1, -1, -1):
        p = min(p+1, BB[y][x])
        ans = max(ans, p)
        BB[y][x] = p
#print(BB)
print(ans)
### BUGGY CODE ###

from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import shortest_path

def get_path(start, goal, pred):
    return get_path_row(start, goal, pred[start])

def get_path_row(start, goal, pred_row):
    path = []
    i = goal
    while i != start and i >= 0:
        path.append(i)
        i = pred_row[i]
    if i < 0:
        return []
    path.append(i)
    return path[::-1]

n, m = map(int, input().split())
data = []
row = []
col = []
for _ in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    data.append(1)
    row.append(a)
    col.append(b)
    data.append(1)
    row.append(b)
    col.append(a)
graph = csr_matrix((data, (row, col)), shape=(n, n))
_, p = shortest_path(graph, return_predecessors=True, directed=False, unweighted=True, indices=0)
for item in p[1:]:
    if(item < 0):
        print("No")
        exit()
print("Yes")
for item in p[1:]:
    print(item + 1)


### FIXED CODE ###

from collections import deque

n, m = map(int, input().split())
edges = [[] for _ in range(n)]
prev = [-1] * n
visited = [False] * n
for _ in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    edges[a].append(b)
    edges[b].append(a)

def bfs(v):
    q = deque()
    visited[v] = True
    q.append(v)
    while q:
        v = q.popleft()
        for child in edges[v]:
            if not visited[child]:
                visited[child] = True
                prev[child] = v
                q.append(child)

bfs(0)
print("Yes")
for i in range(1, n):
    print(prev[i] + 1)
### BUGGY CODE ###

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

ans = 0
count = 1

while(True):
  if K**count <= N < K**(count+1):
    ans = count
    break

  count += 1

print(ans+1)

### FIXED CODE ###

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

if N >= 10:
  print(R)
else:
  print(R + (10-N) * 100)
### BUGGY CODE ###

iN,iM = [int(x) for x in input().split()]
iD = 10**9 +7 #法

def fPrimeCounter(iM):
    i = 2
    iS = int(iM ** 0.5) + 1
    aRet = []
    while i < iS or i <= iM  :
        iCounter = 0
        while iM % i == 0:
            iM = iM // i
            iCounter += 1
        if 0 < iCounter : aRet.append(iCounter)
        i += 1
    return aRet

#ABC042Dの流用
#二分累乗法 iDを法として
def fBiPow(iX,iN,iD):
    iY = 1
    while iN > 0:
        if iN % 2 == 0:
            iX = iX * iX % iD
            iN = iN // 2
        else:
            iY = iX * iY % iD
            iN = iN - 1
    return iY

aP = fPrimeCounter(iM)
if aP == [] :
    print (1)
else:
    iMax = max(aP) + iN - 1
    aM = [1] * (iMax + 1)
    #階乗 iD を法とした
    for i in range(1,iMax + 1):
        aM[i] = aM[i-1] * i  % iD
    aInvM = [1]* (iMax + 1)
    aInvM[iMax] = fBiPow(aM[iMax],iD-2,iD)
    #階乗の逆元 iD を法とした
    for i in range(iMax,0,-1):
        aInvM[i-1] = aInvM[i]*i % iD

    iRet = 1
    for i in aP:
        # i + iN -1  C  iN -1
        iRet *= aM[i+iN-1] * aInvM[iN-1] * aInvM[i] % iD
    iRet %= iD
    print(iRet)


### FIXED CODE ###

iN,iM = [int(x) for x in input().split()]
iD = 10**9 +7 #法

def fPrimeCounter(iM):
    i = 2
    iS = int(iM ** 0.5) + 1
    aRet = []
    while i < iS or iM != 1:
        iCounter = 0
        while iM % i == 0:
            iM = iM // i
            iCounter += 1
        if 0 < iCounter : aRet.append(iCounter)
        i += 1

    return aRet

#二分累乗法 iDを法として
def fBiPow(iX,iN,iD):
    iY = 1
    while iN > 0:
        if iN % 2 == 0:
            iX = iX * iX % iD
            iN = iN // 2
        else:
            iY = iX * iY % iD
            iN = iN - 1
    return iY

aP = fPrimeCounter(iM)
if aP == [] :
    print (1)
else:
    iMax = max(aP) + iN - 1
    aM = [1] * (iMax + 1)
    #階乗 iD を法とした
    for i in range(1,iMax + 1):
        aM[i] = aM[i-1] * i  % iD
    aInvM = [1]* (iMax + 1)
    aInvM[iMax] = fBiPow(aM[iMax],iD-2,iD)
    #階乗の逆元 iD を法とした
    for i in range(iMax,0,-1):
        aInvM[i-1] = aInvM[i]*i % iD

    iRet = 1
    for i in aP:
        # i + iN -1  C  iN -1
        iRet *= aM[i+iN-1] * aInvM[iN-1] * aInvM[i] % iD
    iRet %= iD
    print(iRet)
### BUGGY CODE ###

def gcd(x,y):
	while y!=0:
		x,y=y,x%y
	return x

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

k = []
r = gcd(a,b)
for i in range(1,r+1):
	if a % i == 0 and b % i == 0:
		if i % 2 != 0 or i == 2:
			k.append(i)

l = []
l.append(k[0])
ans = 1

for i in range(1,len(k)):
	flag = True
	for j in range(len(l)):
		if gcd(k[i],l[j]) != 1:
			flag = False
			break
	if flag:
		l.append(k[i])
		ans += 1

print(ans)


### FIXED CODE ###

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

def make_divisors(n):
	divisors = []
	for i in range(1, int(n**0.5)+1):
		if n % i == 0:
			divisors.append(i)
			if i != n // i:
				divisors.append(n//i)
	# divisors.sort()
	return divisors

def gcd(x,y):
	while y!=0:
		x,y=y,x%y
	return x

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

#factorization(24)
## [[2, 3], [3, 1]]
##  24 = 2^3 * 3^1

g = gcd(a,b)
#gcd_list = make_divisors(g)
bunkai = factorization(g)

if len(bunkai) == 1 and bunkai[0][0] == 1:
	print(1)
else:
	print(len(bunkai) + 1 )
### BUGGY CODE ###

# DPの計算量…DPテーブルのノードの数＋エッジの数
# https://atcoder.jp/contests/dp/tasks/dp_b


def chmin(a, b):
    '''a>bならbを代入して返すメソッド'''
    if a > b:
        a = b
        return a
    else:
        return a


def main():
    '''もらうDPとして実装'''
    N, K = list(map(int, input().split()))
    H = list(map(int, input().split()))
    # 最小なものにコストを書き換えたいので初期値は大きく取る
    dp = [1000000000] * N

    # 最初はコスト０
    dp[0] = 0
    for i in range(1, N):
        dp[i] = min(dp[i - j] + abs(H[i] - H[i - j]) for j in range(1, min(i + 1, K + 1)))
    print(dp[i])


main()


### FIXED CODE ###

def test():
    N, K = map(int, input().split())
    H = list(map(int, input().split()))
    dp = [float('inf')]*N
    dp[0] = 0
 
    for i in range(1, N):
        dp[i] = min(dp[j] + abs(H[i] - H[j]) for j in range(max(i-K, 0), i))
 
    print(dp[-1])
 
if __name__ == '__main__':
    test()
### BUGGY CODE ###

def main():
  S = input()
  n = len(S)

  while True:
    tmp = S
    S = S.replace('01', '')
    S = S.replace('10', '')
    if tmp == S:
      break

  print(n - len(S))


if __name__ == "__main__":
  main()


### FIXED CODE ###

def main():
  S = input()
  print(min(S.count('0'), S.count('1')) * 2)


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

def judgePrime(n):
  result = True
  for i in xrange(2, n):
    if n % i == 0:
      result = False
      break
  return result

def getPrimeNumFromList(list):
  count = 0
  for i in xrange(len(list)):
    target = 0
    if i == 0:
      target = list[0]
      if judgePrime(target):
        count += 1
      else:
        pass

  return count

n = int(raw_input())
list = []
for i in xrange(n):
  list.append(int(raw_input()))
list.sort()

count = 0
for i in xrange(n):
  if judgePrime(list[i]):
    count += 1
print count
# print getPrimeNumFromList(list)

### FIXED CODE ###

import pdb

n = int(raw_input())
count = 0
for x in xrange(n):
  target = int(raw_input())
  # pdb.set_trace()
  if target == 2:
    count += 1
  elif target < 3 or not target & 1:
    continue
  else:
    if pow(2, target - 1, target) == 1:
      count += 1

print count
### BUGGY CODE ###

nums = int(input())
ary  = list(map(int,input().split()))
count =0
max_count = 0

for x in ary:
    for i in range(nums):
        if ary[i] == x+1 or ary[i] == x or ary[i] == x-1:
            count += 1
    if count > max_count:
        max_count = count
    count = 0
print(max_count)

### FIXED CODE ###

nums = int(input())
ary  = list(map(int,input().split()))
count =0
max_count = 0
ary.sort()
ary_count = [0 for i in range(100005)]
ary_count.append(0)

for i in ary:
    ary_count[i] += 1

for i in range(1,100005):
    count += ary_count[i]
    count += ary_count[i+1]
    count += ary_count[i-1]
    if count > max_count:
        max_count = count
    count = 0
print(max_count)
### BUGGY CODE ###

N,K=map(int,input().split(' '))
mod =10**9+7
dp=[pow(K//i,N,mod) for i in range(1,K+1)]
for i in range(K,1,-1):
    tmp=[1]
    for j in range(2,int(pow(i+1,0.5))+1):
        if i%j==0:
            tmp.append(j)
            if i != j*j:
                tmp.append(i//j)
    for k in tmp:
        dp[k-1] -=dp[i-1]
ans = 0
for n,i in enumerate(dp):
    ans += (n+1)*i
    ans %=mod
print(ans)

### FIXED CODE ###

N,K=map(int,input().split(' '))
mod =10**9+7
dp=[pow(K//i,N,mod) for i in range(1,K+1)]
for i in range(K,1,-1):
    tmp=[1]
    for j in range(2,int(pow(i+1,0.5))+1):
        if i%j==0:
            tmp.append(j)
            if i != j*j:
                tmp.append(i//j)
    for k in tmp:
        dp[k-1] -=dp[i-1]
ans = 0
for n,i in enumerate(dp):
    ans += (n+1)*i
    ans %=mod
print(ans)