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

from collections import Counter
n = int(input())
a_input = list(map(int,input().split()))

a_count = Counter(a_input)

score_li = [0]*len(a_count)
exclude_li = [0]*len(a_count)

for i in range(n):
    tmp=0
    for k,v in a_count.items():
        if a_input[i]==k:
            tmp+=(v-1)*(v-2)//2
        else:
            tmp+=v*(v-1)//2
    print(tmp)


### FIXED CODE ###

from collections import Counter
n = int(input())
a_input = list(map(int,input().split()))

a_count = Counter(a_input)

score_dic={}
exclude_dic={}

for k,v in a_count.items():
    score_dic[k]=v*(v-1)//2
    exclude_dic[k]=(v-1)*(v-2)//2

score_sum = sum(score_dic.values())

for i in range(n):
    print(score_sum-score_dic[a_input[i]]+exclude_dic[a_input[i]])
### BUGGY CODE ###

def main():
    s = input()
    k = int(input())
    l = set()
    ls = len(s)
    clist = sorted(list(set(list(s))))
    for i in clist:
        x = []
        for j in range(ls):
            if i == s[j]:
                x.append(j)
        for j in range(len(x)):
            idx = x[j]
            l.add(s[idx])
            xxx = s[idx]
            for t in range(idx+1,ls):
                xxx = xxx +s[t]
                l.add(xxx)
        if len(l) >= k:
            l = list(l)
            print(sorted(l)[k-1])
            break
    
if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    s = input()
    k = int(input())
    l = set()
    ls = len(s)
    clist = sorted(list(set(list(s))))
    ladd = l.add
    for i in clist:
        x = []
        for j in range(ls):
            if i == s[j]:
                x.append(j)
        ladd(i)
        for j in range(len(x)):
            idx = x[j]
            xxx = s[idx]
            c = 0
            for t in range(idx+1,ls):
                xxx = xxx +s[t]
                ladd(xxx)
                c += 1
                if c > k:
                    break
        if len(l) >= k:
            l = list(l)
            print(sorted(l)[k-1])
            break
    
if __name__ == '__main__':
    main()
### BUGGY CODE ###

N=int(input())
S=list(input())
ans=0
for i in range(N):
    for j in range(i+1,N):
        if S[i]==S[j]:
            continue
        if j+(j-i)<N:
            s=S[j+(j-i)]
            S[j+(j-i)]="O"
        if i-(j-i)>=0:
            s1=S[i-(j-i)]
            S[i-(j-i)]="O"
        S2="".join(S)
        if (S[i]=="R" and S[j]=="G") or (S[i]=="G" and S[j]=="R"):
            ans+=S2.count("B",j+1,N)
        if (S[i]=="R" and S[j]=="B") or (S[i]=="B" and S[j]=="R"):
            ans+=S2.count("G",j+1,N)
        if (S[i]=="B" and S[j]=="G") or (S[i]=="G" and S[j]=="B"):
            ans+=S2.count("R",j+1,N)
        if j+(j-i)<N:
            S[j+(j-i)]=s
        if i-(j-i)>=0:
            S[i-(j-i)]=s1
print(ans)

### FIXED CODE ###

N=int(input())
S=input()
totalPattern = S.count("R")*S.count("G")*S.count("B")
for i in range(N-1):
    for j in range(i+1,N):
        k=j+(j-i)
        if k>N-1:
            continue
        if not S[i] == S[j] and not S[i] == S[k] and not S[j] == S[k]:
            totalPattern-=1
print(totalPattern)
### BUGGY CODE ###

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

a=[]
b=[]
for i in range(n):
    a.append([0]*(n))
    b.append([0]*(n))

import numpy as np
b=np.array(b)
#print(a)
for i in range(m):
    l,r=map(int,input().split())
    #print(a[(r-1):n,0:l])
    a[r-1][l-1]+=1

for l in range(n):
    for r in range(l,n):
        temp=a[r][l]
        b[r:n,0:l+1]+=temp

#print(a)
#print(b)

for i in range(q):
    P,Q=map(int,input().split())
    print(b[(Q-1),(P-1)])

### FIXED CODE ###

from itertools import accumulate
from operator import add, mul
n,m,q=map(int,input().split())

a=[]
b=[]
for i in range(n):
    a.append([0]*(n))
    b.append([0]*(n))

#import numpy as np
#b=np.array(b)
#print(a)
'''
for i in range(m):
    l,r=map(int,input().split())
    #print(a[(r-1):n,0:l])
    #a[(r-1):n,0:l]+=1
    for j in range(r-1,n):
        for k in range(l):
            a[j][k]+=1
'''
for i in range(m):
    l,r=map(int,input().split())
    #print(a[(r-1):n,0:l])
    a[l-1][r-1]+=1

#print(a)

for i in range(n):
    a[i]=list(accumulate(a[i]))

#print(a)

for i in range(n):
    for j in range(n-i-1):
        a[n-i-j-2][n-i-1]+=a[n-i-j-1][n-i-1]
        #print(a)

#print(a)

'''
for l in range(n):
    for r in range(l,n):
        temp=a[r][l]
        for i in range(r,n):
            for j in range(0,l+1):
                b[i][j]+=temp
        #b[r:n,0:l+1]+=temp
'''
#print(a)
#print(b)

for i in range(q):
    P,Q=map(int,input().split())
    print(a[(P-1)][(Q-1)])
'''
for i in range(que):
    p,q=MI()
    if p==1:
        ans=lis[q-1][q-1]
    else:
        ans=lis[q-1][q-1]-lis[p-2][q-1]
    print(ans)
'''
### BUGGY CODE ###

a, b = map(int, input().split())
divisor = []
upper = min(a, b)//2+1
if a%2 and b%2:
    for i in range(3, upper, 2):
        divable = False
        if a % i == 0 and b % i == 0:
            for j in range(len(divisor)):
                if i % divisor[j] == 0:
                    divable = True
                    break
            if not divable:
                divisor.append(i)
else:
    for i in range(2, upper):
        divable = False
        if a % i == 0 and b % i == 0:
            for j in range(len(divisor)):
                if i % divisor[j] == 0:
                    divable = True
                    break
            if not divable:
                divisor.append(i)
print(len(divisor)+1)

### FIXED CODE ###

a, b = map(int, input().split())
def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x%y)
n = gcd(a, b)
ndiv = n
if n == 1:
    print(1)
else:
    i = 1
    primecount = 0
    divisor = False
    while True:
        i += 1
        while ndiv%i == 0:
            ndiv = ndiv//i
            divisor = True
        if divisor:
            primecount += 1
            divisor = False
            if ndiv == 1:
                break
        if ndiv != 1 and i*i > n:
            primecount += 1
            break
    print(primecount+1)
### BUGGY CODE ###

k,m=map(int,input().split())
ans=set(range(1,k+1))
for i in range(m):
  f=list(map(int,input().split()))
  ans&=set(range(f[0],f[1]+1))
print(len(ans))

### FIXED CODE ###

k,m=map(int,input().split())
l=[0 for i in range(k+1)]
for i in range(m):
  a,s=map(int,input().split())
  l[a-1]+=1;l[s]-=1
ans=0
f=0
for j in range(k):
  l[j]+=f
  f=l[j]
print(len([1 for i in l if i==m]))
### BUGGY CODE ###

N=int(input())
a= list(map(int, input().split()))
a.sort()
b=[None]*N
b[0]=a[0]
A=0
for i in range(1,N):
  b[1]=a[i]
  for j in range(2,N):
    b[j]=b[j-1]^b[j-2]
  b.sort()
  if a==b:
    A=1
    break
if A==1:
  print("Yes")
else:
  print("No")


### FIXED CODE ###

N=int(input())
a=list(map(int,input().split()))
t=0
for i in a:
    t=t^i
print("No" if t else "Yes")
### BUGGY CODE ###

x,y,a,b,c = map(int, input().split())
p=sorted(list(map(int, input().split())), reverse=True)
q=sorted(list(map(int, input().split())), reverse=True)
r=sorted(list(map(int, input().split())), reverse=True)
result = []
for el in p[:x]:
    result.append(el)
for el in q[:y]:
    result.append(el)
for el in r:
    temp = min(result)
    if el > temp:
        result.remove(temp)
        result.append(el)
print(sum(result))


### FIXED CODE ###

x, y, a, b, c = map(int, input().split())
p = sorted(list(map(int, input().split())), reverse=True)
q = sorted(list(map(int, input().split())), reverse=True)
r = sorted(list(map(int, input().split())), reverse=True)
result = p[:x] + q[:y] + r
result = sorted(result, reverse=True)
print(sum(result[:x+y]))
### BUGGY CODE ###

import numpy as np
from collections import deque
N, M = list(map(int, input().split()))
A = []
B = []
for _ in range(N):
    a, b = list(map(int, input().split()))
    A.append(a)
    B.append(b)
C = zip(A,B)
C = sorted(C)
A, B = zip(*C)
A = deque(A)
B = deque(B)
Q = np.array([])
ans = 0
for m in range(1, M+1):
    while len(A)>0:
        a = A.popleft()
        b = B.popleft()
        if a <= m:
            Q = np.append(Q, b)
        else:
            A.appendleft(a)
            B.appendleft(b)
            break
    if Q.size:
        ans += np.max(Q)
        Q = np.delete(Q, np.argmax(Q))
print(int(ans))



### FIXED CODE ###

from collections import defaultdict
from heapq import heappush, heappop

N, M = list(map(int, input().split()))
jobs = defaultdict(list)
heap = []
ans = 0
for _ in range(N):
    a, b = list(map(int, input().split()))
    if a <= M:
        jobs[a].append(b)

for m in range(1, M+1):
    for b in jobs[m]:
        heappush(heap, -b)
    if heap:
        maxb = -heappop(heap)
        ans += maxb
print(ans)
### BUGGY CODE ###

N = int(input())
A = [int(x) for x in input().split()]
Base1 = 0
Base2 = 0
for x in range(N):
    if x % 2 == 0:
        Base1 += A[x]
        Base2 -= A[x]
    else:
        Base1 -= A[x]
        Base2 += A[x]

for i in range(N):
    if i % 2 == 0:
        tmp1 = Base1
        for j in range(i):
            if j % 2 == 0:
                tmp1 -= 2*A[j]
            else:
                tmp1 += 2*A[j]
        print(tmp1)
    if i % 2 == 1:
        tmp2 = Base2
        for j in range(i):
            if j % 2 == 0:
                tmp2 += 2*A[j]
            else:
                tmp2 -= 2*A[j]

        print(tmp2)

### FIXED CODE ###

N = int(input())
A = [int(x) for x in input().split()]
Base1 = 0
Base2 = 0
a = []
for x in range(N):
    if x % 2 == 0:
        Base1 += A[x]
        Base2 -= A[x]
    else:
        Base1 -= A[x]
        Base2 += A[x]

for i in range(N):
    if i % 2 == 0:
        tmp1 = Base1
        if i >= 2:
            a.append(a[i-2]-A[i-2]*2+A[i-1]*2)
            print(a[i])
        else:
            a.append(Base1)
            print(a[i])
    if i % 2 == 1:
        tmp2 = Base2
        if i >= 2:
            a.append(a[i-2]-A[i-2]*2+A[i-1]*2)
            print(a[i])
        else:
            a.append(Base2+A[i-1]*2)
            print(a[i])
### BUGGY CODE ###

import random
from collections import defaultdict


def read():
    N = int(input().strip())
    S = input().strip()
    return N, S


def solve(N, S):
    low = 0
    high = (N >> 1) + 1
    while high - low > 1:
        mid = (high + low) >> 1
        is_match = False
        m = N-mid-mid+1
        for i in range(0, m):
            if S[i:i+mid] in S[i+mid:]:
                is_match = True
                break
        if is_match:
            low = mid
        else:
            high = mid
    return low


if __name__ == '__main__':
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("%s" % str(outputs))

### FIXED CODE ###

import random
from collections import defaultdict


class RollingHash():

    def __init__(self, S, b=3491, m=999999937):
        """任意の基数と法でハッシュを生成する"""
        n = len(S)
        self.prefix = prefix = [0] * (n+1)
        self.power = power = [1] * (n+1)
        self.b = b
        self.m = m
        for i in range(n):
            c = ord(S[i])
            prefix[i+1] = (prefix[i] * b + c) % m
            power[i+1] = (power[i] * b) % m
    
    def get(self, l, r):
        """S[l, r) のハッシュを求める"""
        return (self.prefix[r] - self.power[r-l] * self.prefix[l]) % self.m
    
    def concat(self, h1, h2, l2):
        """S1+S2 のハッシュを、それぞれのハッシュから求める"""
        return (self.power[l2] * h1 + h2) % self.m
    
    def lcp(self, l1, r1, l2, r2):
        """S[l1, r1) とS[l2, r2) の最大共通接頭辞を求める"""
        low = 0
        high = min(r1-l1, r2-l2) + 1
        while high - low > 1:
            mid = (high + low) // 2
            if self.get(l1, l1 + mid) == self.get(l2, l2 + mid):
                low = mid
            else:
                high = mid
        return low


def read():
    N = int(input().strip())
    S = input().strip()
    return N, S


def solve(N, S):
    ans = []
    for m in [999999937, 10**9+7]:
        b = random.randint(10000, m-1)
        rh = RollingHash(S, b=b, m=m)
        low = 0
        high = (N+1) // 2 + 1
        dmax = defaultdict(int)
        dmin = defaultdict(int)
        while high - low > 1:
            dmax.clear()
            dmin.clear()
            mid = (high + low) // 2
            for i in range(0, N-mid+1):
                h = rh.get(i, i+mid)
                dmax[h] = max(dmax[h], i+1)
                dmin[h] = max(dmin[h], N+1-i)
            is_match = False
            for h in dmax.keys():
                if dmax[h] - (N+2 - dmin[h]) >= mid:
                    is_match = True
                    break
            if is_match:
                low = mid
            else:
                high = mid
        ans.append(low)
    return min(ans)


if __name__ == '__main__':
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("%s" % str(outputs))
### BUGGY CODE ###

N = input() 
heights = input()

N = int(N)
heights = list(map(int, heights.split(' ')))

def solve_problem(N, heights):
    memory = {}

    def minimum_cost(N, heights):
        mem_key = str(N) + str(heights)
        if mem_key in memory: return memory[mem_key]
        if N == 1:
            return 0
        elif N == 2:
            return abs(heights[0] - heights[1])

        jump_one_cost = abs(heights[0] - heights[1]) + minimum_cost(N-1, heights[1:])
        jump_two_cost = abs(heights[0] - heights[2]) + minimum_cost(N-2, heights[2:])

        best_cost = min(jump_one_cost, jump_two_cost)
        memory[mem_key] = best_cost
        return best_cost
    
    return minimum_cost(N, heights)

print(solve_problem(N, heights))


### FIXED CODE ###

N = input() 
heights = input()

N = int(N)
heights = list(map(int, heights.split(' ')))

def solve_problem_dp(N, heights):
    if N == 1:
        return 0
    elif N == 2:
        return abs(heights[0] - heights[1])
    costs = [0] * len(heights)
    costs[1] = abs(heights[0] - heights[1])

    for i in range(2, len(heights)):
        cost_jump1 = abs(heights[i] - heights[i-1]) + costs[i-1]
        cost_jump2 = abs(heights[i] - heights[i-2]) + costs[i-2] 
        best_cost = min(cost_jump1, cost_jump2)
        costs[i] = best_cost
    
    return costs[-1]


print(solve_problem_dp(N, heights))
### BUGGY CODE ###

def Is(): return map(int, input().split())  # '123 456' -> 123, 456
def LI(): return list(map(int, input().split()))  # '123 456' -> [123, 456]


N, M = Is()
H = LI()
AB = [[0]*N for _ in range(N)]
for i in range(M):
    a, b = Is()
    a -= 1
    b -= 1
    AB[a][b] = H[b]
    AB[b][a] = H[a]

ans = 0
notgood = [False]*N

# print(AB)

for i in range(N):
    if notgood[i]:
        continue
    if max(AB[i]) < H[i]:
        ans += 1
        for j in range(N):
            if AB[i][j] != 0:
                notgood[j] = True

print(ans)

### FIXED CODE ###

def Is(): return map(int, input().split())  # '123 456' -> 123, 456
def LI(): return list(map(int, input().split()))  # '123 456' -> [123, 456]


N, M = Is()
H = LI()
AB = [set() for _ in range(N)]
for i in range(M):
    a, b = Is()
    a -= 1
    b -= 1
    AB[a].add(b)
    AB[b].add(a)

ans = 0
notgood = [False]*N

# print(AB)

for i in range(N):
    # print("{} start".format(i))
    # print(AB[i])
    if notgood[i]:
        continue
    if len(AB[i]) == 0:
        ans += 1
        continue
    for x in AB[i]:
        # print(H[x], H[i])
        if H[x] > H[i]:
            notgood[i] = True
            break
        elif H[x] == H[i]:
            notgood[x] = True
            notgood[i] = True
            break
        else:
            notgood[x] = True
    else:
        ans += 1
        # print("{} is GOOD!!!".format(i))

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

N = int(input())
unique_string = []
ans = 0

for _ in range(N):
    s = "".join(sorted(input()))
    ans += unique_string.count(s)
    unique_string.append(s)

print(ans)

### FIXED CODE ###

N = int(input())
unique_string = {}
ans = 0

for _ in range(N):
    s = "".join(sorted(input()))
    try:
        ans += unique_string[s]
        unique_string[s] += 1
    except KeyError:
        unique_string[s] = 1

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

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

ans = [0] * len(A)

for i in A:
    ans[i - 1] = A.index(i) + 1

print(*ans)


### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
ans = [0] * N

for i in range(1, N + 1):
    ans[A[i - 1] - 1] = i

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

N = int(input())

power = 1
#power = float(power)

for i in range(N):
    power = power * (i + 1)

power = power % (1000000000+7)
print(power)


### FIXED CODE ###

N = int(input())
power = 1
for i in range(N):
    power = (i+1) * (power % 1000000007)

print(power%1000000007)
### BUGGY CODE ###




c, d = (int(i) for i in input().split())  
a = [int(i) for i in input().split()]
b = a.copy()

k = 0
for i in a:
    b[k] = abs(i - d)
    k += 1

m = min(b) 

def dec():

    i = m
    while i > 0:
        if m% i == 0: 
            k = 0
            for j in b:
                if j%i ==0:
                    k +=1
                if k==len(b):
                    return i
                
        i -=1




                
print(dec())



### FIXED CODE ###

c, d = (int(i) for i in input().split())  
a = [int(i) for i in input().split()]
b = a.copy()
 
k = 0
for i in a:
    b[k] = abs(i - d)
    k += 1
 
m = min(b) 
 
def dec():
 
    i = m
    while i > 0:
        if m% i == 0: 
            k = 0
            for j in b:
                if j%i ==0:
                    k +=1
                if k==len(b):
                    return i
                
            if i == m:
                i -= i//2
                
        i -=1
 
 
 
 
                
print(dec())
### BUGGY CODE ###

import collections
import sys
input = sys.stdin.readline

q = int(input())
a = [input().rstrip() for _ in range(q)]

dic = collections.Counter(a)

keys = [k for k, v in dic.items() if v == max(dic.values())]
keys_s = sorted(keys)
for i in keys_s:
    print(i)


### FIXED CODE ###

import collections
import sys
input = sys.stdin.readline

q = int(input())
a = [input().rstrip() for _ in range(q)]

dic = collections.Counter(a)

ma = max(dic.values())
keys = [k for k, v in dic.items() if v == ma]
keys_s = sorted(keys)
for i in keys_s:
    print(i)
### BUGGY CODE ###

import math

def isprime(number):
    for i in range(2, number):
        if number % i == 0:
            return False
    return True

A, B = map(int, input().split())
count = 1

if B < A:
    C = B
    B = A
    A = C
# A <= B

for i in range(2, A + 11):
    if A % i == 0:
        if B % i == 0:
            if isprime(i):
                count += 1

print(str(count))


### FIXED CODE ###

from fractions import gcd
def f(n):
    tmp = n
    cnt = 0
    i = 2
    while i <= n**0.5 + 1:
        if tmp < i:
            break
        if tmp % i == 0:
            cnt += 1
            while tmp % i == 0:
                tmp //= i
        i += 1
    if tmp != 1:
        cnt += 1
    return cnt

A, B = map(int, input().split())
g = gcd(A, B)
ans = f(g) + 1
print(ans)
### BUGGY CODE ###

import numpy as np


def func(cnt, cn):
    tmp = np.zeros(13, dtype=np.int64)
    tmp[cn:13] = cnt[0:13-cn]
    tmp[0:cn] = cnt[13-cn:13]
    return tmp


MOD = 10**9+7

s = list(input())
s.reverse()

cnt = np.zeros(13, dtype=np.int64)
cnt[0] = 1
t = 1
for ci in range(len(s)):
    t %= 13 
    if s[ci] != '?':
        cn = int(s[ci]) * t % 13
        cnt = func(cnt, cn)
    else:
        tmp = np.zeros(13, dtype=np.int64)
        for cj in range(10):
            cn = cj * t % 13
            tmp += func(cnt, cn)
            tmp %= MOD
        cnt = tmp
    t *= 10
print(cnt[5])

### FIXED CODE ###

def func(cnt, cn):
    tmp = [0] * 13
    for i in range(13):
        nn = (cn + i) % 13
        tmp[nn] = cnt[i]
    return tmp


MOD = 10**9+7

s = list(input())
s.reverse()

cnt = [0]*13
cnt[0] = 1
t = 1
for ci in range(len(s)):
    t %= 13 
    if s[ci] != '?':
        cn = int(s[ci]) * t % 13
        cnt = func(cnt, cn)
    else:
        tmp = [0]*13
        add = [0]*13
        for cj in range(10):
            cn = cj * t % 13
            add = func(cnt, cn)
            for _ in range(13):
                tmp[_] += add[_]
                tmp[_] %= MOD
        cnt = tmp
    t *= 10
print(cnt[5])
### BUGGY CODE ###

#D - String Formation
S = list(str(input()))
Q = int(input())
q = [input().split() for i in range(Q)]

#print(S)
#print(q)

for i in range(Q):
    tmp1 = ""
    if q[i][0] == '1':
        S.reverse()
       # tmp1 = S[0]
       # S[0] = S[-1]
       # S[-1] = tmp1
    else:
        if q[i][1] == "1":
            S.insert(0,q[i][2])
        else:
            S.append(q[i][2])
ans = ''.join(S)
print(ans)

### FIXED CODE ###

#D - String Formation
S=input()
Q=int(input())
query=[]
for _ in range(Q):
    query.append(input().split())

flag = True
t=""
u=""

for i in query:
    if i[0]=="1":
        u,t=t,u
        flag = not flag
#        S=S[::-1]
    else:
        if i[1]=="1":
            t+=i[2]
        else:
            u+=i[2]
if flag:
    print(t[::-1]+S+u)
else:
    print(t[::-1]+S[::-1]+u)
### BUGGY CODE ###

h,w,d = map(int,input().split())
n2c = {i:None for i in range(1, h*w+1)}
for i in range(h):
    i += 1
    for j,v in enumerate(input().split()):
        j = j + 1
        v = int(v)
        n2c[v] = (i,j)


def c(x1,y1,x2,y2):
    return abs(x1-x2) + abs(y1-y2)

q = int(input())
for i in range(q):
    cost = 0
    l,r = map(int, input().split())
    lt = range(l,r+1,d)
    l = list(map(lambda x:n2c[x], lt))
    for i in range(len(l)-1):
        x1,y1 = l[i]
        x2,y2 = l[i+1]
        cost += c(x1,y1,x2,y2)
    print(cost) 

### FIXED CODE ###

h,w,d = map(int,input().split())
n2c = {i:None for i in range(1, h*w+1)}
D = [0] * (h * w + 1)
for i in range(h):
    i += 1
    for j,v in enumerate(input().split()):
        j = j + 1
        v = int(v)
        n2c[v] = (i,j)

for i in range(d+1, h*w+1):
    D[i] = D[i - d] + abs(n2c[i][0] - n2c[i-d][0]) + abs(n2c[i][1] - n2c[i-d][1])

def c(x1,y1,x2,y2):
    return abs(x1-x2) + abs(y1-y2)

q = int(input())
for i in range(q):
    l,r = map(int, input().split())
    print(D[r] - D[l])
### BUGGY CODE ###

N = int(input())
A =[int(x) for x in input().split()]
ans = []

for i in range(N):
  for j in range(N):
    if i+1 == A[j]:
      ans.append(str(j+1))
      break;
L = ' '.join(ans)
print(L)


### FIXED CODE ###

N = int(input())
A =[int(x) for x in input().split()]
ans = [0]*N

for i in range(N):
  ans[A[i]-1] = i+1
  
print(*ans)
### BUGGY CODE ###

import math
import collections
from operator import mul
from functools import reduce
import bisect

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

s=input()
k=int(input())
a=[]
for i in range(len(s)):
    for j in range(i+1,len(s)+1):
        a.append(s[i:j])
a=sorted(list(set(a)))
print(a[k-1])









### FIXED CODE ###

import math
import collections
from operator import mul
from functools import reduce
import bisect

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

s=input()
k=int(input())
a=[]
for i in range(len(s)):
    for j in range(i+1,min(i+2+k,len(s)+1)):
        a.append(s[i:j])
a=sorted(list(set(a)))
print(a[k-1])
### BUGGY CODE ###

n = int(input())
s = [list(input()) for _ in range(n)]
for index, word in enumerate(s):
  s[index] = str(s[index].count("a")) + str(s[index].count("b")) + str(s[index].count("c")) + str(s[index].count("d")) + str(s[index].count("e")) + str(s[index].count("f")) + str(s[index].count("g")) + str(s[index].count("h")) + str(s[index].count("i")) + str(s[index].count("j")) + str(s[index].count("k")) + str(s[index].count("l")) + str(s[index].count("m")) + str(s[index].count("n")) + str(s[index].count("o")) + str(s[index].count("p")) + str(s[index].count("q")) + str(s[index].count("r")) + str(s[index].count("s")) + str(s[index].count("t")) + str(s[index].count("u")) + str(s[index].count("v")) + str(s[index].count("w")) + str(s[index].count("x")) + str(s[index].count("y")) + str(s[index].count("z"))
count = 0
for index, word in enumerate(s):
  count += s[index + 1:].count(word)
print(count)

### FIXED CODE ###

from collections import Counter
n = int(input())
s = [input() for _ in range(n)]
c = Counter()
count = 0
for word in s:
  a = ''.join(sorted(word))
  count += c[a]
  c[a] += 1
print(count)