peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
import itertools
n=int(input())
p=tuple(map(int,input().split()))
q=tuple(map(int,input().split()))
seq=list(range(1,n+1))
l=list(itertools.permutations(seq))
p_i=l.index(p)
q_i=l.index(q)
print(abs(p_i-q_i))
# Judge status: Accepted
lst1 = list(input())
lst1[3] = "8"
print("".join(lst1))
# Judge status: Wrong Answer
def input_int():
    return map(int, input().split())

def one_int():
    return int(input())

def one_str():
    return input()

def many_int():
    return list(map(int, input().split()))

L, R, d = input_int()

mins = L//d
maxs = R//d

print(maxs-mins)
# Judge status: Wrong Answer
N = input()
order = len(N)

cash = 0

for i in range(order):
	if int(N[-(i+1)]) >=6:
		cash += 10**(i+1)
	else:
		cash += int(N[-(i+1)]) * (10**(i))
back = cash-int(N)

num=0

for a in str(cash):
	num += int(a)
for a in str(back):
	num += int(a)

print(num)
# Judge status: Accepted
X = int(input())

if 400<=X<600:
    ans = 8

elif 600<=X<800:
    ans = 7

elif 800<=X<1000:
    ans = 6

elif 1000<=X<1200:
    ans = 5

elif 1200<=X<1400:
    ans = 4

elif 1400<=X<1600:
    ans = 3

elif 1600<=X<1800:
    ans = 2

elif 1800<=X<2000:
    ans = 1

print(ans)
# Judge status: Accepted
def main():
    N = int(input())
    A = [None]*N
    B = [None]*N
    for i in range(N):
        A[i],B[i] = map(int,input().split())
    tmp = 0
    ans = 0
    for i in range(N-1,-1,-1):
        if (A[i]+tmp)%B[i] == 0:
            continue
        ans += (B[i] - (A[i]+tmp)%B[i])
        tmp += (B[i] - (A[i]+tmp)%B[i])
    print(ans)

if __name__ == '__main__':
    main()
# Judge status: Accepted
sd = input()
t = input()

n = len(sd)
m = len(t)
s = []

for i in range(n-m, -1, -1):
    t_p = sd[i:i+m]
    for j in range(m+1):
        if j == m:
            print((sd[:i] + t + sd[i + len(t):]).replace("?", "a"))
            exit()
        else:
            if t_p[j] == "?":
                continue
            elif t_p[j] != t[j]:
                break

print("UNRESTORABLE")
# Judge status: Accepted
s1 = str(input())
s = []
for i in s1:
    if i == '0' or i == '1':
        s.append(i)
    else:
        if 1 <= len(s):
            s.pop(len(s)-1)
w = ""
for h in s:
    w += h
print(w)
# Judge status: Wrong Answer
x = int(input())
print(int(360/x)) if 360%x == 0 else print(int(360/x)+1)
# Judge status: Accepted
N = int(input())
ans = ((N)*(N-1))//2
print(ans)
# Judge status: Wrong Answer
from sys import stdin

h1, m1, h2, m2, k = [int(x) for x in stdin.readline().rstrip().split()]

allMin1 = h1 * 60
allMin2 = h2 * 60

diff = (allMin2 + m2 - allMin1 + m1)

if diff < 0 :
	diff += 24 * 60

ans = diff - k

if ans >= 0 :
	if ans > k :
		print(ans)
	else :
		print(k)
else :
	print(0)
# Judge status: Accepted
print(7 - ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT'].index(input()))
# Judge status: Wrong Answer
n,k=map(int,input().split())
a=n%k
if n<k:
    print(n)
    exit()

if n%k==0:
    print(0)
else:
    print(k-a)
# Judge status: Accepted
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)


def check(n):
    if n == 0:
        return ''
    if n % 2 == 0:
        return check(n // (-2)) + '0'
    return check((n - 1) // (-2)) + '1'


n = int(readline())
if n == 0:
    print(0)
else:
    print(check(n))
# Judge status: Accepted
N, T = map(int, input().split())

x = None
for i in range(N):
    c, t = map(int, input().split())
    if t <= T:
        x = c if x is None or x > c else x

if x is None:
    print('TLE')
else:
    print(x)
# Judge status: Accepted
s = input()
n = len(s)
for i in range(0,n,2):
  if s[i] == "L":
    print("No")
    break
else:
  for j in range(1,n,2):
    if s[j] == "R":
      print("No")
      break
  else:
    print("Yes")
# Judge status: Wrong Answer
def main():
    n, l = map(int, input().split())
    m = sorted(list(range(1,n+1)))
    
    res = 0
    for i in m:
        res += l + i - 1 
    print(res)

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
a, b = map(int,input().split())
x = (a + b) /2
print(int(x))
# Judge status: Accepted
import math
a = []
mini = 9
flag = False
for i in range(5):
    x = int(input())
    if x%10==0:
        a.append(x)
    else:
        flag = True
        if x%10<mini :
            mini = x%10
        a.append(math.ceil(x/10)*10)

if flag:
    print(sum(a)-(10-mini))
else:
    print(sum(a))
# Judge status: Accepted
import sys
input = sys.stdin.readline

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

for i in range(K,N):
    if A[i]>A[i-K]:
        print("Yes")
    else:
        print("No")
# Judge status: Wrong Answer
n = int(input())
l = list(map(str,input()))

ans = 0
for i in range(n):
    a = l[0:i]
    b = l[i:n-1]
    tmp = []
    for j in a:
        if j in b:
            tmp.append(j)
    tmp = set(tmp)
    ans = (max(ans,len(tmp)))

print(ans)
# Judge status: Wrong Answer
n=int(input())
a=[]
for i in range(n):
    a.append(input())
x=max(a)
c=[]
d=[]
for i in a:
    c.append(a.count(i))
for i in a:
    if a.count(i)==max(c):
        d.append(a[a.index(i)])
d=list(set(d))
for i in d:
    print(i)
# Judge status: Accepted
import sys
sys.setrecursionlimit(10**9)
N,W = map(int,input().split())
w = []
v = []
for i in range(N):
  w_,v_ = map(int,input().split())
  w.append(w_)
  v.append(v_)

dp = [[0]*(W+1) for _ in range(N+1)]

def memo(i,j):
  if dp[i][j]:
    return dp[i][j]
  if i == N:
    dp[i][j] = 0
  elif w[i] > j:
    dp[i][j] = memo(i+1,j)
  else:
    dp[i][j] = max(memo(i+1,j),memo(i+1,j-w[i])+v[i])
  return dp[i][j] 
print(memo(0,W))
# Judge status: Accepted
import collections
S=list(str(input()))
cc=collections.Counter(S)

if cc['S']==0 and cc['N']!=0:
    print('No')
elif cc['S']!=0 and cc['N']==0:
    print('No')
elif  cc['E']==0 and cc['W']!=0:
        print('No')
elif  cc['E']!=0 and cc['W']==0:
        print('No')
else:
    print('Yes')
# Judge status: Accepted
k = int(input())
s = input()
sl = len(s)

if k >= sl:
    print(s)
else:
    print(s[0:k]+'...')
# Judge status: Accepted
test = input()

if test == 'ARC':
    print('ABC')
else:
    print('ARC')
# Judge status: Accepted
N, K = map(int, input().split())
D = set(input().split())
for n in range(N, 100000):
  if set(str(n)).isdisjoint(D): break
print(n)
# Judge status: Wrong Answer
#abc170
x, n = map(int, input().split())
ln = []
if n == 0:
  pass
else:
  ln = list(map(int, input().split()))
i = 0

while i < 5:
    
    
    if (x-i in ln) == False:
        print(x-i)
        break
    elif (x+i in ln) == False:
        print(x+i)
        break  
    else:
        i +=1
# Judge status: Accepted
s = input()
cnt = 0
for i in range(len(s)//2):
    a0, a1 = s[i], s[-i-1]
    if a0 != a1:
        cnt += 1
print(cnt)
# Judge status: Accepted
import math

N = int(input())

print(math.factorial(N) % (1000000000 + 7))
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
b=0
for i in range(n):
    if i%2==0 and a[i]%2==1:
        b+=1
print(b)
# Judge status: Accepted
k, s = map(int, input().split())

count = 0
for i in range(k+1):
    for j in range(k+1):
        if i+j+k >= s and s-i-j >= 0:
            count += 1
        else:
            continue

print(count)
# Judge status: Wrong Answer
x,y,a,b,c=map(int,input().split())
a=list(map(int,input().rstrip().split()))
b=list(map(int,input().rstrip().split()))
c=list(map(int,input().rstrip().split()))
a.sort(reverse=True)
b.sort(reverse=True)
d=0
c.sort(reverse=True)
a1=a+c
a1.sort(reverse=True)
for i in range(x):
    d=d+a1[i]
l=x-len(c)
b1=b+c[l:len(c)]
b1.sort(reverse=True)
for j in range(y):
    d=d+b1[j]
print(d)
# Judge status: Accepted
s = input()
s = sorted(s)
if s[0] == s[1] and s[2] == s[3] and s[0] != s[3]:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n, k = map(int, input().split())
S = [0]*n
for i in range(k):
    d = int(input())
    A = list(map(int, input().split()))
    for j in range(len(A)):
        S[A[j]-1]+=1

print(S.count(0))
# Judge status: Accepted
n = int(input())
s = list(input())
result = [s[1:].count("E")]
for i in range(n-1):
    if s[i:i+2] == ["W","W"]:
        result.append(result[-1]+1)
    elif s[i:i+2] == ["E","E"]:
        result.append(result[-1]-1)
    else:
        continue
print(min(result))
# Judge status: Accepted
x = int(input())
rem = x%11
cnt = (x-rem)//11
cnt *= 2

if 0 < rem <= 6:
    cnt += 1
elif rem > 6:
    cnt += 2

print(cnt)
# Judge status: Wrong Answer
def main():
    N = int(input())
    b = list(map(int, input().split()))
    i = 1

    for j in range(N):
        if b[j] == i:
            i += 1
    
    print(i - 1)

if __name__ == '__main__':
    main()
# Judge status: Accepted
a=int(input())
if a<=999:
    print("ABC")
else:
    print("ABD")
# Judge status: Wrong Answer
n=int(input())
x=list(map(int,input().split()))
ans=10**12
cou=0

for i in range(min(x),max(x)):
  for j in range(n):
    cou+=(x[j]-i)**2
  if cou<ans:
    ans=cou
  cou=0  
print(ans)
# Judge status: Wrong Answer
s=input()

n=len(s)
ans="No"

for i in range(n):
  for j in range(1,n+1):
    num=s[:i]+s[j:]
    if num == "keyence":
      ans="Yes"
      
print(ans)
# Judge status: Wrong Answer
a, b = sorted(map(int, input().split()))[:2]
print(a*b if a*b%2 else 0)
# Judge status: Accepted
S = str(input())
week = ['SAT','FRI','THU','WED','TUE','MON','SUN']

for i in range(7):
  if S == week[i]:
    print(i+1)
# Judge status: Accepted
import itertools
N = int(input())
P = tuple(map(int,input().split()))
Q = tuple(map(int,input().split()))
ls = [i+1 for i in range(N)]
per = []
for j in itertools.permutations(ls,N):
    per.append(j)
print(abs(per.index(P) - per.index(Q)))
# Judge status: Accepted
s=input()
mina=653
for i in range(len(s)-2):
  mina=min(mina, abs(753-int(s[i:i+3])))
print(mina)
# Judge status: Accepted
from fractions import gcd
from functools import reduce

n,x=map(int, input().split())

A=[abs(int(i)-x) for i in input().split()]

def gcd_list(numbers):
    return reduce(gcd, numbers)
print(gcd_list(A))
# Judge status: Accepted
x = int(input())
i = 0
SUM = 0
while SUM < x:
    i += 1
    SUM += i
print(i)
# Judge status: Accepted
l = [2, 1]
for i in range(2, int(input()) + 1):
    l.append(l[len(l) - 1] + l[len(l) - 2])
print(l[len(l) - 1])
# Judge status: Accepted
"""
author : halo2halo
date : 4, Feb, 2020
"""

import sys

# import itertools
# import math

# import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, *H = map(int, read().split())
dp = [0] * N
dp[1] = abs(H[1] - H[0])

for i in range(2, N):
    dp[i] = min(dp[i - k] + abs(H[i] - H[i - k]) for k in [1, 2])

ans = dp[-1]
print(ans)
# Judge status: Accepted
D,T,S=map(int,input().split())
if D/S<=T:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
N=int(input())
A=list(map(int, input().split()))
from collections import Counter
B=Counter(A)
ans=0
for k, v in B.items():
  if int(k)>v:
    ans+=v
  else:
    ans+=v-int(k)
print(ans)
# Judge status: Wrong Answer
n=input()
if len(n)==1:
    print(int(n))
elif n[0]!="1" and n[0]!="9":
    print((len(n)-1)*9+int(n[0])-1)
elif n[0]=="1":
    if all(i=="9" for i in n[1:]):
        print((len(n)-1)*9+int(n[0]))
    else:
        print((len(n)-1)*9)
elif n[0]=="9":
    print((len(n)-1)*9+int(n[1])-1)
# Judge status: Wrong Answer
S = input()

Z = []
X = len(S)

i = 0
while i  < X :
    if S[i] == "0":
        Z.append(0)
    elif S[i] == "1":
        Z.append(1)
    elif S[i] == "B":
        if len(Z)<= 1:
            pass
        else:
            Z.pop()
    i += 1

i = 0
X = len(Z)
while i < X:
    print(Z[i] , end ="")
    i +=1
# Judge status: Wrong Answer
wholeString = input()
firstSub = wholeString[0:int((len(wholeString)-1)/2)]
secondSub = wholeString[int(((len(wholeString)+3)/2)-1):]

if len(wholeString) % 2 == 0 or len(wholeString) < 3 or len(wholeString) > 99:
  print("No")
if firstSub == firstSub[::-1] and secondSub == secondSub[::-1]:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
s=input()
t=input()

def change(s):
    u=str()
    for i in range(len(s)):
        if i==0:
            u+=s[len(s)-1]
        else:
         u+=s[i-1]
    return u

flag=False

if(s==t): 
    flag=True

for i in range(len(s)-1):
    s=change(s)
    #print(s)
    if(s==t):
        flag=True
        break

if(flag==False):
    print("No")
else:
    print("Yes")
# Judge status: Accepted
s, w = map(int, input().split())

if s <= w:
  print('unsafe')
else:
  print('safe')
# Judge status: Accepted
n = int(input())
s = 'abcdefghijklmnopqrstuvwxyz'
ans = ''
while n > 0:
    n -= 1
    q, r = divmod(n, 26)
    ans += s[r]
    n = q
print(ans[::-1])
# Judge status: Accepted
N = int(input())
p = list(map(int, input().split()))

ans = 0
for i in range(N-1):
    if p[i] != i+1:
        continue
    tmp = p[i]
    p[i] = p[i+1]
    p[i+1] = tmp
    ans += 1
if p[N-1] == N:
    ans += 1
print(ans)
# Judge status: Accepted
import sys

A,B = map(int, sys.stdin.readline().split())

print(A * B)
# Judge status: Accepted


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

if a <=c <=b:
    print('Yes')
elif a >= c >= b:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
a, b, c = map(int, input().split())

i = 0
while True:
    if a % 2 == 1 or b % 2 == 1 or c % 2 == 1:
        print(i)
        break
    elif a == b == c:
        print(-1)
        break
    a_h = a / 2
    b_h = b / 2
    c_h = c / 2
    a = b_h + c_h
    b = a_h + c_h
    c = a_h + b_h
    i += 1
# Judge status: Accepted
S = input()
letter = list(S)

if len(S) % 2 != 0:
    CentChara = len(S) // 2
    del letter[CentChara]

num = int(len(letter) / 2)
count = 0
bakcount = -1
fail = 0

for dif in range(num):
    PreChara = letter[count]
    BakChara = letter[bakcount]
    if PreChara != BakChara:
        fail += 1

    count += 1
    bakcount += -1

print(fail)
# Judge status: Accepted
import numpy as np
import itertools

N,M,X = list(map(int, input().split()))
book_matrix = [list(map(int, input().split())) for _ in range(N)]

bit_matrix = itertools.product(range(2), repeat = N)

arr_book_matrix = np.array(book_matrix)
arr_bit_matrix = np.array(list(bit_matrix))

arr_ans_matrix = np.dot(arr_bit_matrix, arr_book_matrix)

ans_matrix = arr_ans_matrix.tolist()

ans = 100000 * 20
for ans_vector in ans_matrix:
    if(min(ans_vector[1:]) >= X):
        ans = min(ans, ans_vector[0])

if(ans == 100000 * 20):
    print(-1)

else:
    print(ans)
# Judge status: Accepted
N,M = map(int,input().split())
rs = [0]*N
for i in range(M):
    a, b = map(int, input().split())
    rs[a-1]+=1
    rs[b - 1] += 1
for r in rs:
    print(r)
# Judge status: Wrong Answer
import math
N = int(input())
a = 1
b = 1
ran = int(math.ceil(math.sqrt(N)))
m = 1
for i in range(1,ran):
    if N%i == 0:
        if i > m:
            m = i
print(int(m + N/m -2))
# Judge status: Wrong Answer
from collections import Counter
def main():
  N=int(input())
  A=list(map(int,input().split()))
  d=Counter(A)
  for i in range(1,N+1):
    if i not in d:
      print(0)
    else:
      print(d[1])
if __name__=='__main__':
  main()
# Judge status: Accepted
N = int(input())
n = N % 10
hon = (2,4,5,7,9)
pon = (0,1,6,8)
bon = (3,)

if n in hon:
    print('hon')
elif n in pon:
    print('pon')
else:
    print('bon')
# Judge status: Accepted
n,m,x,y = map(int,input().split())
xl = list(map(int,input().split()))+[x]
yl = list(map(int,input().split()))+[y]
if max(xl)+1<=min(yl):
    print("No War")
else:
    print("War")
# Judge status: Wrong Answer
# Bingo
A = []
for _ in range(3):
    A += list(map(int, input().split()))
N = int(input())
for _ in range(N):
    b = int(input())
    if b in A:
        A[A.index(b)] = -1
        
# check
diag = (sum(A[0::4]) == -3) | (sum(A[2:8:2]) == -3)
rows = (sum(A[:3]) == -3) | (sum(A[4:6]) == -3) | (sum(A[6:]) == -3)
cols = (sum(A[:7:3]) == -3) | (sum(A[1:8:3]) == -3) | (sum(A[2::3]) == -3)
ans = diag | rows | cols
print(['No', 'Yes'][ans])
# Judge status: Accepted
from fractions import gcd

A, B = map(int, input().split())
print(A*B//gcd(A,B))
# Judge status: Wrong Answer
def main():
    x, n = map(int, input().split())
    p = list(map(int, input().split()))
    _near = -1
    for i in range(101):
        if i in p:
            continue
        if abs(_near - x) > abs(i - x):
                _near = i
    print(_near)


if __name__ == "__main__":
    main()
# Judge status: Accepted
S = list(map(int, list(input())))

MOD = 2019

mods = [0 for _ in range(2019)]
mods[0] = 1

num = 0
digit = 1
for s in S[::-1]:
  num = s * digit + num
  num %= MOD
  mods[num] += 1
  digit = (digit * 10) % MOD
  
ans = 0
for m in mods:
  ans += m * (m - 1) // 2

print(ans)
# Judge status: Accepted
n = int(input())
a = [int(input()) for i in range(n)]
b = sorted(a)

for A in a:
    if A == b[n - 1]:
        print(b[n - 2])
    else:
        print(b[n - 1])
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))

resZero = 0
resTwo = 0
odds = 0
for a in A:
    if a % 4 == 0:
        resZero += 1
        continue
    elif a % 4 == 2:
        resTwo += 1
        continue
    else:
        odds += 1

if resZero - odds >= -1 and resTwo == 0:
    print('Yes')
    quit()
if resZero - odds >= 0:
    print('Yes')
    quit()
print('No')
# Judge status: Accepted
W = [ "SUN","MON","TUE","WED","THU","FRI","SAT" ]
S = input()

for i in range(len(W)):
    if W[i]==S :
        break
print( 7-i )
# Judge status: Wrong Answer
D,N = map(int, input().split())

cnt = 0
num = 1
while True:
    tmp = num
    flag = True
    for _ in range(D):
        if tmp % 100 == 0:
            tmp //= 100
        else:
            flag = False
    if flag:
        cnt += 1
    if cnt == N:
        break
    num += 1

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

ab = int(str(a)*b)
ba = int(str(b)*a)

m = max(ab, ba)

print(str(m))
# Judge status: Accepted
A,B =map(int,input().split())
S = input()
if S[A] == '-' and S.count('-') == 1:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
s = input()

if s == 'AAA' or s == 'BBB':
  print('No')
else:
  print('Yes')
# Judge status: Accepted
s = input()
n = len(s)

dic = {}
for i in range(n):
    if s[i] in dic:
        dic[s[i]] += 1
    else:
        dic[s[i]] = 1

if len(dic) == 1:
    if n == 1:
        print('YES')
    else:
        print('NO')
elif len(dic) == 2:
    if n == 2:
        print('YES')
    else:
        print('NO')
else:
    maxi = max(dic.values())
    mini = min(dic.values())
    if maxi - mini <= 1:
        print('YES')
    else:
        print('NO')
# Judge status: Wrong Answer
n=int(input())

a=2
b=1

if n==1:
  n=2

for i in range(n-1):
  nn = a+b
  ans=nn
  a=b
  b=nn

if n==1:
  ans = 1

print(ans)
# Judge status: Wrong Answer
s = input()
i = len(s) // 2
flont = 0
back = -1
miss = 0
for n in range(i):
    if s[flont] != s[back]:
        miss += 1
print(miss)
# Judge status: Accepted
def count(x):
    count = 0
    while x % 2 == 0:
        x //= 2
        count += 1
    return count


def lcm(l):
    from fractions import gcd
    x = l[0]
    for i in range(1, len(l)):
        x = (x * l[i]) // gcd(x, l[i])
    return x


N, M = map(int, input().split())
A = set(map(int, input().split()))
ans = 0

if len(set(map(count, A))) == 1:
    T = lcm(list(map(lambda x: x // 2, A)))
    ans = -(-(M // T) // 2)

print(ans)
# Judge status: Accepted
n = input()
l = []
for i in range(len(n)):
    l.append(int(n[i]))
if sum(l)%9 == 0:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n=int(input())
a=[int(input()) for i in range(n)]
a+=[0]

ans=0
for i in range(n):
    pair=a[i]//2
    ans+=pair
    a[i]-=2*pair
    if a[i]>0 and a[i+1]>0:
        ans+=1
        a[i]-=1
        a[i+1]-=1

print(ans)
# Judge status: Accepted
n, k = map(int, input().split())

ans1 = n % k
ans2 = abs(ans1 - k)

if ans1 < ans2:
    print(ans1)
else:
    print(ans2)
# Judge status: Accepted
N=int(input())
x=-(-N//111)
print(100*x + 10*x + x)
# Judge status: Accepted
N=int(input())
S=str(input())
if N%2==1:
  print('No')
else:
  if S[:N//2]==S[-N//2:]:
    print('Yes')
  else:
    print('No')
# Judge status: Accepted
from collections import defaultdict


def main():
    N = int(input())
    a = list(map(int, input().split()))

    d = defaultdict(int)
    for aa in a:
        for i in range(-1, 2):
            d[aa+i] += 1

    ans = 0
    for k in d:
        if d[k] > ans:
            ans = d[k]

    print(ans)


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

if S[0] == S[1] or S[1] == S[2] or S[2] == S[3]:
    print('Bad')
else:
    print('Good')
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
print(A)
sum=0
for i in range(2*N):
    if i%2==1:
        sum+=A[i]

print(sum)
# Judge status: Accepted
def main():
    S = list(input())
    lenS = len(S)
    pt1 = ['0', '1'] * (lenS//2) + ['0']*(lenS%2==1)
    pt2 = ['1', '0'] * (lenS//2) + ['1']*(lenS%2==1)
    cnt1 = 0; cnt2 = 0
    for i in range(lenS):
        cnt1 += (pt1[i]!=S[i])
        cnt2 += (pt2[i]!=S[i])
    print(min(cnt1, cnt2))

if __name__ == "__main__":
    main()
# Judge status: Accepted
K,N=map(int,input().split())
A=list(map(int,input().split()))
l=[]
A.append(A[0]+K)
for i in range(N):
    l.append(A[i+1]-A[i])
print(K-max(l))
# Judge status: Wrong Answer
def yakusu(x):
    A=[]
    for i in range(1,x+1):
        if x%i==0:
            A.append(i)
    return(len(A))
    
n=int(input())
ans=0

for j in range(1,n+1):
    if yakusu(n)==8:
        ans+=1
print(ans)
# Judge status: Accepted
import numpy as np

N = int(input())
A = list(map(int,input().split()))
print(*(np.argsort(A)+1))
# Judge status: Wrong Answer
s = input()
list = []

for i in s:
  list.append(i)
  for j in list:
    if j in s:
      print('no')
      break

print('yes')
# Judge status: Wrong Answer

nk = list(map(int, input().split()))
p = list(map(int, input().split()))
s=0
summo=0
l = []
for i in range(1,1001):
    s += i
    l.append(s/i)

for i in range(nk[1]):
    summo += l[p[i]-1]
now = 0
for i in range(nk[0]-nk[1]):

    now = summo-l[p[i]-1]+l[p[nk[1]+i]-3]
    if summo<=now:
        summo = now
print(summo)
# Judge status: Wrong Answer
from collections import Counter
n = int(input())
s = [i for i in input()]
cnt = Counter(s)
l = len(cnt)
val = list(cnt.values())
val = [i + 1 for i in val if i != 1]
ans = 2**(l-len(val))
for vi in val: ans *= vi
print(ans - 1)
# Judge status: Accepted
import sys
import math
def II():
	return int(sys.stdin.readline())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def MI():
	return map(int, sys.stdin.readline().split())

def SI():
	return sys.stdin.readline().strip()
n = II()
ans = ""
while(n>0):
	ans+=chr(96+n%26) if n%26>0 else 'z'
	if n%26 == 0:
		n//=26
		n-=1
	else:
		n//=26
print(ans[:][::-1])
# Judge status: Wrong Answer
N,K=map(int,input().split())
A=list(map(int,input().split()))

S=[1]
P=20988936657440586486151264256610222593863921


for n in range (N):
    if n<K:
        S.append((A[n]*S[-1])%P)
    else:
        S.append(((A[n]*S[-1])%P)/A[n-K])

for i in range (K+1,N+1):
    if S[i]>S[i-1]:
        print('Yes')
    else:
        print('No')
# Judge status: Wrong Answer
from collections import defaultdict
n = int(input())
d = defaultdict(int)
A = list(map(int,input().split()))

for a in A:
    if d[a] == 1:
        print('No')
        exit()
    else:
        d[a] += 1

print('Yes')
# Judge status: Wrong Answer
import re

N, A, B, C, D = map(int, input().split())
S = input()

flag = True
#if re.search(r'##', S[min([A,B]): max([C,D])+1]):
#    flag *= False

if C < D:
    if re.search(r'\.\.', S[B:C+1]):
        flag *= True
    else:
        flag *= False
else:
    if re.search(r'\.\.\.', S[B:D+1]):
        flag *= True
    else:
        flag *= False
        
print('Yes') if flag else print('No')
# Judge status: Accepted
N = str(input())

if N[0] == '9' or N[1] == '9':
    print('Yes')
else:
    print('No')