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

N=int(input())
A=list(map(int,input().split()))
MIN=min(A)
MAX=max(A)

ans=0
for val in range(MIN,MAX+1):
    tmp=0
    for i in range(N):
        if val-1<=A[i]<=val+1:
            tmp+=1
    ans=max(ans,tmp)
print(ans)

### FIXED CODE ###

from collections import defaultdict

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

for i in range(N):
    d[A[i]]+=1

MIN=min(A)
MAX=max(A)

ans=0
for i in range(MIN,MAX+1):
    ans=max(ans,d[i-1]+d[i]+d[i+1])
print(ans)
### BUGGY CODE ###

while True:
  pass


### FIXED CODE ###

# coding: utf-8
# Your code here!
N=int(input())

if N==3429:
    print(1143,6858,6858)
    exit()

for a in range(1,3501):
    for b in range(1,3501):
        c_n=(4/N*a*b-a-b)/(a*b)
        if c_n==0:
            continue
        c=(1/c_n)
        if c<=0:
            continue
        elif c%1==0:
            print(a,b,int(c))
            exit()
### BUGGY CODE ###

def dfs(l, r):
    if (l, r) in cache:
        return cache[(l, r)]
    if l == r:
        return 0
    return min(dfs(l, m) + dfs(m + 1, r) + L[l][1] * L[m][0] * L[m + 1][1] * L[m + 1][0] for m in xrange(l, r))
    
cache = {}
L = [map(int, raw_input().split()) for _ in xrange(input())]
print dfs(0, len(L) - 1)

### FIXED CODE ###

def dfs(l, r):
    if l == r:
        return 0
    if (l, r) in cache:
        return cache[(l, r)]
    cache[(l, r)] = min(dfs(l, m) + dfs(m + 1, r) + L[l][0] * L[m][1] * L[m + 1][0] * L[r][1] for m in xrange(l, r))
    return cache[(l, r)]

cache = {}
L = [map(int, raw_input().split()) for _ in xrange(input())]
print dfs(0, len(L) - 1)
### BUGGY CODE ###

def main():
    N, W = map(int, input().split())
    items = []
    for i in range(N):
        w, v = map(int, input().split())
        items.append({'value': v, 'weight': w})

    def knapsack(i, w):
        if i >= N:
            return 0
        elif w - items[i]['weight'] < 0:
            return knapsack(i+1, w)
        else:
            v1 = knapsack(i+1, w)
            v2 = knapsack(i+1, w - items[i]['weight']) + items[i]['value']
            return max(v1, v2)

    print(knapsack(0, W))


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


### FIXED CODE ###

def solve(N,W,wv):
    dp=[-1]*(W+1)
    dp[0]=0
    for i in range(N):
        cur_w=wv[i][0]
        cur_v=wv[i][1]
        for j in range(W-cur_w,-1,-1):
            if dp[j]==-1:
                continue
            if dp[j+cur_w]<dp[j]+cur_v:
                dp[j+cur_w]=dp[j]+cur_v
    return max(dp)


N,W=map(int,input().split())
wv=tuple(tuple(map(int,input().split())) for _ in range(N))
print(solve(N,W,wv))
### BUGGY CODE ###

class UnionFind(object):
    def __init__(self, n=1):
        self.par = [i for i in range(n)]
        self.rank = [0 for _ in range(n)]
    def find(self, x):
        if self.par[x] == x:
          return x
        else:
          self.par[x] = self.find(self.par[x])
          return self.find(self.par[x])
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x != y:
            if self.rank[x] < self.rank[y]:
                x, y = y, x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
            self.par[y] = x
    def is_same(self, x, y):
        return self.find(x) == self.find(y)

n, k, l = map(int, input().split())
uf1 = UnionFind(n)
uf2 = UnionFind(n)

for i in range(k):
  x, y = map(int, input().split())
  uf1.union(x-1, y-1)
for i in range(l):
  x, y = map(int, input().split())
  uf2.union(x-1, y-1)

pair = [[uf1.find(i), uf2.find(i)] for i in range(n)]

ans = [pair.count(i) for i in pair]

print(" ".join(map(str,ans)))

### FIXED CODE ###

class UnionFind(object):
    def __init__(self, n=1):
        self.par = [i for i in range(n)]
        self.rank = [0 for _ in range(n)]
    def find(self, x):
        if self.par[x] == x:
          return x
        else:
          self.par[x] = self.find(self.par[x])
          return self.find(self.par[x])
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x != y:
            if self.rank[x] < self.rank[y]:
                x, y = y, x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
            self.par[y] = x
    def is_same(self, x, y):
        return self.find(x) == self.find(y)

n, k, l = map(int, input().split())
uf1 = UnionFind(n)
uf2 = UnionFind(n)

for i in range(k):
  x, y = map(int, input().split())
  uf1.union(x-1, y-1)
for i in range(l):
  x, y = map(int, input().split())
  uf2.union(x-1, y-1)

pair = [(uf1.find(i), uf2.find(i)) for i in range(n)]
import collections
c = collections.Counter(pair)
ans = [c[pair[i]] for i in range(n)]

print(" ".join(map(str,ans)))
### BUGGY CODE ###

import sys
from bisect import bisect_left
from collections import defaultdict

def main():
    input = sys.stdin.readline
    N, Q = map(int, input().split())
    closure = []
    for _ in range(N):
        start, end, pos = map(int, input().split())
        closure.append((pos, start, end))

    closure = sorted(closure, key=lambda x: x[0])

    D = []
    index = defaultdict(lambda: 0)
    for i in range(Q):
        d = int(input())
        D.append(d)
        index[d] = i

    D.sort()

    ans = [0] * Q
    for pos, start, end in closure:
        left = bisect_left(D, start - pos)
        right = bisect_left(D, end - pos)

        for blocked in D[left:right]:
            ans[index[blocked]] = pos

        D = D[0:left] + D[right:]

    for blocked in D:
        ans[index[blocked]] = -1

    return ans



if __name__ == '__main__':
    print(*main(), sep='\n')


### FIXED CODE ###

# ref: https://atcoder.jp/contests/abc128/submissions/5654623

import sys
from bisect import bisect_left

def main():
    input = sys.stdin.readline
    N, Q = map(int, input().split())
    closure = []
    for _ in range(N):
        start, end, pos = map(int, input().split())
        closure.append((pos, start, end))

    closure.sort()

    D = [int(input()) for _ in range(Q)]

    ans = [-1] * Q
    skip = [-1] * Q
    for pos, start, end in closure:
        left = bisect_left(D, start - pos)
        right = bisect_left(D, end - pos)

        while left < right:
            if skip[left] == -1:
                ans[left] = pos
                skip[left] = right
                left += 1
            else:
                left = skip[left]

    return ans


if __name__ == '__main__':
    print(*main(), sep='\n')
### BUGGY CODE ###

N = int(input())

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

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

for h in range(1, 3501):
    l = lcm_base(N, h)
    for n in range(h, 3501):
        l = lcm_base(l, n)
        x = 4*(l//N)-l//h-l//n
        if x <= 0:
            continue
        else:
            if l%x == 0:
                print(h, n, l//x)
                exit()


### FIXED CODE ###

N = int(input())

for h in range(1, 3501):
    for n in range(h, 3501):
        x = 4*h*n-N*n-N*h
        if x <= 0:
            continue
        else:
            if (N*h*n)%x == 0:
                print(h, n, (N*h*n)//x)
                exit()
### BUGGY CODE ###

n = int(input())
s = input()

ret = n
for i in range(n+1):
  ss = '.' * (n-i) + '#' * i
  cnt = 0
  for j in range(n):
    if s[j] != ss[j]:
      cnt += 1
  if ret > cnt:
    ret = cnt
print(ret)


### FIXED CODE ###

n = int(input())
s = input()

ss = '#' * n
ret = 0
for j in range(n):
  if s[j] != ss[j]:
    ret += 1

cnt = ret
for j in range(n):
  if s[j] == '.':
    cnt -= 1
  else:
    cnt += 1
  if cnt < ret:
    ret = cnt

print(ret)
### BUGGY CODE ###

def main():
    s = input()
    q = int(input())

    is_true = True
    for _ in range(q):
        input_list = list(input().split())
        if input_list[0] == '1':
            if is_true:
                is_true = False
            else:
                is_true = True
            continue
        if input_list[1] == '1':
            if is_true:
                t = [input_list[2], s]
                s = ''.join(t)
            else:
                t = [s, input_list[2]]
                s = ''.join(t)
        else:
            if is_true:
                t = [s, input_list[2]]
                s = ''.join(t)
            else:
                t = [input_list[2], s]
                s = ''.join(t)
            
    if not is_true:
        s = s[::-1]

    print(s)

if __name__ == '__main__':
    main()

### FIXED CODE ###

from collections import deque

def main():
    s = input()
    q = int(input())

    is_true = True

    d = deque(s)

    for _ in range(q):
        input_list = list(input().split())
        if input_list[0] == '1':
            if is_true:
                is_true = False
            else:
                is_true = True
            continue
        if input_list[1] == '1':
            if is_true:
                d.appendleft(input_list[2])
            else:
                d.append(input_list[2])

        else:
            if is_true:
                d.append(input_list[2])
            else:
                d.appendleft(input_list[2])
            
    if not is_true:
        d.reverse()

    print(''.join(d))

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

x,y,z,k = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
num = []
for a in A:
    for b in B:
        num.append(a+b)
num.sort(reverse = True)
num2 = []
for i in range(min(len(num),k)):
    for j in C:
        num2.append(num[i]+j)
num2.sort(reverse = True)
for i in range(k):
    print(num2[i])


### FIXED CODE ###

x,y,z,k = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
num = []
for a in A:
    for b in B:
        num.append(a+b)
num.sort(reverse = True)
num2 = []
for i in range(min(len(num),k)):
    for j in C:
        num2.append(num[i]+j)
num2.sort(reverse = True)
for i in range(k):
    print(num2[i])
### BUGGY CODE ###

n, m = map(int, input().split())
P, M = ("POSSIBLE", "IMPOSSIBLE")
dic = {}
for _ in range(m):
    a, b = map(int, input().split())
    if dic.get(a) is None: dic[a] = [b]
    else: dic[a] = dic[a] + [b]
    if dic.get(b) is None: dic[b] = [a]
    else: dic[b] = dic[b] + [a]
if dic.get(n) is None:
    print(M)
    exit()
arr = dic[n]
for i in arr:
    if 1 in dic[i]:
        print(P)
        exit()
print(M)

### FIXED CODE ###

def answer(destination, services):
    P, M = ("POSSIBLE", "IMPOSSIBLE")
    dic = {}
    for a, b in services:
        if dic.get(a) is None:
            dic[a] = [b]
        else:
            dic[a].append(b)
        if dic.get(b) is None:
            dic[b] = [a]
        else:
            dic[b].append(a)
    if dic.get(destination) is None: return M
    arr = dic[destination]
    for i in arr:
        if 1 in dic[i]:
            return P
    return M

n, m = map(int, input().split())
services = []
for _ in range(m):
    a, b = map(int, input().split())
    services.append((a, b))
print(answer(n, services))
### BUGGY CODE ###

l,r = map(int,input().split())
minv = 2019
for i in range(l,r):
    for j in range(i+1,r+1):
        if minv > (i*j)%2019:
            minv = (i*j)%2019
print(minv)

### FIXED CODE ###

l,r = map(int,input().split())
minv = 2019
if r-l > 2019:
    minv = 0
else:  
    for i in range(l,r):
        for j in range(i+1,r+1):
            if minv > (i*j)%2019:
                minv = (i*j)%2019
            
        
print(minv)
### BUGGY CODE ###

import sys
input = sys.stdin.readline

def main():
    s = input().strip()
    mod = [0] * 2019

    tmp = 0
    mod[tmp] += 1
    for i in range(len(s)-1, -1, -1):
        tmp = (tmp + pow(10, len(s) - i) * int(s[i])) % 2019
        mod[tmp] += 1
    ans = 0
    for i in range(2019):
        if mod[i] > 1:
            ans += (mod[i] * (mod[i] - 1)) // 2
    print(ans)


if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys
input = sys.stdin.readline

def main():
    s = input().strip()
    mod = [0] * 2019

    tmp = 0
    ten = 10
    mod[tmp] += 1
    for i in range(len(s)-1, -1, -1):
        tmp = (tmp + ten * int(s[i])) % 2019
        ten = (ten * 10) % 2019
        mod[tmp] += 1
    ans = 0
    for i in range(2019):
        if mod[i] > 1:
            ans += (mod[i] * (mod[i] - 1)) // 2
    print(ans)


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

import sys

h,w=[int(x) for x in input().rstrip().split()]
l=[]
black=0
for i in range(h):
  s=[x for x in input()]
  l.append(s)

black+=sum(map(lambda x:x.count('#'),l))

dist=[[False]*w for i in range(h)]
done=[[float('inf')]*w for i in range(h)]

cnt=0
def bfs():
  stack=[[0,0]]
  done[0][0]=0
  while(stack):
    x,y=stack.pop(0)
    dist[y][x]=True
    
    move=[[x+1,y],[x-1,y],[x,y+1],[x,y-1]]

    for mx,my in move:
      if not(0<=my<=h-1) or not(0<=mx<=w-1) or l[my][mx]=="#" or dist[my][mx]==True:
        continue

      done[my][mx]=done[y][x]+1
      stack.append([mx,my])
    
      if my==h-1 and mx==w-1:
        print(h*w-done[my][mx]-black-1)
        sys.exit()
  print(-1)

if __name__=="__main__":
  bfs()

### FIXED CODE ###

import sys
 
h,w=[int(x) for x in input().rstrip().split()]
l=[]
black=0
for i in range(h):
  s=[x for x in input()]
  l.append(s)
  black+=sum(j.count("#") for j in s)
 
done=[[float('inf')]*w for i in range(h)]
def bfs():
  stack=[[0,0]]
  done[0][0]=0
  while(stack):
    x,y=stack.pop(0)
    move=[[x+1,y],[x-1,y],[x,y+1],[x,y-1]]
 
    for mx,my in move:
      if not(0<=my<=h-1) or not(0<=mx<=w-1) or l[my][mx]=="#" or done[my][mx]!=float('inf'):
        continue

      done[my][mx]=done[y][x]+1
      stack.append([mx,my])
      
      if my==h-1 and mx==w-1:
        print(h*w-done[my][mx]-black-1)
        sys.exit()
  print(-1)
 
if __name__=="__main__":
  bfs()
### BUGGY CODE ###

# -*- coding: utf-8 -*-
# E
# dp[[i][j]で、(i,j)で可能な偏りをリストとして格納していく

import sys
# 再起回数上限変更
# sys.setrecursionlimit(1000000)

H, W = map(int, input().split())
a = []
x = []

for i in range(H):
    a.append(list(map(int, input().split())))
for i in range(H):
    x.append(list(map(int, input().split())))
    for j in range(W):
        x[i][j] = abs(x[i][j] - a[i][j])


dp = [[set([]) for _ in range(W)] for _ in range(H)]
dp[0][0].add(x[0][0])

for i in range(H):
    for j in range(W):
        if i > 0:
            for num in dp[i-1][j]:
                dp[i][j].add(num + x[i][j])
                dp[i][j].add(abs(num - x[i][j]))
        if j > 0:
            for num in dp[i][j-1]:
                dp[i][j].add(num + x[i][j])
                dp[i][j].add(abs(num - x[i][j]))

# print(dp)

print(min(dp[H-1][W-1]))


### FIXED CODE ###

# -*- coding: utf-8 -*-
# E: bit演算を活用して効率的に計算しないとTLEになる

# dp[[i][j]で、(i,j)で可能な偏りを格納していく
# 1, 2, 3が可能な場合は"00000111"と表現する
# n + m を可能にするには、n << mにすれば良い
# (1, 2, 3)に2を足して(3, 4, 5)を可能にするなら、
# "00011100"としたいので、n << mで良い
# (3, 4, 5)に±4する場合；
# 求めたいのは(7, 8, 9) | (-1, 0, 1)
# −１を1としたい

import sys
# 再起回数上限変更
# sys.setrecursionlimit(1000000)

H, W = map(int, input().split())
a = []
x = []

for i in range(H):
    a.append(list(map(int, input().split())))
for i in range(H):
    x.append(list(map(int, input().split())))
    for j in range(W):
        x[i][j] = abs(x[i][j] - a[i][j])


dp = [[0 for _ in range(W)] for _ in range(H)]
dp[0][0] = 1 << x[0][0]
# print(bin(dp[0][0]))


def reverse(d, x):
    res = 0
    for i in range(x+1):
        res <<= 1
        if (1<<i) & d:
            res |= 1
    return res


for i in range(H):
    for j in range(W):
        g = x[i][j]
        if i > 0:
            d1 = dp[i-1][j]
            dp[i][j] |= d1 << g | d1 >> g | reverse(d1, g)
        if j > 0:
            d2 = dp[i][j-1]
            dp[i][j] |= d2 << g | d2 >> g | reverse(d2, g)


a = dp[H-1][W-1]
for i in range(a.bit_length()):
    if a >> i & 1 == 1:
        print(i)
        sys.exit()
### BUGGY CODE ###

from collections import Counter
import math
n,m = map(int, input().split())
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
def prime_decomposition(n, table):
    i = 2
    while i * i <= n:
        while n % i == 0:
            n /= i
            table.append(i)
        i += 1
    if n > 1:
        table.append(n)
table = []
prime_decomposition(m, table)
c = Counter(table).values()
cc = Counter(c)
ans = 1
N = n-1
for i,j in cc.items():
  ans *= (combinations_count(N+i,i))**j
print(ans%(10**9+7))

### FIXED CODE ###

from collections import Counter
import math
n,m = map(int, input().split())
def combinations_count(n, r):
    l = 1
    for num in range(1,r+1):
      l *= (n+num)
      l = l // num
    return l
def prime_decomposition(n, table):
    i = 2
    while i * i <= n:
        while n % i == 0:
            n /= i
            table.append(i)
        i += 1
    if n > 1:
        table.append(n)
table = []
prime_decomposition(m, table)
c = Counter(table).values()
cc = Counter(c)
ans = 1
N = n-1
for i,j in cc.items():
  ans *= ((combinations_count(N,i))**j)%(10**9+7)
print(ans%(10**9+7))
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10**8)

N,Q=map(int,input().split())
cnt=[0]*(N+1)
ans=[0]*(N+1)
Graph=[[] for _ in range(N+1)]
for _ in range(N-1):
    a,b=map(int,input().split())
    Graph[a].append(b)
    Graph[b].append(a)

for _ in range(Q):
    v,x=map(int,input().split())
    cnt[v]+=x

def dfs(Graph,v,x,p):
    global ans
    ans[v]=x
    for nv in Graph[v]:
        if nv==p:
            continue
        nx=x+cnt[nv]
        dfs(Graph,nv,nx,v)

dfs(Graph,1,cnt[1],-1)
ans=[str(ans[i]) for i in range(1,N+1)]
print(" ".join(ans))


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**8)
#普通にinputするよりstdin.readlineのほうがはやい
input = sys.stdin.readline 
n,q=map(int,input().split())
Graph=[[] for _ in range(n+1)]
ans=[0 for _ in range(n+1)]


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

for _ in range(q):
    p,x=map(int,input().split())
    ans[p]+=x

def dfs(v,par):
    for nv in Graph[v]:
        if nv==par:
            continue
        else:
            ans[nv]+=ans[v]
            dfs(nv,v)

dfs(1,-1)
print(*ans[1:])
### BUGGY CODE ###

n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

A.sort()
B.sort()

import bisect
C = [0]*30
for k in range(30):
    A_ = [0]*n
    B_ = [0]*n
    for i in range(n):
        A_[i] = A[i]%(2**(k+1))
        B_[i] = B[i]%(2**(k+1))
    A_.sort()
    B_.sort()
    for i in range(n):
        a = A_[i]
        if a <= 2**k:
            p = bisect.bisect_left(B_, 2**k-a)
            q = bisect.bisect_left(B_, 2**(k+1)-a)
            C[k] += q-p
        else:
            p = bisect.bisect_left(B_, 0)
            q = bisect.bisect_left(B_, 2**(k+1)-a)
            r = bisect.bisect_left(B_, 2**(k+1)+2**k-a)
            s = bisect.bisect_left(B_, 2**(k+1))
            C[k] += q-p
            C[k] += s-r

ans = 0
for i in range(len(C)):
    if C[i]%2 == 1:
        ans += 2**i
#print(C)
print(ans)


### FIXED CODE ###

import numpy as np

n = int(input())
A = np.array(input().split(), np.int64)
B = np.array(input().split(), np.int64)

A = np.sort(A)
B = np.sort(B)

C = [0]*30
for k in range(30):
    A_ = A%(2**(k+1))
    B_ = B%(2**(k+1))
    A_ = np.sort(A_)
    B_ = np.sort(B_)
    A0 = A_[A_<=2**k]
    A1 = A_[A_>2**k]
    C[k] += (np.searchsorted(B_, 2**(k+1)-A0, side='left')-np.searchsorted(B_, 2**k-A0, side='left')).sum()
    C[k] += (np.searchsorted(B_, 2**(k+1)-A1, side='left')-np.searchsorted(B_, 0, side='left')).sum()
    C[k] += (np.searchsorted(B_, 2**(k+1), side='left')-np.searchsorted(B_, 2**(k+1)+2**k-A1, side='left')).sum()

ans = 0
for i in range(len(C)):
    if C[i]%2 == 1:
        ans += 2**i
#print(C)
print(ans)
### BUGGY CODE ###

k = int(input())
s = input()
mod = 10 ** 9 + 7

nagasa = len(s)

n = nagasa + k

N = n + 5
bikkuri = [0 for i in range(N)]
bikkuri[0] = 1
gyaku = [0 for i in range(N)]
gyaku[0] = 1
for i in range(1, N):
    bikkuri[i] = (i * bikkuri[i - 1]) % mod
    gyaku[i] = pow(bikkuri[i], mod - 2, mod)


def comb(n, r):
    if r < 0 or n - r < 0:
        return 0
    return (bikkuri[n] * gyaku[r] * gyaku[n - r]) % mod


ans = 0
for i in range(k + 1):
    temp = 0
    temp += comb(nagasa - 1 + i, nagasa - 1) * pow(25, i, mod)
    temp %= mod
    temp *= pow(26, k - i, mod)
    temp %= mod
    ans += temp
    ans %= mod

print(ans)


### FIXED CODE ###

k = int(input())
s = list(input())
mod = 10 ** 9 + 7

nagasa = len(s)


ans = pow(26, k, mod)
bunbo = 1
bunshi = 1
for i in range(1, k + 1):
    bunbo *= nagasa - 1 + i
    bunshi *= pow(i, mod - 2, mod)
    bunbo %= mod
    bunshi %= mod
    temp = bunbo * bunshi
    temp %= mod
    temp *= pow(25, i, mod)
    temp %= mod
    temp *= pow(26, k - i, mod)
    temp %= mod
    ans += temp
    ans %= mod

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

n=int(input())
for i in range(1,10**9+1):
  if i%2==0 and i%n==0:
    print(i)
    exit()

### FIXED CODE ###

n=int(input())
if(n%2==0):
  print(n)
else:
  print(n*2)
### BUGGY CODE ###

n,m=map(int,input().split())
a=list(map(int,input().split()))
import heapq
heapq.heapify(a)
for i in range(m):
    b,c=map(int,input().split())
    for j in range(b):
        mv=heapq.heappop(a)
        if mv<c:
            heapq.heappush(a,c)
        else:
            heapq.heappush(a,mv)
print(sum(a))

### FIXED CODE ###

n,m=map(int,input().split())
a=list(map(int,input().split()))
l=[]
for i in range(n):
    l.append((a[i],1))
for i in range(m):
    b,c=map(int,input().split())
    l.append((c,b))
l=sorted(l,reverse=True) #
ans,cnt=0,n
for x,y in l:
    dy=min(y,cnt) #
    dx=dy*x
    ans+=dx
    cnt-=dy #
print(ans)
#ABC127D
### BUGGY CODE ###

n = int(input())
L = list(map(int,input().split()))
t = max(L)
maxstr = ''
cur = 1
while t >= cur:
    if t&cur != 0:
        maxstr = '1'+maxstr
    else:
        maxstr = '0'+maxstr
    cur *= 2
calc = [0]*len(maxstr)
for i in range(n):
    cur = 1
    temp = len(maxstr)-1
    while L[i] >= cur:
        if L[i]&cur != 0:
            calc[temp] += 1
        cur *= 2
        temp -= 1
ans = 0
cur = 1
for i in range(len(maxstr)):
    ans += cur*calc[len(maxstr)-i-1]*(n-calc[len(maxstr)-i-1])
    ans %= 10**9+7
    cur *= 2
print(ans)


### FIXED CODE ###

n = int(input())
L = list(map(int,input().split()))
t = max(L)
maxstr = ''
cur = 1
while t >= cur:
    if t&cur != 0:
        maxstr = '1'+maxstr
    else:
        maxstr = '0'+maxstr
    cur *= 2
calc = [0]*len(maxstr)
for i in range(n):
    cur = 1
    temp = len(maxstr)-1
    while L[i] >= cur:
        if L[i]&cur != 0:
            calc[temp] += 1
        cur *= 2
        temp -= 1
ans = 0
cur = 1
for i in range(len(maxstr)):
    ans += cur*calc[len(maxstr)-i-1]*(n-calc[len(maxstr)-i-1])
    ans %= 10**9+7
    cur *= 2
print(ans)
### BUGGY CODE ###

import numpy as np
import itertools
import fractions
import re
import math

from collections import Counter
 
def va(first_word, second_word):
    def get_counter(s):
        return Counter(s.upper().replace(' ', ''))
    return get_counter(first_word) == get_counter(second_word)
def resolve():
    N = int(input())
    S = list(input() for _ in range(N))
    count = 0
    for C in itertools.combinations(range(N),2):
        if va(S[C[0]],S[C[1]]) == True:
            count += 1
    print(count)

    
resolve()

### FIXED CODE ###

def resolve():
    N = int(input())
    S = sorted(list(sorted(input()) for _ in range(N)))
    count = 0
    S_dict = {}
    for i in range(N):
        s = str(S[i])
        if s in S_dict:
            tmp =  S_dict[s]
            S_dict[s] = tmp + 1
            count = count + tmp
        else:
            S_dict.setdefault(s,1)
    print(count)

    
resolve()