peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
a,b,c = map(int,input().split())
if a%2 == 0 or b%2 == 0 or c%2 == 0:
  print(0)
else:
  print(min(a*b,a*c,b*c))
# Judge status: Wrong Answer
n = int(input())
a = list(map(int,input().split()))

l=dict()
r=dict()

for i in range(n):
    if a[i]-i-1 in l:
        l[a[i]-i-1]+=1
    else:
        l[a[i]-i-1]=1
    if a[i]+i+1 in r:
        r[-a[i]-i-1]+=1
    else:
        r[-a[i]-i-1]=1

res=0
for (key,item) in l.items():
    res+=item*r.get(key,0)
print(res)
# Judge status: Accepted
S=input()

ans='NO'
if S.find('k')==0 and S.rfind('eyence')==len(S)-6:
    ans='YES'
elif S.find('ke')==0 and S.rfind('yence')==len(S)-5:
    ans='YES'
elif S.find('key')==0 and S.rfind('ence')==len(S)-4:
    ans='YES'
elif S.find('keye')==0 and S.rfind('nce')==len(S)-3:
    ans='YES'
elif S.find('keyen')==0 and S.rfind('ce')==len(S)-2:
    ans='YES'
elif S.find('keyenc')==0 and S.rfind('e')==len(S)-1:
    ans='YES'

print(ans)
# Judge status: Wrong Answer
N = int(input())

ans = 0

for a in range(1, N + 1):
   for b in range(1, N + 1):
      if a * b <= N:
         ans += 1

print(ans)
# Judge status: Accepted
import math
ab=int(input().replace(' ',''))
x = 1
xx = x*x
flag = False
while(xx < ab):
  xx = x*x
  if xx == ab:
    flag=True
    break
  x += 1
if flag==True:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
a,b = map(int, input().split())
if a < 10:
  print(b-100*(10-a))
else:
  print(b)
# Judge status: Accepted
import sys
from bisect import bisect_right as bi_r

inf = float('inf')

n, *A = map(int, sys.stdin.read().split())

def main():
    res = [inf] * n
    for a in A[::-1]:
        i = bi_r(res, a)
        res[i] = a

    for i in range(n):
        if res[i] == inf:
            return i
    return n
    
if __name__ == '__main__':
    ans = main()
    print(ans)
# Judge status: Accepted
a,b,c,d=map(int,input().split())
if (abs(b-a)<=d and abs(c-b)<=d) or abs(a-c)<=d:print("Yes")
else:print("No")
# Judge status: Wrong Answer
a = []
for i in range(int(input())):
    a.append(input().split())
triplets = 0
for i in a:
    if(i[0] == i[1]):
        triplets += 1
    else:
        triplets = 0

print('Yes' if triplets >= 3 else 'No')
# Judge status: Accepted
S = input()
ans = 'WA'
if S[0] == 'A' and S[2:-1].count('C') == 1:
    if S[1:].replace('C', '').islower():
        ans = 'AC'
print(ans)
# Judge status: Accepted
print(sum(1 for i in range(1, int(input()) + 1) if i % 2 == 1 and sum(1 for j in range(1, i + 1) if i % j == 0) == 8))
# Judge status: Wrong Answer
import numpy as np
n = int(input())
s = np.array([1 if i == '#' else 0 for i in input()])
black = np.count_nonzero(s)

print(min(black,n-black))
# Judge status: Wrong Answer
x=int(input())
a=500
b=5
if x>=500:
  num=(x//500*1000)+(x-x//500*500)//500
  print(num)
else:
  num=x//5
  print(num)
# Judge status: Wrong Answer
n = int(input()) 
a_list = list(map(int, input().split()))

if a_list == list(range(1, len(a_list) + 1)):
    print(0)

cond_idx = 0
for num in range(1, len(a_list)):
    if num == 1:
        if num not in a_list:
            print(-1)
            break
    
    if num in a_list[cond_idx:]:
        cond_idx = a_list[cond_idx:].index(num)
#         print(num, cond_idx)
    else:
        print(n - num + 1)
        break
# Judge status: Accepted
import math
X = int(input())
ans = math.ceil((-1+math.sqrt(1+8*X))/2)
print(ans)
# Judge status: Wrong Answer
a,b=map(int,input().split())
A=[]
for i in range(1,1000):
    A.append((i*(i+1))//2)

for j in range(5*(10**6)):
    if ((a+j) in A) and ((b+j) in A):
        print(j)
        exit()
# Judge status: Wrong Answer
K, A, B = map(int, input().split())
if B - A <= 2 :
  print(K + 1)
elif K < A + 1:
  print(K + 1)
elif K == A + 1:
  print(B)
else :
  count = K - (A + 1)
  if count % 2 == 1:
    ans = count // 2 * (B - A) + B
  else:
    ans = count//2 * (B - A) + B + 1
  print(ans)
# Judge status: Wrong Answer
n,m = map(int,input().split())
fr = {}
t = {}
for i in range(m):
    a,b = map(int,input().split())
    if a == 1:
        fr[b] = 1
    if b == n:
        t[a] = 1

flag = False
for kk in t.keys():
    if kk in fr:
        flag = True
    break

if flag:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
# Judge status: Accepted
N=int(input())
A=list(map(int,input().split()))

while True:
    m=min(A)
    A=[i%m for i in A]
    A.append(m)
    A=[i for i in A if i!= 0]
    if len(A)==1:
        break

print(max(A))
# Judge status: Accepted
n, a, b = map(int, input().split())

ans = 0
for i in range(1, n + 1):
    val = 0
    for c in str(i):
        val += int(c)
    if a <= val <= b:
        ans += i
print(ans)
# Judge status: Accepted
print("Yes" if len(set(input()))==3 else "No")
# Judge status: Accepted
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n = int(input())
    A = sorted(list(map(int, input().split())))
    res = 0
    for i in range(n):
        res += A[-(i + 1) * 2]

    print(res)


if __name__ == '__main__':
    resolve()
# Judge status: Wrong Answer
# For taking integer inputs.
import math
from decimal import Decimal


def inp():
    return(int(input()))


# For taking List inputs.
def inlist():
    return(list(map(int, input().split())))


# For taking string inputs. Actually it returns a List of Characters, instead of a string, which is easier to use in Python, because in Python, Strings are Immutable.
def instr():
    s = input()
    return(list(s[:len(s)]))


# For taking space seperated integer variable inputs.
def invr():
    return(map(Decimal, input().split()))


x, y = invr()

a = y // x

res = (math.log(a) / math.log(2)) + 1
print(int(res))
# Judge status: Wrong Answer
input1 = list(map(int, input().split()))
A = list(map(int, input().split()))

N = input1[0]
K = input1[1]

for k in range(K):
    B = [0] * N
    for i in range(1, N + 1):
        l_min = i - A[i - 1] - 0.5
        l_max = i + A[i - 1] + 0.5
        for j in range(1, N + 1):
            if(j >= l_min and j <= l_max):
                B[j - 1] += 1
    
    for x in range(N):
        A[x] = B[x]

print(A)
# Judge status: Accepted
n = int(input())
p = list(map(int, input().split()))

l = []
cnt = 0
for i in range(n):
    if p[i] == i + 1:
        cnt += 1
    else:
        if cnt > 0:
            l.append(cnt)
            cnt = 0
if cnt > 0:
    l.append(cnt)
    cnt = 0

res = 0
for v in l:
    res += (v + 1) // 2

print(res)
# Judge status: Accepted
def parm(a):
    return(int(a*(a-1)/2))

n=int(input())
a=list(input().split())
dic={}
ans=[0]*n
sumans=0
for i in range(n):
    if a[i] in dic.keys():
        dic[a[i]]+=1
    else:
        dic[a[i]]=1
for i in dic.values():
    sumans+=parm(i)
for i in range(n):
    print(sumans-parm(dic[a[i]])+parm(dic[a[i]]-1))
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
 
money = 1000
stock = 0
 
for i in range(N):
    if i == N - 1:
        money += stock * A[i]
        break
    if A[i] < A[i + 1]:
        buy_stock = money // A[i]
        money -= A[i] * buy_stock
        stock += buy_stock
    elif A[i] > A[i + 1]:
        money += A[i] * stock
        stock = 0
 
print(money)
# Judge status: Accepted
if len(set(input())) == 3:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
s = list(map(int,input()))
count1 = 0
count2 = 0
if len(s) == 1:
    print(0) 
else:
    for i in range(len(s)):
        if i % 2 == 0 and s[i] != 0:
            count1 += 1
        elif i%2 !=0 and s[i] != 1:
            count1 += 1
    for i in range(len(s)):
        if i % 2 == 0 and s[i] != 2:
            count2 += 1
        elif i%2 !=0 and s[i] != 0:
            count2 += 1
    print(min(count1,count2))
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split()))
i=max(a)
r=int((i+1)/2)
if n==2:
    print(max(a),min(a))
    exit()
if a.count(r)>0:
    print(i,r)
    exit()
a.append(r)
a.sort()
whe=a.index(r)
hi=a[whe+1]
lo=a[whe-1]
if abs(hi-r)>=abs(lo-r):
    print(i,hi)
else:
    print(i,lo)
# Judge status: Accepted
from collections import deque

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

l, que = 0, deque([])
for i in s:
    que.append(i)
    if i == '(':
        l += 1
    elif i == ')':
        if l == 0:
            que.appendleft('(')
            l += 1
        l -= 1
print(*que, ')' * l, sep='')
# Judge status: Accepted
A, B, K = map(int, input().split())
if A >= K:
    A = A - K
else:
    B = B - (K - A)
    A = 0
    if B < 0:
        B = 0

print(str(A) + " " + str(B))
# Judge status: Accepted
# https://atcoder.jp/contests/abc072/tasks/arc082_a
from collections import defaultdict
n = int(input())
nums = [int(i) for i in input().split()]

c = defaultdict(int)
for num in nums:
    c[num - 1] += 1
    c[num] += 1
    c[num + 1] += 1

ans = 0
for v in c.values():
    ans = max(ans, v)
print(ans)
# Judge status: Accepted
def main():
    n, m = map(int, input().split())
    A, X = [], []
    for _ in range(n):
        A.append(list(map(int, input().split())))
    for _ in range(m):
        X.append(list(map(int, input().split())))
    for a, b in A:
        ans, dist = 0, 10e+10
        for i, (x, y) in enumerate(X):
            if (d := abs(x - a) + abs(y - b)) < dist:
                dist = d
                ans = i + 1
        print(ans)

if __name__ == '__main__':
    main()
# Judge status: Accepted
n, a, b, c, d = map(int, input().split())
s = '_' + input()

if s[c] == '#' or s[d] == '#':
    print('No')
    exit()

# '##'を検知
if '##' in s[a:c+1] or '##' in s[b:d+1]:
    print('No')
    exit()

if c > d:
    # 3 マス以上の連続する'.'が必要
    num_dot = s[b-1:d+2].count("...")
    if num_dot == 0:
        print('No')
        exit()

print('Yes')
# Judge status: Wrong Answer
x,y,z = map(int,input().split())

ans = int(x/(y+z))
if x%(y+z) < z:
    ans -= 1
print(ans,x%(y+z))
# Judge status: Wrong Answer
import sys
l,r = map(int,input().split())
l=l%2019
r=r%2019
if l>=r or l+2019 <= r:
  print(0)
  sys.exit()

ans=2018
for i in range(l,r):
  if ans == 0:
    break
  for j in range(i+1,r+1):
    ans = min(ans,i*j%2019)
    if ans == 0:
      break
print(ans)
# Judge status: Accepted

n = int(input())

if(n % 2 == 1):print(0)
else:
    x = 0
    i = 0
    while(n//(10*5**i) > 0):
        x += n//(10*5**i)
        i += 1
    print(x)
# Judge status: Wrong Answer
n = int(input())
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
a = prime_factorize(n)
from collections import Counter
c = Counter(a)
ans = 0
for i in c:
    ans += -(-c[i]//2)

print(ans)
# Judge status: Accepted
N,C,K=map(int,input().split(' '))
T=sorted([int(input()) for i in range(N)])
pas = 1
last_bus=T[0]+K
ans = 1
for i in T[1:]:
    if i <= last_bus and pas < C:
        pas += 1
    else:
        ans += 1
        pas = 1
        last_bus = i+K
print(ans)
# Judge status: Wrong Answer
S = input()

ans = "WA"

if S[0] != "A":
  ans = "WA"
  print(ans)
else:
  if S[1:len(S) - 1].count("C") != 1:
    print(ans)
  else:
    s = S.index("C")
    SS = S[1:s] + S[s + 1:]
    if SS.islower() == False:
      print(ans)
    else:
      print("AC")
# Judge status: Accepted
N,M = list(map(int,input().split()))
XY = [list(map(int,input().split())) for _ in range(M)]
L1 = [1]*N
L2 = [0]*N
L2[0] = 1
for xy in XY:
    if L2[xy[0]-1] == 1:
        L2[xy[1]-1] = 1
    L1[xy[0]-1] -= 1
    L1[xy[1]-1] += 1
    if L1[xy[0]-1] == 0:
        L2[xy[0]-1] = 0
print(sum(L2))
# Judge status: Wrong Answer
s = input().split(' ')
print('A' + s[0] + 'C')
# Judge status: Accepted
N,*A=map(int,open(0).read().split())

x4 = 0
x2 = 0
x1 = 0

for i in range(N):
  if A[i]%4 == 0:
    x4+=1
  elif A[i]%2 == 0:
    x2+=1
  else:
    x1 +=1
if x1 +min(1,x2)<= x4+1:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
import sys
input = sys.stdin.readline

N=int(input())
P=[tuple(map(int,input().split())) for i in range(N)]

PLUS=[]
MINUS=[]

for x,y in P:
    PLUS.append(x+y)
    MINUS.append(x-y)

PLUS.sort()
MINUS.sort()

print(max(PLUS[-1]-PLUS[0],MINUS[-1]-MINUS[0]))
# Judge status: Wrong Answer
X, Y = map(int, input().split())
x, y = (X*2-Y)//3, (Y*2-X)//3
mod = 10**9+7
n = min(x, y)

factorial = [1]
for i in range(1, n+1):
    factorial.append((factorial[i-1]*i)%mod)

p_list = [(x+y)%mod]
for i in range(1, n+1):
    p_list.append((p_list[i-1]*(x+y-i))%mod)
    
if (X+Y)%3 != 0:
    print (0)
elif X*2-Y < 0 or Y*2-X < 0:
    print (0)
else:
    print (p_list[n-1]*pow(factorial[n], 10**9+5, mod)%mod)
# Judge status: Accepted
a, b, c, d = map(int, input().split())

if abs(c-a) <= d:
    print('Yes')
elif abs(b-a) <= d and abs(c-b) <= d:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
a, b, c = map(int, input().split())

print(float(c-a-b))
# Judge status: Wrong Answer
a, b, c = map(int,input().split())

if a < c < b:
    print("Yes")

else:
    print("No")
# Judge status: Accepted
N=int(input())
A=list(map(int,input().split()))
x=sum(A)
y=10**19
a=0
for i in range(N):
    a+=A[i]
    if y>abs(x-2*a):#2区間の差
        y=abs(x-2*a)
        
    else:
        break

print(y)
# Judge status: Accepted
import sys
def input(): return sys.stdin.readline().strip()

def main():
    n = int(input())
    k = int(input())
    x = int(input())
    y = int(input())
    if n <= k:
        print(x * n)
    else:
        print(x * k + (n - k) * y)

if __name__ == "__main__":
    main()
# Judge status: Accepted
if __name__ == "__main__":
    x = input()

    count = 0
    ans = len(x)
    for i in range(len(x)):
        if x[i] == 'S':
            count += 1
        elif count > 0 and x[i] == 'T':
            ans -= 2
            count -= 1
        else:
            count = 0

    print(ans)
# Judge status: Accepted

def odd(x):
    if (x-1)%2 == 0:
        return True
    else:
        return False


N = input()
index, num = len(N), int(N)

ans = 0
for i in range(1, index+1):
    if odd(i):
        if num >= 10**i:
            ans = ans + (10**i - 10**(i-1))
            
        else:
            ans = ans + (num - 10**(i-1) + 1)
            
print(ans)
# Judge status: Accepted
import fractions
n = int(input())
a_list = sorted(list(map(int,input().split())))

a = a_list[0]
for i in range(1,n):
    a = fractions.gcd(a,a_list[i])

print(a)
# Judge status: Accepted
import math

N,X = list(map(int,input().split()))
x = list(map(int,input().split()))

arr = [0]*N
for i in range(N):
    arr[i] = abs(x[i]-X)
ans = arr[0]
for i in range(1,N):
    ans = math.gcd(ans, arr[i])
    
print(ans)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
cnt = 0

while True:
    if sum([a[i]%2 for i in range(n)]) == 0:
        a = [int(n/2) for n in a]
        cnt += 1
    else:
        break
print(cnt)
# Judge status: Accepted
n=int(input())
a=[]
for i in range(n):
    b=input()
    b=sorted(b)
    b=' '.join(b)
    b=b.replace(" ","")
    a.append(b)
import collections
c=collections.Counter(a)
c=list(c.values())
ans=0
import math
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
for i in c:
    if i>=2:
        ans+=combinations_count(i,2)
print(ans)
# Judge status: Accepted
x, y = map(int, input().split())

g1 = [1, 3, 5, 7, 8, 10, 12]
g2 = [4, 6, 9, 11]


if x == 2 and y == 2:
    print("Yes")
elif x in g1 and y in g1:
    print("Yes")
elif x in g2 and y in g2:
    print("Yes")
else:
 print("No")
# Judge status: Accepted
n = int(input())
l = list(map(int, input().split()))

from collections import Counter
c = Counter(l)
c = sorted(c.items(), reverse=1)

temp = 0
for i in range(len(c)):
    if c[i][1] >= 2:
        if temp != 0:
            print(temp * c[i][0])
            exit()
        else:
            temp = c[i][0]
    if c[i][1] >= 4:
            print(c[i][0] ** 2)
            exit()
else:
    print(0)
# Judge status: Accepted
A ,B , C , K = map(int,input().split())
if K % 2 == 0:
	print(A - B)
else:
	print(B - A)
# Judge status: Wrong Answer
import sys

input = sys.stdin.readline

def main():
    S = input().rstrip('\n')
    if ('S' in S == 'N' in S) and ('E' in S == 'W' in S):
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
import numpy as np
n, m = map(int, input().split())

mat = [[0] * n] * n
mat = np.array(mat)

for i in range(m):
    a, b = map(int, input().split())

    tar1 = mat[a - 1, b - 1]
    tar2 = mat[b - 1, a - 1]
    if (tar1 == 0):
        mat[a - 1, b - 1] = 1

    if (tar2 == 0):
        mat[b - 1, a - 1]= 1

#print(mat)
for i in range(n):
    ans = np.sum(mat[i, :])
    print(ans)
# Judge status: Accepted
def main():
    a, b = (int(i) for i in input().split())
    if a*b <= 0:
        print("Zero")
    elif 0 < a:
        print("Positive")
    else:
        if (b-a+1) % 2 == 0:
            print("Positive")
        else:
            print("Negative")


if __name__ == '__main__':
    main()
# Judge status: Accepted
n = int(input())
dat = list(map(int, input().split()))
dat.sort()
x = dat[-1]
xx = x / 2
dat = dat[:-1]
mindiff = 999999999999999999999999999
minnum = None
for i in range(n-1):
    if abs(xx-dat[i]) < mindiff:
        mindiff = abs(xx-dat[i])
        minnum = dat[i]
print(x, minnum)
# Judge status: Wrong Answer
N=int(input())
S=[int(s) for s in input().split()]
for i in range(N):
    if S[i]%2==0 and S[i]%15!=0:
        print("DENIED")
    elif i==N-1:
        print("APPROVED")
# Judge status: Accepted
m=10**9+7
n,a,b=map(int,input().split())
s=r=1
for i in range(b):s+=r*(i==a);r=r*(n-i)*pow(i+1,m-2,m)%m
print((pow(2,n,m)-s-r)%m)
# Judge status: Accepted
from sys import stdin


def main():
    input = lambda: stdin.readline()[:-1]
    K, N = map(int, input().split())
    A = tuple(map(int, input().split()))

    d = K - A[-1] + A[0]
    for i in range(N - 1):
        d = max(d, A[i+1] - A[i])
    print(K - d)


main()
# Judge status: Wrong Answer
n = int(input())
big = 0
a = list(map(int, input().split()))
ans = 1
for num in a:
    ans = ans * num
    if ans > 10 ** 18:
        print(-1)
        big = 1
        break
if big == 0:
    print(ans)
# Judge status: Accepted
n= (int)(input())
ans = ""
count = 0

if n % 26 != 0:
    ans += chr(n % 26 + 96)
    n -= n % 26
else:
    ans += 'z'
    n -= 26

for i in range(1, 11):
    n = n // 26
    if n == 0:
        break
    if n % 26 != 0:
        ans = chr(n % 26 + 96) + ans
        n -= n % 26
    else:
        ans = 'z' + ans
        n -= 26
    
print(ans)
# Judge status: Wrong Answer

K, X = map(int, input().split())
list_ans = []

for i in range(K):
    list_ans.append(X-(K-(i+1)))
 
for j in range(K-1):
    list_ans.append(X+j+1) 

print(list_ans)
# Judge status: Accepted
n = int(input())
a = [int(input()) for _ in range(n)]
now = 1
ans = 0
while True:
    now = a[now-1]
    ans += 1
    if (now==2):
        print(ans)
        break
    elif (now==1):
        print(-1)
        break
    elif (ans>len(a)):
        print(-1)
        break
# Judge status: Accepted
l, r = map(int, input().split())
interval = min(r - (l - 1), 2019)
min_remain = 2018
for i in range(l, l + interval):
    for j in range(i + 1, l + interval):
        if (i * j) % 2019 < min_remain:
            min_remain = (i * j) % 2019
print(min_remain)
# Judge status: Wrong Answer
letter = str(input())
if letter.islower is True:
    print('a')
else:
    print('A')
# Judge status: Accepted
from collections import defaultdict
n = int(input())
s = input()
MOD = 10**9 + 7

dd = defaultdict(int)
for c in s:
    dd[c] += 1
ans = 0
for c in s:
    dd[c] -= 1
    tmp = 1
    for k, v in dd.items():
        if k == c:
            continue
        else:
            tmp *= v + 1
    ans = (ans + tmp) % MOD

print(ans)
# Judge status: Accepted
n = int(input())
al = list(map(int, input().split()))
t = al[0]


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


for i in range(1, n):
    t = gcd(t, al[i])  # a,bの最大公約数


print(t)
# Judge status: Wrong Answer
a,b,t = map(int,input().split())

print((b*(t+0.5))//a)
# Judge status: Wrong Answer
S = input()
count_a = 0
count_b = 0
l=len(S)
for i in range(l//2):
  if S[2*i] =='0':
    count_a +=1
  if S[2*i + 1]=='1':
    count_a +=1
  if S[2*i] =='1':
    count_b +=1
  if S[2*i + 1]=='0':
    count_b +=1
if l%2==1:
  if S[l-1] =='0':
    count_a +=1
  if S[l-1] =='1':
    count_a +=1
print(min(count_a, count_b))
# Judge status: Accepted
n,a,b=map(int,input().split())
if a>b:
  print(0)
  exit()
if n==1 and a!=b:
  print(0)
  exit()
if n==1 and a==b:
  print(1)
  exit()
m=n-2
print(b*m-a*m+1)
# Judge status: Wrong Answer
n=int(input())
print((n*(n-1)*10**(n-2))%1000000007)
# Judge status: Wrong Answer
n = int(input())
S = [list(input()) for i in range(n)]

ans = 0
for i in range(n-1):
  for j in range(i+1,n):
    if set(S[i]) != set(S[j]):
      pass
    else:
      if S[i].sort() == S[j].sort():
        ans += 1
      else:
        pass
print(ans)
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
sm=sum(map(abs,a))
f=1

for i in range(n-1):
  f= 1 if a[i]*f>=0 else -1
print (sm if f*a[n-1]>0  or 0 in a else sm-2*min(map(abs,a)))
# Judge status: Accepted
n = int(input())
s = list(input())
p = 0

for i in range(1,n):
    a = list(s[0:i])
    a = list(set(a))
    b = list(s[i:])
    t = 0
    for j in range(len(a)):
        if a[j] in b:
            t += 1
    p = max(t,p)

print(p)
# Judge status: Accepted
x, y = map(int, input().split())
ans = 0
ans += abs(abs(y) - abs(x))
if abs(x) <= abs(y):
    if x < 0:
        ans += 1
    if y < 0:
        ans += 1
else:
    if x >= 0:
        ans += 1
    if y > 0:
        ans += 1
print(ans)
# Judge status: Accepted
def main():
    A = int(input())
    B = int(input())
    C = int(input())
    X = int(input())
    
    ans = 0

    for i in range(A+1):
        for j in range(B+1):
            tmp = X - 500*i - 100*j
            if tmp >= 0 and tmp//50 <= C:
                ans += 1 
    print(ans)

if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
n = int(input())

mod = pow(10, 9) + 7
l = []
for i in range(2001):
    if i < 3:
        l.append(0)
    elif 3 <= i <= 5:
        l.append(1)
    else:
        sum_ = 1
        for j in range(i-5):
            sum_ += l[3+j] * l[i-(3+j)]
            sum_ = sum_ % mod
        l.append(sum_)

print(l[n])
# Judge status: Accepted
#!/usr/bin/env python
import sys
import re
from collections import deque, defaultdict
from itertools import combinations, combinations_with_replacement
import bisect
from math import factorial, sqrt, log, ceil, floor
sys.setrecursionlimit(1000000)


def main():
    input = sys.stdin.readline
    #N, M = map(int, input().split())
    #N, K = map(int, input().split())
    #ps = list(map(int, input().split()))

    N = int(input())

    print(N * (N - 1) // 2)


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
N,D=map(int, input().split())
a=0
for i in str(N):
  x,y=map(int, input().split())
  if x*x+y*y<=D*D:
    a+=1
  else:
    pass
print(a)
# Judge status: Accepted
v = ["a","e","i","o","u"]
a = input()
if a in v:
    print("vowel")
else:
    print("consonant")
# Judge status: Wrong Answer
import math
import os
import random
import re
import sys

if __name__ == '__main__':
    n = int(input())

    res = math.ceil(math.log(n, 10))
    s = 1 if math.log(n, 10) % 2 == 0 else 0

    for i in range(0, res, 2):
        k = 9*(10**i)
        if n > k:
            s = s + k
        else:
            s = s + n - 10**i + 1
    
    print(s)
# Judge status: Accepted
import itertools
n = int(input())
P = list(map(str, input().split()))
Q = list(map(str, input().split()))
p = ''
for e in P:
  p += e
p = int(p)
q = ''
for e in Q:
  q += e
q = int(q)
l = [str(i) for i in range(1, n + 1)]
r = itertools.permutations(l, n)
a = []
for v in r:
  s = ''
  for e in v:
    s += e
  s = int(s)
  a.append(s)
print(abs(a.index(p) - a.index(q)))
# Judge status: Wrong Answer
k,x = map(int,input().split())
if x<500*k:
  print("No")
else:
  print("Yes")