Harryxun/stf_run huggingface dataset:
n = int(input())
left = [None for i in range(n)]
right = [None for i in range(n)]
root = set(range(n))

for i in range(n):
    i, l, r = map(int, input().split())
    left[i] = l
    right[i] = r
    root -= (l + r)

def preorder(i):
    if (i == -1):
        return
    print(" {}".format(i), end = "")
    preorder(left[i])
    preorder(right[i])
      
def inorder(i):
    if (i == -1):
        return
    inorder(left[i])
    print(" {}".format(i), end = "")
    inorder(right[i])
      
def postorder(i):
    if (i == -1):
        return
    postorder(left[i])
    postorder(right[i])
    print(" {}".format(i), end = "")

print('Preorder')
preorder(root)
print()
  
print('Inorder')
inorder(root)
print()
  
print('Postorder')
postorder(root)
print()

### FIXED CODE ###

n = int(input())
left = [None for i in range(n)]
right = [None for i in range(n)]
root = sum(range(n)) - n - 1

for i in range(n):
    i, l, r = map(int, input().split())
    left[i] = l
    right[i] = r
    root -= (l + r)

def Preorder(i):
    if (i == -1):
        return
    print(" {}".format(i), end = "")
    Preorder(left[i])
    Preorder(right[i])
      
def Inorder(i):
    if (i == -1):
        return
    Inorder(left[i])
    print(" {}".format(i), end = "")
    Inorder(right[i])
      
def Postorder(i):
    if (i == -1):
        return
    Postorder(left[i])
    Postorder(right[i])
    print(" {}".format(i), end = "")

print("Preorder")
Preorder(root)
print()
  
print("Inorder")
Inorder(root)
print()
  
print("Postorder")
Postorder(root)
print()
W,H,x,y = [int(i) for i in input().split()]
flag=0
if W==x*2 and H==y*2:
    flag=1



print(W*H/2,flag)




### FIXED CODE ###



N, M = map(int, input().split())
a=[]
step=[0]*200000
total=1
count=0
num=0

for i in range(M):
    a.append(int(input()))

for x in range(M):
    num=a[x]-a[x-1]
    if(num==1):
        print(0)
        exit(0)
    else:
        num=0

step[0]=1
for k in range(1,N+1):
    if M!=0:
        if k==a[count]:
            step[k]=0
            if count<M-1:
                    count +=1
        else:
            if k>0:
                step[k]+=step[k-1]
            if k>1:
                step[k]+=step[k-2]
    else:
        if k > 0:
            step[k] += step[k - 1]
        if k > 1:
            step[k] += step[k - 2]



print(step[N]%1000000007)
(n, m) = list(map(int, input().split()))
p = list(map(int, input().split()))
cG = []
for i in range(0, m):
    e = list(map(int, input().split()))
    do = []
    for c in cG:
        if e[0] in c or e[1] in c:
            if not do == []:
                mix = do + c
                cG.remove(do)
                cG.remove(c)
                cG.append(mix)
                break
            else:
                do = c
        if e[0] in c:
            c.append(e[1])
        elif e[1] in c:
            c.append(e[0])
    if len(do) == 0:
        cG.append(e)

res = 0
bebe = [-1] * n
for c, i in enumerate(cG):
    for e in c:
        bebe[e - 1] = i

for i in range(n):
    if bebe[i] == bebe[p[i] - 1]:
        re += 1

print(res)


### FIXED CODE ###

def ge(x):
    return int(x) - 1


(n, m) = tuple(map(int, input().split()))
inp = list(map(ge, input().split()))
arr = [i for i in range(n)]


def root(a):
    global arr
    if arr[a] == a:
        return a
    else:
        tmp = root(arr[a])
        arr[a] = tmp
        return tmp


def sameroot(x, y):
    return root(x) == root(y)


def merge(x, y):
    global arr
    if not sameroot(x, y):
        arr[root(y)] = root(x)


for i in range(m):
    merge(*tuple(map(ge, input().split())))

res = 0
for i in range(n):
    if sameroot(i, inp[i]):
        res += 1
print(res)
def sieve(N):#エラトステネスの篩
    prime = [0]*(N+1)
    isprime = [True]*(N+1)
    isprime[0]=isprime[1] = False
    num = 0
    for p in range(2,N+1):
        if isprime[p]:
            prime[num] = p
            num += 1
            for j in range(2*p,N+1,p):
                isprime[j] = False
    return prime
from bisect import bisect_left as bl
lis = sieve(10**5)
prime = set(lis)-{0}
for i in range(len(lis)):
    if lis[i] != 0:
        if (lis[i]+1)//2 in prime:continue
        else:lis[i] = 0
    else:continue
Q = int(input())
lis = set(lis)-{0}
lis = sorted(tuple(lis))
for _ in range(Q):
    l,r = map(int,input().split())
    t = bl(lis,l)
    tmp = 0
    if t == len(lis):print(tmp);continue
    while lis[t] <= r:
        tmp += 1
        t += 1
    print(tmp)



### FIXED CODE ###

def sieve(N):#エラトステネスの篩
    prime = [0]*(N+1)
    isprime = [True]*(N+1)
    isprime[0]=isprime[1] = False
    num = 0
    for p in range(2,N+1):
        if isprime[p]:
            prime[num] = p
            num += 1
            for j in range(2*p,N+1,p):
                isprime[j] = False
    return prime
from bisect import bisect_left as bl
from bisect import bisect_right as br
lis = sieve(10**5)
prime = set(lis)-{0}
for i in range(len(lis)):
    if lis[i] != 0:
        if (lis[i]+1)//2 in prime:continue
        else:lis[i] = 0
    else:continue
Q = int(input())
lis = set(lis)-{0}
lis = sorted(tuple(lis))
for _ in range(Q):
    l,r = map(int,input().split())
    t = bl(lis,l)
    s = br(lis,r)
    tmp = s-t
    print(tmp)
n = int(input())
ans = 0
for i in range(1, N+1):
    if int(i * 1.08) == n:
        ans = i

if ans == 0:
    print(":(")
else:
    print(x)

### FIXED CODE ###

n = int(input())
ans = 0
for i in range(1, n+1):
    if int(i * 1.08) == n:
        ans = i

if ans == 0:
    print(":(")
else:
    print(ans)
# coding: utf-8
import sys

N = int(input())

for i in range(1,10):
  #print(N,i,N%i,len(str(int(N/i))))
  if N%i == 0 and len(str(int(N/i))) == 1:
    print('Yes')
    sys.exit()
print('No')

### FIXED CODE ###

A,B= map(int, input().split())
if 1<=A<=9 and 1<=B<=9:
    print(A*B)
else:
    print(-1)
a,b,c = map(int, input().split())

if len(a) == 7:
    if len(b) == 5 and len(c) == 5:
        print("Yes")
    else:
        print("No")
        
if len(b) == 7:
    if len(a) == 5 and len(c) == 5:
        print("Yes")
    else:
        print("No")

if len(c) == 7:
    if len(a) == 5 and len(b) == 5:
        print("Yes")
    else:
        print("No")


### FIXED CODE ###

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

A_sort = sorted(A)

if A_sort[0]==5 and A_sort[1]==5 and A_sort[2]==7:
    print("YES")
else:
    print("NO")
#coding: utf-8
import sys

N = int(sys.stdin)
a = []
for i in range(N):
    a.append(int(sys.stdin))

start = 0
count = 0

for i in range(N):
    count += 1
    next = a[start]
    if(next == 2):
        print(count)
        break
    start = next - 1
else:
    print(-1)

### FIXED CODE ###

#coding: utf-8

N = int(input())
a = []
for i in range(N):
    a.append(int(input()))

start = 0
count = 0

for i in range(N):
    count += 1
    next = a[start]
    if(next == 2):
        print(count)
        break
    start = next - 1
else:
    print(-1)
def mrinfinit(a, b):
    if len(a) >= 1:
        if '1' in a:
            a = a.replace('1', '')
            return a[0]
        else:
            return a[0]
    return a[0]


if __name__ == '__main__':
    la = input()
    lb = int(input())
    print(mrinfinit(la, lb))


### FIXED CODE ###

def mrinfinit(a, b):
    bf = list(set(a))
    rr = a[:b]
    sf = list(set(rr))

    if len(bf) == 1 and bf[0] == '1':
        return a[0]
    elif len(sf) == 1 and sf[0] == '1':
        return a[0]
    elif len(a) > 1:
        if '1' in a:
            a = a.replace('1', '')
            return a[0]
        else:
            return a[0]
    else:
        return a[0]


if __name__ == '__main__':
    la = input()
    lb = int(input())
    print(mrinfinit(la, lb))
def xgcd(a, b):
    x0, y0, x1, y1 = 1, 0, 0, 1
    while b != 0:
        q, a, b = a // b, b, a % b
        x0, x1 = x1, x0 - q * x1
        y0, y1 = y1, y0 - q * y1
    return a, x0, y0

def modinv(a, m):
    g, x, y = xgcd(a, m)
    return x % m

import math
N = int(input())
M = 10 ** 9 + 7
A = list(map(int,input().split()))
ans = 0
lcm = A[0]
for i in range(1,N):
    lcm = (lcm * A[i] // int(math.gcd(lcm,A[i] )) ) % M

for i in range(N):
    ans = (ans + modinv(A[i], M) * lcm) % M 
           
print (ans)

### FIXED CODE ###

import sys,queue,math,copy,itertools,bisect,collections,heapq

def main():
    sys.setrecursionlimit(10**7)
    INF = 10**18
    MOD = 10**9 + 7
    LI = lambda : [int(x) for x in sys.stdin.readline().split()]
    NI = lambda : int(sys.stdin.readline())

    N = NI()
    A = LI()
    d = [0] * (max(A)+1)

    for x in A:
        for i in range(2,int(math.sqrt(x))+1):
            cnt = 0
            while x % i == 0:
                cnt += 1
                x //= i
            d[i] = max(d[i],cnt)
            if x == 1: break
        else:
            d[x] = max(1,d[x])
    m = 1
    for i in range(2,len(d)):
        m = (m * i ** d[i]) % MOD
    ans = 0
    for x in A:
        ans += (m * pow(x,MOD-2,MOD)) % MOD
    print(ans % MOD)


if __name__ == '__main__':
    main()
N, K = map(int, input().split())
V = list(map(int, input().split()))
l = [0]
for i in range(1, K + 1): #左に何回操作するか
    #print("i=",i)
    b = 0
    for j in range(i // 2 + 1): #いくつ捨てるか
        #print("j=",j)
        a = []
        for m in range(min(i - j, N)):
            a.append(V[m])
        a.sort()
        s = 0
        for m in range(i - j):
            if m >= j or a[m] >= 0:
                s += a[m]
        b = max(b, s)
    #print("b=",b)
    l.append(max(b, l[-1]))
#print(l)
r = [0]
for i in range(1, K + 1): #右に何回操作するか
    #print("i=",i)
    b = 0
    for j in range(i // 2 + 1): #いくつ捨てるか
        #print("j=",j)
        a = []
        for m in range(max(0, N - i + j), N):
            a.append(V[m])
        #print("s=",s)
        a.sort()
        s = 0
        for m in range(i - j):
            if m >= j or a[m] >= 0:
                s += a[m]
        b = max(b, s)
    #print("b=",b)
    r.append(max(b, r[-1]))
#print(r)
ans = 0
for i in range(K + 1):
    ans = max(ans, l[i] + r[K - i])
print(ans)


### FIXED CODE ###

N, K = map(int, input().split())
V = list(map(int, input().split()))
ans = 0
for i in range(N + 1):#左から何個とるか
    if i > K:
        break
    for j in range(N + 1):#右から何個とるか
        if i + j > N or i + j > K:
            break
        for l in range(N + 1):#何個捨てるか
            if i + j + l > K:
                break
            a = V[:i] + V[N-j:]
            a.sort()
            s = sum(a[l:])
            ans = max(ans, s)
print(ans)
n,k=map(int,input().split())
print(min(n%k,abs(n%k-k))

### FIXED CODE ###

n,k=map(int,input().split())
print(min(n,n%k,abs(n%k-k)))
for i in range(N+1):
    X = set(S[:i])
    Y = set(S[i:])
    
    if len(X & Y) > ans:
        ans = len(X & Y)

print(ans)


### FIXED CODE ###

N = int(input())
S = str(input())
ans = 0

for i in range(N+1):
    X = set(S[:i])
    Y = set(S[i:])
    Z = X & Y
    if len(Z) > ans:
        ans = len(Z)

print(ans)
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long int ulli;
typedef long long int lli;
#define pb(a) push_back(a)
#define pbb(a) pop_back(a)  
#define ph(a) push_heap(a.begin(), a.end())
#define pph(a) pop_heap(a.begin(), a.end())
#define si set<int>
#define sl set<long>
#define sc set<char>
#define pii pair<int, int>
#define pll pair<long, long>
#define pdd pair<double, double>
#define TC(t) while(t--)
#define FORA(a,b,c) for ((a) == (b); (a) < (c); (a) ++)
#define FORB(a,b,c) for ((a) == (b); (a) <= (c); (a) ++)
#define FORC(a,b) for ((a) == (b); (a) > 0; (a)--)
#define FORD(a,b) for ((a) == (b); (a) >= 0; (a)--)                         
#define WM(a) while(a--)
#define WP(a) while(a++)
#define print(data) cout << data << endl
#define tin(a) cin >> a
#define ttin(a,b) cin >> a >> b
#define tttin(a,b,c) cin >> a >> b >> c
#define maxheap(a) make_heap(a.begin(),a.end())
#define fixp(a)  cout << fixed << setprecision(a);
#define RM(a,n) a.erase(remopricee(a.begin(), a.end(), n),a.end())
#define MOD 1000000007
ll prime[] = {2 , 3 , 5 , 7 , 11 , 13 , 17 , 19 , 23 , 29 , 31 , 37 , 41 , 43 , 47};
inline int gmx (int a, int b){
	return a > b ? a : b;
}
inline int gmm (int a, int b){
	return a < b ? a : b;
}
inline ll get_gcd(ll a, ll b){
    ll rem = 0;
    while( b != 0){
        rem = a % b;
        a = b; 
        b = rem;
    }
    return a;   
}
ll fastexp (ll base, ll exp){
	ll res = 1;
	if (exp == 0) return 1LL;
	while(exp){
		if(exp&1) res = (res*base)%MOD;
		res = (res+MOD)%MOD;
		base = (base*base)%MOD;
		base = (base+MOD)%MOD;
		exp >>= 1;
	}
	return (ll)res;
}
struct compare {
    bool operator()(const std::string& first, const std::string& second) {
        return first.size() < second.size();
    }
};
void Verdict_Check(){
	ifstream A("my_output.txt");
	ifstream B("code_output.txt");
	
	int c1=0,c2=0;
	bool WA = false;
	string str;
	while(getline(A,str)){
		c1++;
	}
	while(getline(B,str)){
		c2++;
	}
	A.close();
	B.close();
	ifstream AA("my_output.txt");
	ifstream BB("code_output.txt");
	if (c1 != c2){
		WA = true;
	}else{
		string s,ss;
		while(getline(AA,s) && getline(BB,ss)){
			if(s != ss){
				WA = true;
			}
		}
	}
	if (WA){
		cout << "Wrong answer!!!" << endl;
	}else{
		cout << "All test cases are passed!!!" << endl;
	}
	AA.close();
	BB.close();
}
int N;
ll a[86+5];
int main(){
	int A[10000];
	//freopen("a.in","r",stdin);
	//freopen("my_output.txt","a", stdout);
	clock_t tStart = clock();
	scanf("%d",&N);
	a[0] = 2LL;a[1] = 1LL;
	for (int i = 2; i <= N; i ++)a[i] = a[i-1] + a[i-2];
	printf("%lld\n",a[N]);
	//freopen("CON", "w", stdout);
	//Verdict_Check();
	// printf("Time taken: %.7fs\n", (double)(clock() - tStart)/CLOCKS_PER_SEC);
	return 0;
}

### FIXED CODE ###

P = 10**18
A = []
A.append(2)
A.append(1)
n = int(input())
for i in range(2,100000):
    A.append((A[i-1] + A[i-2])%P)
print(A[n])
N = input()
N = (int)N
i=0
V = []
C = []
num = 0
while i<N:
  num = input()
  V.append((int)num)

num = 0
i=0
while i<N:
  num = input()
  C.append((int)num)
max = 0
while i<N:
  max += v[i] - C[i]
  
print(max)

### FIXED CODE ###

N = 0
V = []
C = []
 
i = 0
ans = 0

str = input()
N = int(str)
 
str = input().split()
while i < N:
  V.append(int(str[i]))
  i = i+1
  
i=0
str = 0
str = input().split()
while i < N:
  C.append(int(str[i]))
  i = i+1

i=0
while i<N:
  if V[i] > C[i]:
    ans = ans + V[i] - C[i]
  i = i+1
    
    
print(ans)
N,K = map(int,input().split())
a = list(map(int,input().split()))
list_a = []
list_b =[]
list_a.append(1)
count_a = 1
count_b = 0
for i in range(1,K+1):
  if i == 1:
    k = i
  if a[k-1] in list_b:
    break
  elif a[k-1] in list_a:
    list_b.append(a[k-1])
    count_b+=1
  if a[k-1] not in list_a:
    list_a.append(a[k-1])
    count_a+=1
  k = a[k-1]
#print(list_a,list_b,count_a,count_b)
if count_b != 0:
  num_k = K-(count_a-count_b)
  num_k = num_k%count_b
  if 1 in list_b and list_b[0]!=1:
    #list_b.remove(1)
    list_b.insert(0,1)
  print(list_b[num_k])
elif count_b ==0:
  print(list_a[count_a-1])

### FIXED CODE ###

a = list(input())
b = list(input())
flag = True
for i,j in enumerate(a):
  if j !=b[i]:
    print('No')
    flag = False
    break
if flag == True:
  print('Yes')
a=stdin.readline()
s=str(a)
x=s.count("1")
print(x)






### FIXED CODE ###

from sys import stdin
a=stdin.readline().rstrip()
x=a.count("1")
print(x)
import math
N, K = input().split(" ")
N, K = int(N), int(K)
P = 0
if (N < K):
  for n in N:
    P += 1/(N*math.ceil(math.log2(K)-math.log2(n)))
else:
  for n in K:
    P += 1/(N*math.ceil(math.log2(K)-math.log2(n)))
  P += (K-N)/N
print(K)


### FIXED CODE ###

import math
N, K = input().split(" ")
N, K = int(N), int(K)
P = 0
if (N < K):
  for n in range(1,N+1):
    P += 1/(N*pow(2,math.ceil(math.log2(K)-math.log2(n))))
else:
  for n in range(1, K+1):
    P += 1/(N*pow(2,math.ceil(math.log2(K)-math.log2(n))))
  P += (N-K)/N
print(P)
a,b,c,d,e,f = map(int, input().split())

w = [i+j for i in range(0,f+1,100*a) for j in range(0,f+1,100*b) if i+j <= f]
s = [i+j for i in range(0,f+1,c) for j in range(0,f+1,d) if i+j <= f]

W = w[0]
S = 0
for ww in w :
    for ss in s :
        if ww+ss > f or ww == 0:
            continue
        elif ss/(ss+ww) > S/(W+S) and e >= 100*ss/ww:
            W = ww
            S = ss

print(W+S, S)

### FIXED CODE ###

a,b,c,d,e,f = map(int, input().split())

w = [i+j for i in range(0,f+1,100*a) for j in range(0,f+1,100*b) if i+j <= f]
s = [i+j for i in range(0,f+1,c) for j in range(0,f+1,d) if i+j <= f]

W = w[-1]
S = 0
for ww in w :
    for ss in s :
        if ww+ss > f or ww == 0:
            continue
        elif ss/(ss+ww) > S/(W+S) and e >= 100*ss/ww:
            W = ww
            S = ss

print(W+S, S)
N=int(input())
R=int(input())

if N<10:
  T=100*(10-N)
  print((R+T))
  
else:
  print(R)


### FIXED CODE ###

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

if 0<N<10:
  T=100*(10-N)
  print((R+T))
 
elif N<0:
  print("error")
  
else:
  print(R)
def read_input():
    n, m = map(int, input().split())

    slist = []
    for i in range(m):
        temp = list(map(int, input().split()))
        k = temp[0]
        s = temp[1:]
        slist.append((k, s))

    p = list(map(int, input().split()))

    return n, m, slist, p


def switch_gen(n):
    curr = 0

    while True:
        bincurr = bin(curr)[2:]

        if len(bincurr) > n:
            return None
        bincurr = [int(c) for c in bincurr]
        t = [0] * (n - len(bincurr))
        t.extend(bincurr)
        yield t

        curr += 1


def check_condition(switch, slist, plist):
    for s, p in zip(slist, plist):
        count = 0
        for i in s[1]:
            if switch[i - 1] == 1:
                count += 1

        if count % 2 != p:
            return False

    return True


def submit():
    n, m, slist, p = read_input()

    count = 0
    for switch in switch_gen(n):
        if check_condition(switch, slist, p):
            count += 1

    print(count)




if __name__ == '__main__':
    submit()


### FIXED CODE ###



def read_input():
    n, m = map(int, input().split())

    slist = []
    for i in range(m):
        temp = list(map(int, input().split()))
        k = temp[0]
        s = temp[1:]
        slist.append((k, s))

    p = list(map(int, input().split()))

    return n, m, slist, p


def switch_gen(n):
    curr = 0

    while True:
        bincurr = bin(curr)[2:]

        if len(bincurr) > n:
            return None
        bincurr = [int(c) for c in bincurr]
        t = [0] * (n - len(bincurr))
        t.extend(bincurr)
        yield t

        curr += 1


def check_condition(switch, slist, plist):
    for s, p in zip(slist, plist):
        count = 0
        for i in s[1]:
            if switch[i - 1] == 1:
                count += 1

        if count % 2 != p:
            return False

    return True


def submit():
    n, m, slist, p = read_input()

    count = 0
    for switch in switch_gen(n):
        if check_condition(switch, slist, p):
            count += 1

    print(count)




if __name__ == '__main__':
    submit()
X, Y = map(int, input())
print(X + Y/2)

### FIXED CODE ###

a, b = map(int, input().split())
print(int(a+b/2))
import math
import operator as op
from functools import reduce
from fractions import Fraction as frac

def ncr(n, r):
    r = min(r, n-r)
    numer = reduce(op.mul, range(n, n-r, -1), 1)
    denom = reduce(op.mul, range(1, r+1), 1)
    return numer / denom
def rd(p):
    if(p==0):
        return input()
    if(p==1):
        return int(input())
    if(p==2):
        return map(int,input().split())
    if(p==3):
        return list(map(int,input().split()))
        

# t=rd(1)
def find(u,par):
    if(par[u]<0):
        return u
    else:
        return find(par[u],par)
def uni(x,y,par):
    u=find(x,par)
    v=find(y,par)
    if(par[u]<par[v]):
        par[u]+=par[v]
        par[y]=u
        
    else:
        par[v]+=par[u]
        par[x]=v
t=1
for term in range(1,t+1):
    n,m=rd(2)
    par=[-1 for i in range(n+1)]
    
    
    for i in range(m):
        x,y,z=rd(2)
        uni(x,y,par)
    ans=0
    for i in range(1,n+1):
        if(par[i]<0):
            ans+=1
    print(ans)
        
    
    

### FIXED CODE ###

import math
import operator as op
from functools import reduce
from fractions import Fraction as frac

def ncr(n, r):
    r = min(r, n-r)
    numer = reduce(op.mul, range(n, n-r, -1), 1)
    denom = reduce(op.mul, range(1, r+1), 1)
    return numer / denom
def rd(p):
    if(p==0):
        return input()
    if(p==1):
        return int(input())
    if(p==2):
        return map(int,input().split())
    if(p==3):
        return list(map(int,input().split()))

global par
par=[-1 for i in range(100001)]
# t=rd(1)
def find(u):
    if(par[u]<0):
        return u
    else:
        return find(par[u])
def uni(x,y):
    u=find(x)
    v=find(y)
    if u==v:
        return
    if(par[u]<par[v]):
        par[u]+=par[v]
        par[v]=u
    else:    
        par[v]+=par[u]
        par[u]=v
t=1
for term in range(1,t+1):
    n,m=rd(2)
    for i in range(m):
        x,y,z=rd(2)
        uni(x,y)
        # print(par[1:n+1])
    ans=0
    for i in range(1,n+1):
        if(par[i]<0):
            ans+=1
    
    print(ans)
n = int(input())
x = list(input())
for i in range(n-1):
  if x[i]==x[i+1]:
    x.pop(i)
print(len(x))

### FIXED CODE ###

n = int(input())
x = list(input())
count = n
for i in range(n-1):
  if x[i]==x[i+1]:
    count-=1
print(count)
from collections import Counter
n = int(input())
ss = [sorted(input()) for i in range(n)]
dic = Counter(ss)
cnt=0
for k, v in dic.items():
  cnt += v
print(cnt)

### FIXED CODE ###

from collections import Counter
n=int(input())
string_list=["".join(sorted(list(input()))) for i in range(n)]
counter=Counter(string_list)
cnt=0
for k, v in counter.items():
  cnt+=int(v*(v-1)/2)
print(cnt)
import sys
sys.setrecursionlimit(10000)

N, X = map(int, input().split())
Burger = ['P']
for i in range(1,N+1):
    Burger_ = 'B' + Burger[i-1] + 'P' + Burger[i-1] + 'B'
    Burger.append(Burger_)
print(Burger[N][0:X].count('P'))

### FIXED CODE ###

N, X = map(int, input().split())
Size = [1]
Patty = [1]

for i in range(51):
    Size.append(Size[-1] * 2 + 3)
    Patty.append(Patty[-1] * 2 + 1)


def count_p(n, x):
    if x == 0:
        return 0
    if n == 0:
        return min(x, 1)
    if (Size[n]+1) // 2 > x:
        return count_p(n-1, x-1)
    elif (Size[n]+1) // 2 == x:
        return Patty[n-1] + 1
    else:
        return Patty[n-1] + 1 + count_p(n-1, x - ((Size[n]+1) // 2))


print(count_p(N, X))
n,k,q=map(int,input().split())
A=[]
A=[int(input()) for i in range(q)]
B=[]
for i in range(q):
    B.append(-q)
for i in A:
    B[i-1]+=1
for i in range(q):
    if B[i]<=0:
        B[i]='No'
    else:
        B[i]='Yes'
C="\n".join(B)
print(C)

### FIXED CODE ###

n,k,q=map(int,input().split())
A=[]
A=[int(input()) for i in range(q)]
#print(A)
B=[]
for i in range(n):
    B.append(-q+k)
#print(B)
for i in A:
    B[i-1]+=1
for i in range(n):
    if B[i]<=0:
        B[i]='No'
    else:
        B[i]='Yes'
C="\n".join(B)
print(C)
from bisect import *
from collections import *
from fractions import gcd
from math import factorial
r1,c1,r2,c2=map(int,input().split())
mod=10**9+7
P=[0 for i in range(10**6+1)]

P[1]=1
for i in range(2,10**6):
    P[i]=P[i-1]*i%mod
gP=[pow(P[i],mod-2,mod) for i in range(len(P))]


def comb(x,y):
    if y>x or x<=0:
        return(0)
    if y==0:
        return(1)
    else:
        return(P[x]*gP[x-y]%mod*gP[y]%mod)

count=0
for i in range(c1+1,c2+1 +1):
    count=(count+comb(i+r2,r2)-comb(i+r1-1,r1-1))%mod
print(count%mod)


### FIXED CODE ###

r1,c1,r2,c2=map(int,input().split())
mod=10**9+7
A=2*(10**6)+3
P=[0 for i in range(A+1)]
P[1]=1
for i in range(2,A):
    P[i]=P[i-1]*i%mod

dr2=pow(P[r2],mod-2,mod)
dr1=pow(P[r1-1],mod-2,mod)
def combr2(x):
    y=r2
    if y>x or x<=0:
        return(0)
    elif y==0:
        return(1)
    else:
        return(P[x]*pow(P[x-y],mod-2,mod)%mod*dr2%mod)

def combr1(x):
    y=r1-1
    if y>x or x<=0:
        return(0)
    elif y==0:
        return(1)
    else:
        return(P[x]*pow(P[x-y],mod-2,mod)%mod*dr1%mod)
count=0
for i in range(c1+1,c2+2):
    count=(count+combr2(i+r2)-combr1(i+r1-1))%mod
print(count%mod)