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

n, m = map(int, input().split())
a = sorted(list(map(int, input().split())), reverse=True)

if n == 1:
    while m > 0:
        a[0] //= 2
        m -= 1
    print(a[0])
    exit()

while m > 0:
    a[0] //= 2
    m -= 1
    if a[0] < a[1]:
        a.sort(reverse = True)
print(sum(a))


### FIXED CODE ###

n, m = map(int, input().split())
a = sorted(list(map(int, input().split())), reverse=True)

if n == 1:
    while m > 0:
        a[0] //= 2
        m -= 1
    print(a[0])
    exit()

while m > 0:
    a.sort(reverse = True)
    mid = a[0] // 2
    i = 0
    while a[i] >= mid:
        if m > 0:
            a[i] //= 2
            m -= 1
            i += 1
        else:
            break
        if i == len(a):
            break
print(sum(a))
### BUGGY CODE ###

#from collections import Counter as coun
from itertools import combinations as comb

import sys
input = sys.stdin.readline

N = int(input())
S = input()

"""
C = coun(S)
ans = C["R"] * C["G"] * C["B"]
"""
ans = S.count("R") * S.count("G") * S.count("B")
for i, j in comb(range(N), 2):
  k = 2 * j - i
  if k < N:
    a, b, c = S[i], S[j], S[k]
    if a == b or b == c or c == a: continue
    ans -= 1
print(ans)


### FIXED CODE ###

import sys
input = sys.stdin.readline

N = int(input())
S = input()

ans = S.count("R") * S.count("G") * S.count("B")
for i in range(N-2):
  for j in range(i+1, N-1):
    k = 2 * j - i
    if k < N:
      A, B, C = S[i], S[j], S[k]
      if A != B and B != C and C != A: ans -= 1

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

N = int(input())
import heapq as h
A = list(map(int, input().split()))


def reverse(x):
    return -x


# use 0 based index
sum_red, sum_blue = [], []

# sum_redを制作
head = A[:N]
h.heapify(head)
sum_red.append(sum(head))
for k in range(N, 2*N):
    h.heappushpop(head, A[k])
    sum_red.append(sum(head))


# sum_blueを制作
# 最大値をpopしてほしいがそれができないのですべて負にすることで擬似的に最大値をpopする
tail = list(map(reverse, A[-N:]))
h.heapify(tail)
sum_blue.append(-sum(tail))
for k in range(2*N-1, N-1, -1):
    h.heappushpop(tail, -A[k])
    sum_blue.append(-sum(tail))

# 逆順に突っ込んでるので反転
sum_blue = sum_blue[::-1]

diff = [r-b for r, b in zip(sum_red, sum_blue)]
print(max(diff))


### FIXED CODE ###

N = int(input())
import heapq as h
A = list(map(int, input().split()))


# use 0 based index
sum_red, sum_blue = [], []

head = A[:N]
tail = [-x for x in A[-N:]]
h.heapify(head)
h.heapify(tail)
sum_red.append(sum(head))
sum_blue.append(-sum(tail))
# keypoint: いちいちsumすると線形時間かかるのでsum_hoge[-1]でアクセスする
for k in range(N, 2*N):
    num_sub = h.heappushpop(head, A[k])
    sum_red.append(sum_red[-1]-num_sub+A[k])
    num_sub = -h.heappushpop(tail, -A[-k-1])
    sum_blue.append(sum_blue[-1]-num_sub+A[-k-1])


print(max([r-b for r, b in zip(sum_red, sum_blue[::-1])]))
### BUGGY CODE ###

import sys
from collections import defaultdict, deque
import bisect
from heapq import *
from math import factorial, ceil, floor
from collections import defaultdict
import itertools
sys.setrecursionlimit(200000)
input = sys.stdin.readline

# N, M, = map(int, input().split())
# N = int(input())
# L = [int(v) for v in input().split()]
# L = [[int(v) for v in input().split()] for _ in range(N)]
# L = [int(input()) for _ in range(N)]
# L = [list(input().strip())  for _ in range(N)]
# S = input().strip()

N, = map(int, input().split())
S = input().strip()

ans = 0
for i in range(1000):
    s = str(i).zfill(3)
    t = 0
    for v in S:
        if s[t] == v:
            t += 1
        if t == 3:
            break
    if t == 3:
        ans += 1
print(ans)

### FIXED CODE ###

import sys
from collections import defaultdict, deque
import bisect
from heapq import *
from math import factorial, ceil, floor
from collections import defaultdict
import itertools
sys.setrecursionlimit(200000)
input = sys.stdin.readline

# N, M, = map(int, input().split())
# N = int(input())
# L = [int(v) for v in input().split()]
# L = [[int(v) for v in input().split()] for _ in range(N)]
# L = [int(input()) for _ in range(N)]
# L = [list(input().strip())  for _ in range(N)]
# S = input().strip()

N, = map(int, input().split())
S = input().strip()

ans = 0
for i in range(1000):
    s = str(i).zfill(3)
    t = 0
    for v in S:
        if s[t] == v:
            t += 1
        if t == 3:
            break
    if t == 3:
        ans += 1
print(ans)
### BUGGY CODE ###

N=int(input())
m=N+1
for i in range(1,N//2+1):
    for j in range(2,N//2+1):
        if i*j==N:
            m=min(m,(i+j))
print(m-2)
 

### FIXED CODE ###

import math
N=int(input())
m=N+1
for j in range(2,int(math.sqrt(N))+1):
    if N%j==0:
        a=j
        b=N//j
        if a>b:
            break
        else:
            m=min(m,(a+b))

print(m-2)
### BUGGY CODE ###

import copy
n = int(input())
x = sorted([list(map(int, input().split())) for i in range(n)])
y = copy.deepcopy(x)

j = 0
while j < len(x)-1:
    if x[j][0]+x[j][1] > x[j+1][0]-x[j+1][1]:
        y.pop(j+1)
        j += 2
        continue
    j += 1

print(len(y))

### FIXED CODE ###

N = int(input())
XL = [list(map(int, input().split())) for i in range(N)]
LR = [[x - l, x + l] for x, l in XL]

LR.sort(key=lambda x: x[1])

ans = 0
prev = -float("INF")
for l, r in LR:
    if prev <= l:
        ans += 1
        prev = r

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

#from numpy import*
#from scipy import*
from collections import* #defaultdict Counter deque appendleft
from fractions import gcd
from functools import* #reduce
from itertools import* #permutations("AB",repeat=2) combinations("AB",2) product("AB",2) groupby
from operator import mul
from bisect import* #bisect_left bisect_right
from heapq import* #heapify heappop heappushpop
from math import factorial
from copy import deepcopy
import sys
input=sys.stdin.readline  #危険！基本オフにしろ！
sys.setrecursionlimit(10**6)

def DIJKSTRA(point,d,n):
    cost      = {node:float("inf") for node in range(n)}
    Q         = []  #頂点のリスト
    cost[point]=0  #開始地点のコストをゼロとする（当たり前
    heappush(Q,(point,cost[point]))
    while Q:
        prefnd,tmpC=heappop(Q)
        if cost[prefnd]<tmpC:
            continue
        for node,c in d[prefnd]:
            altC=c+tmpC
            if cost[node]>altC:
                cost[node]=altC
                heappush(Q,(node,altC))
    return cost

def main():
    k=int(input())
    d=defaultdict(list)
    for i in range(k-1): #１加算をつなぐ
        d[i].append([i+1,1])
    d[k-1].append([0,1])
    for i in range(k):  #10倍をつなぐ
        d[i].append([(i*10)%k,0])
    #print(d)
    
    
    print(DIJKSTRA(1,d,k)[0]+1)

    
    
    
    
if __name__ == '__main__':
    main()

### FIXED CODE ###

#from numpy import*
#from scipy import*
from collections import* #defaultdict Counter deque appendleft
#from fractions import gcd
#from functools import* #reduce
#from itertools import* #permutations("AB",repeat=2) combinations("AB",2) product("AB",2) groupby
#from operator import mul
#from bisect import* #bisect_left bisect_right
from heapq import* #heapify heappop heappushpop
#from math import factorial
#from copy import deepcopy
import sys
input=sys.stdin.readline  #危険！基本オフにしろ！
sys.setrecursionlimit(10**6)

def DIJKSTRA(point,d,n):
    cost      = {node:float("inf") for node in range(n)}
    Q         = []  #頂点のリスト
    cost[point]=0  #開始地点のコストをゼロとする（当たり前
    heappush(Q,(point,cost[point]))
    while Q:
        prefnd,tmpC=heappop(Q)
        if cost[prefnd]<tmpC:
            continue
        for node,c in d[prefnd]:
            altC=c+tmpC
            if cost[node]>altC:
                cost[node]=altC
                heappush(Q,(node,altC))
    return cost

def main():
    k=int(input())
    d=defaultdict(list)
    for i in range(k-1): #１加算をつなぐ
        d[i].append([i+1,1])
    d[k-1].append([0,1])
    for i in range(k):  #10倍をつなぐ
        d[i].append([(i*10)%k,0])
    #print(d)
    
    
    print(DIJKSTRA(1,d,k)[0]+1)

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

from collections import deque
import numpy as np
 
def chk_route(c):
    global H,W,T
    ans=[]
    if c[0] != H-1:
        if T[c[0]+1][c[1]]==0:
            ans+=[c[0]+1,c[1]]
    if c[0] != 0:
        if T[c[0]-1][c[1]]==0:
            ans+=[c[0]-1,c[1]] 
    if c[1] != W-1:
        if T[c[0]][c[1]+1]==0:
            ans+=[c[0],c[1]+1]
 
    if c[1] != 0:
        if T[c[0]][c[1]-1]==0:
            ans+=[c[0],c[1]-1]

    return ans
 
H,W= [int(x) for x in input().split()]
n=[]
T=np.zeros((H,W),dtype=int)

for i in range(H):
  n=input()
  for j in range(W):
    if n[j]=="#": T[i][j]=1
B=T.copy()    
d=0
for i in range(H):
    for j in range(W):
         
        if T[i][j] ==1:continue

        c=deque()    
        s=0
        c.append(i)
        c.append(j)
        T=B.copy()
        t=len(c)//2

        while t>0:
                s+=1
                t=len(c)//2
                for k in range(t):T[c[0+k*2]][c[1+k*2]]=s
                for k in range(t):
                        c += (chk_route([c.popleft(),c.popleft()]))
                
        #print(T)
        d = max(d,s)
         
print(d-2)

### FIXED CODE ###

from collections import deque
import numpy as np
 
 
H,W= [int(x) for x in input().split()]
n=[]
T=np.zeros((H,W),dtype=int)
#T=[]
S=np.zeros_like(T,dtype=int) 
for i in range(H):
  n=input()
  for j in range(W):
    if n[j]=="#": T[i][j]=1
#B=T.copy()    
d=0
c=deque()  
for i in range(H):
    for j in range(W):
         
        if T[i][j] ==1:continue
 
          
        c.append((i,j))
        S[i][j] = 1
        #c.append(j)
        
        #t=len(c)
        while True:

                try:
                  m,n = c.popleft()
                except IndexError: break
                
                
                for kk in [(m+1,n),(m-1,n),(m,n+1),(m,n-1)]:
                  if not (0<=kk[0]<H and 0<= kk[1] <W): continue
                  if T[kk]==1:continue
                  if S[kk] == 0:
                    c.append(kk)
                    S[kk] = S[m][n]+1        
                        
 
        #print(T)
        d = max(d,np.max(S))
        S=np.zeros_like(T,dtype=int)
        
print(d-1)
### BUGGY CODE ###

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

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
l = [0]*n
for i in range(n-1):
    j = a[i]
    l[j-1] += 1
for i in range(n):
    print(l[i])
### BUGGY CODE ###

s=input()
t=input()
l1=len(s)
l2=len(t)
dp=[[0 for _ in range(l1)] for _ in range(l2)]
flg=False
for i in range(l1):
    if flg or t[0]==s[i]:
        flg=True
        dp[0][i]=1
flg=False
for i in range(l2):
    if flg or s[0]==t[i]:
        flg=True
        dp[i][0]=1
for i in range(1,l2):
    for j in range(1,l1):
        if t[i]==s[j]:
            dp[i][j]=dp[i-1][j-1]+1
        else:
            dp[i][j]=max(dp[i-1][j],dp[i][j-1])
ans=''
i=l2-1
j=l1-1
while i>=0 and j>=0:
    if s[j]==t[i]:
        ans+=s[j]
        i-=1
        j-=1
    else:
        if i==0:
            j-=1
        elif j==0:
            i-=1
        elif dp[i-1][j]>dp[i][j-1]:
            i-=1
        else:
            j-=1
print(ans[::-1])

### FIXED CODE ###

s=input()
t=input()
l1=len(s)
l2=len(t)
dp=[[0 for _ in range(l1)] for _ in range(l2)]
flg=False
for i in range(l1):
    if flg or t[0]==s[i]:
        flg=True
        dp[0][i]=1
flg=False
for i in range(l2):
    if flg or s[0]==t[i]:
        flg=True
        dp[i][0]=1
for i in range(1,l2):
    for j in range(1,l1):
        if t[i]==s[j]:
            dp[i][j]=dp[i-1][j-1]+1
        else:
            dp[i][j]=max(dp[i-1][j],dp[i][j-1])
ans=''
i=l2-1
j=l1-1
while i>=0 and j>=0:
    if s[j]==t[i]:
        ans+=s[j]
        i-=1
        j-=1
    else:
        if i==0:
            j-=1
        elif j==0:
            i-=1
        elif dp[i-1][j]>dp[i][j-1]:
            i-=1
        else:
            j-=1
print(ans[::-1])
### BUGGY CODE ###


def binary_search(list, item):

    if len(list) == 0 or item > list[-1]:
        return -1

    list2 = [1001] + list + [0]

    low = 0
    high = len(list2) - 1

    while low <= high:
        mid = (low + high) // 2
        bigger = list2[mid]
        smaller = list2[mid+1]

        if smaller <= item and item < bigger:
            return mid - 1

        if smaller > item:
            low = mid + 1

        else:
            high = mid - 1


N = int(input())
L = list(map(int, input().split(' ')))

L = sorted(L, reverse=True)


result = 0
for i, a in enumerate(L):
    for j, b in enumerate(L[i+1::]):
        k = binary_search(L[i+j+2::], a-b)

        result += k + 1


print(result)


### FIXED CODE ###

from bisect import bisect_left

N = int(input())
L = list(map(lambda l: int(l)*(-1), input().split()))
L.sort()

result = 0
for i, a in enumerate(L[:-2:]):
    for ii, b in enumerate(L[i+1:-1:]):
        c_list = L[i+ii+2::]
        c_index = bisect_left(c_list, a-b)
        result += c_index

print(result)
### BUGGY CODE ###

H, W, M = map(int, input().split())
bomb = [0] * M
H_list = [0] * H
W_list = [0] * W
for i in range(M):
  h, w = map(int, input().split()) 
  bomb[i] = [h - 1, w - 1]
  H_list[h - 1] += 1
  W_list[w - 1] += 1
  
#print(HW, H_list, W_list)  
H_max = max(H_list)
W_max = max(W_list)
H_index = []
W_index = []
for i in range(H):
  if H_list[i] == H_max:
    H_index.append(i)
    
for i in range(W):
  if W_list[i] == W_max:
    W_index.append(i)
    

x = 1
for i in H_index:
  for j in W_index:
    if [i, j] not in bomb:
      x = 0
      
print(H_max + W_max - x)      
    
    
    
    






### FIXED CODE ###

H, W, M = map(int, input().split())
bomb = [0] * M
H_list = [0] * H
W_list = [0] * W
for i in range(M):
  h, w = map(int, input().split()) 
  bomb[i] = [h - 1, w - 1]
  H_list[h - 1] += 1
  W_list[w - 1] += 1
  
#print(HW, H_list, W_list)  
H_max = max(H_list)
W_max = max(W_list)
H_count = H_list.count(H_max)
W_count = W_list.count(W_max)
HW_max = H_max + W_max

count = 0
for i, j in bomb:
  if H_list[i] + W_list[j] == HW_max:
    count += 1
    
if count == H_count * W_count:
  x = 1
else:
  x = 0
  
print(HW_max - x)
### BUGGY CODE ###

n = int(raw_input())
A = map(int, raw_input().split())
d = {}
def soleve(i, m):
    if (i, m) in d.keys():
        return d[(i, m)]
    if m == 0:
        return True
    if i >= n:
        return False
    a = soleve(i + 1, m)
    d[(i+1, m)] = a
    b = soleve(i + 1, m - A[i])
    d[(i+1, m-A[i])] = b
    return a or b


q = int(raw_input())
M = map(int, raw_input().split())
for m in M:
    if soleve(0, m):
        print 'yes'
    else:
        print 'no'

### FIXED CODE ###

n = int(raw_input())
A = map(int, raw_input().split())
d = {}

def soleve(i, m, n):
    if m == 0:
        return True
    if i >= n:
        return False
    if d.has_key((i, m)):
        return d[(i, m)]
    res = soleve(i + 1, m, n) or soleve(i + 1, m - A[i], n)
    d[(i, m)] = res
    return res


q = int(raw_input())
M = map(int, raw_input().split())
for m in M:
    if soleve(0, m, n):
        print 'yes'
    else:
        print 'no'
### BUGGY CODE ###

N = int(input())
List_S = [""]
for i in range(N):
  S = input()
  if S not in List_S:
    List_S.append(S)
    
print(len(List_S)-1)

### FIXED CODE ###

N = int(input())
List_S = [input() for i in range(N)]
print(len(set(List_S)))
### BUGGY CODE ###

N = int(input())
l = list(map(int,input().split()))
#print(l,l[:1],l[1:])
ans = []
for i in range(1,N):
  #print(sum(l[:i]),sum(l[i:]))
  dif = abs(sum(l[:i])-sum(l[i:]))
  ans.append(dif)

print(min(ans))

### FIXED CODE ###

N = int(input())
l = list(map(int,input().split()))
ans = 100000000000000
x = 0
S = sum(l)
for i in range(N-1):
  #print("l["+str(i)+"]="+str(l[0]))
  x = x + l[i]
  #print(x,S-x)
  ans = min(ans, abs(x - (S - x)))
  #print(ans)
print(ans)
### BUGGY CODE ###

h,w=map(int,input().split())
a=[list(input()) for i in range(h)]
for i in range(h):
    for j in range(w):
        if a[i][j]==".":
            a[i][j]=99999
ans=0
import collections
from copy import deepcopy
direction=[[0,1],[0,-1],[1,0],[-1,0]]
for sh in range(h):
    for sw in range(w):
        tmp=0
        if a[sh][sw]==99999:
            field=deepcopy(a)
            field[sh][sw]=0
            completed=[]
            next_list=collections.deque([[sh,sw]])
            while next_list:
                n=next_list.popleft()
                completed.append(n)
                for dx,dy in direction:
                    ny,nx=n[0]+dy,n[1]+dx
                    if 0<=ny<=h-1 and 0<=nx<=w-1 and field[ny][nx]!="#" and [ny,nx] not in completed:
                        field[ny][nx]=min(field[n[0]][n[1]]+1,field[ny][nx])
                        next_list.append([ny,nx])
            for i in range(h):
                for j in range(w):
                    if field[i][j]!="#":
                        tmp=max(tmp,field[i][j])
            ans=max(ans,tmp)
print(ans)
            

### FIXED CODE ###

h,w=map(int,input().split())
field=[list(input())for i in range(h)]

import copy
dp=[[1000 for i in range(w)]for i in range(h)]
for y,i in enumerate(field):
    for x,j in enumerate(i):
        if j=="#":
            dp[y][x]=9999

dydx=[[-1,0],[1,0],[0,-1],[0,1]]
#print(dp)
maxi=0
for y,i in enumerate(field):
    for x,j in enumerate(i):
        if j==".":
            ndp=copy.deepcopy(dp)
            ndp[y][x]=0
            cnt=0
            queue=[]
            queue.append([y,x])
            while queue:
                ny,nx=queue.pop(0)
                for dy,dx in dydx:
                    nny,nnx=ny+dy,nx+dx
                    if 0<=nny<=h-1 and 0<=nnx<=w-1 and field[nny][nnx]!="#" and ndp[nny][nnx]==1000:
                        ndp[nny][nnx]=ndp[ny][nx]+1
                        queue.append([nny,nnx])
                        if ndp[nny][nnx]>maxi:
                            maxi=ndp[nny][nnx]
            #print(ndp)
print(maxi)
### BUGGY CODE ###

L, R = (int(i) for i in input().split())

if (R - L) <= 2019:
    temp1 = float("inf")
    for i in range(R - L):
        for j in range(R - L):
            temp2 = ((R-i) * (R - 1 -j)) % 2019
            if temp2 < temp1:
                temp1 = temp2
    print(temp1)
else:
    temp1 = float("inf")
    for i in range(2019):
        if (R-i-1) < L:
            break
        for j in range(R - L):
            temp2 = ((R - i) * (R - 1 - j)) % 2019
            if temp2 < temp1:
                temp1 = temp2
    print(temp1)

### FIXED CODE ###

L, R = (int(i) for i in input().split())

if (R - L) <= 2019:
    temp1 = float("inf")
    for i in range(R - L):
        for j in range(R - L):
            temp2 = ((R-i) * (R - 1 -j)) % 2019
            if temp2 < temp1:
                temp1 = temp2
    print(temp1)
else:
    temp1 = float("inf")
    for i in range(2019):
        if (R-i-1) < L:
            break
        for j in range(2019):
            temp2 = ((R - i) * (R - 1 - j)) % 2019
            if temp2 < temp1:
                temp1 = temp2
    print(temp1)
### BUGGY CODE ###

import sys
import copy
input = sys.stdin.readline

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

x=sum(A)
import math
xr=math.ceil(math.sqrt(x))

LIST=[]
for i in range(1,xr+1):
    if x%i==0:
        LIST.append(i)
        LIST.append(x//i)


MIN=0
MAX=sum(A)
ANS=1
A.sort()

for l in LIST:
    count=0

    B=[a%l for a in A]
    B.sort()

    i=0
    j=N-1

    for i in range(N):
        if B[i]%l==0:
            continue
        else:
            count_temp=0
            while B[i]%l!=0:
                B[i]-=1
                count_temp+=1

            for t in range(count_temp):
                while B[j]%l==0:
                    j-=1
                B[j]+=1

        count+=count_temp


    if count<=K:
        ANS=max(ANS,l)

print(ANS)


### FIXED CODE ###

import sys
input = sys.stdin.readline

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

x=sum(A)
import math
xr=math.ceil(math.sqrt(x))

LIST=[]
for i in range(1,xr+1):
    if x%i==0:
        LIST.append(i)
        LIST.append(x//i)

ANS=1

for l in LIST:
    count=0

    B=[a%l for a in A]
    B.sort()

    i=0
    j=N-1

    for i in range(N):
        if B[i]%l==0:
            continue
        else:
            count_temp=B[i]
            count+=count_temp
            B[i]=0

            while count_temp:
                while B[j]%l==0:
                    j-=1
                MINUS=min(count_temp,l-B[j])
                B[j]+=MINUS
                count_temp-=MINUS

    if count<=K:
        ANS=max(ANS,l)

print(ANS)
### BUGGY CODE ###

n = int(input())
x = input()

x0 = int('0b'+x,0)

ceil = 2*10**5+2
ppc = [0]*(ceil)

def popcount(n):    
  if n == 0:
    return 0
  if ppc[n] != 0:
    return ppc[n]
    
  b = bin(n).count('1')  
  tmp = n%b
  ppc[n] = popcount(tmp) + 1
  return ppc[n]

c1 = bin(x0).count('1')  
for i in range(n):
  p = 2 ** (n - i - 1)
  if x[i] == '1':    
    tmp = x0 - p
    if c1-1 == 0:
      tmp = 0
    else:
      tmp2 = tmp % (c1 - 1)
  else:
    tmp = x0 + p  
    tmp2 = tmp % (c1 + 1)
    
  if tmp > ceil:      
    print(popcount(tmp2)+1)
  else:
    print(popcount(tmp))

### FIXED CODE ###

n = int(input())
X = input()

def goes_to_zero(n):
  cnt = 0
  while(n > 0):
    n %= bin(n).count('1')
    cnt += 1
  return cnt
  
c1 = X.count('1')
xint = int(X,2)
xtp = xint % (c1 + 1)
if (c1 - 1) == 0:  
  xtm = 0
else:
  xtm = xint % (c1 - 1)
  
for i in range(n)  :
  if X[i] == '0':
    print(goes_to_zero( (xtp + pow(2,n-1-i,(c1+1))) % (c1+1) ) + 1)
  else:
    if (c1-1) == 0:
      print(0)
    else:
      print(goes_to_zero( (xtm - pow(2,n-1-i,(c1-1)) ) % (c1-1) ) +1)
### BUGGY CODE ###

import string
import collections

n = int(input())
ans=[]
for i in range(n):
  s=input()
  c = collections.Counter(s)
  ans.append("".join(map(str,[c[i] for i in string.ascii_lowercase])))

c2 = collections.Counter(ans)
cnt=0
for k, v in c2.items():
  cnt+=(v-1)*v//2

print(cnt)

### FIXED CODE ###

import string
import collections

n = int(input())
ans=[]
for i in range(n):
  s=input()
  c = collections.Counter(s)
  ans.append("".join(map(str,[c[i] for i in string.ascii_lowercase])))

c2 = collections.Counter(ans)
cnt=0
for k, v in c2.items():
  cnt+=(v-1)*v//2

print(cnt)