peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
N,P = map(int, input().split())
A = list(map(int, input().split()))

even_num=0
odd_num=0

for a in A:
    if a%2==0:
        even_num+=1
    else:
        odd_num+=1

ev_case = 2**even_num


from math import factorial

res=0
for i in range(P,odd_num+1,2):                                                                   res += factorial(odd_num) / factorial(i) / factorial(odd_num - i)

print(int(ev_case*res))
# Judge status: Accepted
a, b = map(int, input().split())
if a*b%2==0: print('Even')
else: print('Odd')
# Judge status: Accepted
from collections import deque

s = deque(list(input()))
q = int(input())
flg = 1
for i in range(q):
    array = input().split(' ')
    if array[0] == '1':
        flg *= -1
    elif array[0] == '2':
        if array[1] == '1' and flg == 1 or array[1] == '2' and flg == -1:
            s.appendleft(array[2])
        else:
            s.append(array[2])

s = list(s)
if flg == -1:
    s = s[::-1]

s = ''.join(s)
print(s)
# Judge status: Wrong Answer
li = input().split()
set(li)
print(len(li))
# Judge status: Accepted
s = input(); t = input()

S = sorted(s); T = sorted(t, reverse = True)

print("Yes" if S < T else "No")
# Judge status: Wrong Answer
n, k = map(int, input().split())
a = list(map(int, input().split()))
cnt_list = []
for i in range(1,10):
    if i in a:
        cnt_list.append(a.count(i))
    else:
        continue
cnt_list.sort()
ans = 0
if len(cnt_list) <= k:
    ans = 0
else:
    tmp = len(cnt_list) - k
    ans = sum(cnt_list[:tmp])
print(ans)
# Judge status: Accepted
a,b,c=list(map(int,input().split()))
flag=0
for itr in range(1,100000):
    if (a*itr)%b==c: 
        print('YES')
        flag=1
        break
if flag==0: print('NO')
# Judge status: Accepted
a,b = map(int,input().split())
if abs(a-b) < 2:
  print(a+b)
else:
  print(2*max(a,b) - 1)
# Judge status: Accepted
from math import ceil
n, h, *AB = map(int, open(0).read().split())
a = max(AB[::2])
B = sorted(b for b in AB[1::2] if a < b)[::-1]
c = 0
for b in B:
    h -= b
    c += 1
    if h <= 0:
        break
else:
    c += ceil(h / a)
print(c)
# Judge status: Wrong Answer
a, b, c, d = map(int, input().split())
print(min(b, d)-max(a, c))
# Judge status: Accepted
N = int(input())
def dfs(ch, Ma):
    if len(ch) == N:
        print(ch)
        return
    for i in range(97, Ma+2):
        dfs(ch+chr(i), max(Ma, i))
dfs('a', 97)
# Judge status: Accepted
(N,) = [int(x) for x in input().split()]
XY = [[int(x) for x in input().split()] for i in range(N)]

best = 0

mn = min(XY, key=lambda pt: pt[0] + pt[1])
mx = max(XY, key=lambda pt: pt[0] + pt[1])
best = max(best, abs(mn[0] - mx[0]) + abs(mn[1] - mx[1]))

mn = min(XY, key=lambda pt: pt[0] - pt[1])
mx = max(XY, key=lambda pt: pt[0] - pt[1])
best = max(best, abs(mn[0] - mx[0]) + abs(mn[1] - mx[1]))


print(best)
# Judge status: Accepted
N = int(input())
S = input()

print(max(len(set(S[:i]) & set(S[i:])) for i in range(N)))
# Judge status: Wrong Answer
w, h, n = map(int, input().split())
x1 = 0
y1 = 0
x2 = w
y2 = h
for i in range(n):
    x, y, a = map(int, input().split())
    if a == 1:
        x1 = x
    elif a == 2:
        x2 = x
    elif a == 3:
        y1 = y
    else:
        y2 = y

if x1 >= x2 or y1 >= y2 or x2 <= 0 or y2 <= 0:
    print("0")
else:
    print((x2-x1)*(y2-y1))
# Judge status: Wrong Answer
n=input()
lst=list(n)
s=0
for i in lst:
    s+=int(i)
if s%9==0:
    print('YES')
else:
    print('NO')
# Judge status: Accepted
import sys
import time
import math
import itertools as it
def inpl():
    return list(map(int, input().split()))
st = time.perf_counter()
# ------------------------------

S = input()
ans = 0
st1 = ''
st2 = ''
for s in S:
	st2 += s
	if st2 != st1:
		ans += 1
		st1 = st2
		st2 = ''
print(ans)

# ------------------------------
ed = time.perf_counter()
print('time:', ed-st, file=sys.stderr)
# Judge status: Wrong Answer
from math import atan, pi
a, b, x = map(int, input().split())

if x >= a*a*b:
    ans = atan((2*(a*a*b - x)) / (a*a*a))
else:
    ans = atan((a*b*b) / (2*x))
print((ans*180) / pi)
# Judge status: Accepted
from sys import stdin,stdout
def INPUT():return list(int(i) for i in stdin.readline().split())
import math
def inp():return stdin.readline()
def out(x):return stdout.write(x)
import math as M
MOD=10**9+7
import sys
#####################################
n=int(input())
A=INPUT()
money=1000
for i in range(n-1):
    stocks=0
    if A[i]<A[i+1]:
        stocks=money//A[i]
    money+=(A[i+1]-A[i])*stocks
print(money)
# Judge status: Wrong Answer
from collections import Counter

S = [i for i in input()]
c = Counter(S)
if len(c) == 1:
    if len(S) == 1:
        print("YES")
    else:
        print("NO")
elif len(c) == 2:
    print("NO")
else:
    dif = c.most_common()[0][1] - c.most_common()[2][1]
    print("YES" if dif<=1 else "NO")
# Judge status: Accepted
N, A, B = map(int, input().split())
S = input()

capacity = A+B
rank = 1
for i in range(N):
    if 'a' == S[i] and 0 < capacity:
        print('Yes')
        capacity -= 1
    elif 'b' == S[i] and 0 < capacity and rank <= B:
        print('Yes')
        capacity -= 1
        rank += 1
    else:
        print('No')
# Judge status: Accepted
A=input()
ans=0
before=""
c=""
for i in A:
    c+=i
    if c != before:
        before=c
        c=""
        ans+=1
print(ans)
# Judge status: Accepted
N = int(input())
W = tuple(map(int, input().split()))
total1 = W[0]
total2 = sum(W[1:])
ans = abs(total2 - total1)
for i in range(1, N):
    total1 += W[i]
    total2 -= W[i]
    ans = min(ans, abs(total2 - total1))
print(ans)
# Judge status: Accepted
import math

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True

X = int(input())

while True:
    if is_prime(X) == True:
        print(X)
        exit()
    else:
        X += 1
# Judge status: Accepted
N, M = map(int, input().split())
sc = [list(map(int, input().split())) for _ in range(M)]
S = [1] + [0] * (N-1)
sc = sorted(sc, key=lambda x: x[0])


def get_unique_list(seq):
    seen = []
    return [x for x in seq if x not in seen and not seen.append(x)]


if N != 1 and [1, 0] in sc:
    print(-1)
elif len(list(set([i[0] for i in sc]))) != len(list(get_unique_list(sc))):
    print(-1)
elif N == 1 and M == 0:
    print(0)
else:
    for i in sc:
        S[i[0]-1] = "{}".format(i[1])

    print(*S, sep="")
# Judge status: Accepted
import math
from bisect import bisect_left as bl
from itertools import accumulate

n,h = map(int,input().split())
A = []
B = []
ans = 0

for _ in range(n):
  a,b = map(int,input().split())
  A.append(a)
  B.append(b)

A.sort(reverse=1)
B.sort()

index = bl(B, A[0])
B = B[index:]
B = list(accumulate(B[::-1]))
if B[-1] >= h:
  print(bl(B,h)+1)
  exit()
  
h -= B[-1]
ans += len(B)
ans += math.ceil(h/A[0])
print(ans)
# Judge status: Accepted
List=list(map(int,input().split()))
cnt=0
while(all(i%2==0 for i in List)):
    if List[0]==List[1]==List[2]:
        print(-1)
        exit()
    old_list=[List[0]//2,List[1]//2,List[2]//2]
    List[0]=old_list[1]+old_list[2]
    List[1]=old_list[0]+old_list[2]
    List[2]=old_list[0]+old_list[1]
    cnt+=1
print(cnt)
# Judge status: Accepted
T = input()
rep = str(T).replace("?","D")
print(rep)
# Judge status: Wrong Answer
a, b = input().split()
a = int(a)
b = float(b)

print(int(a*b))
# Judge status: Accepted
KN = list(map(int, input().split()))
A = list(map(int, input().split()))

answer = []

for i,home in enumerate(A):
    if home < A[i - 1]:
        answer.append(home - A[i - 1] + KN[0])
    else:
        answer.append(home - A[i - 1])

print(KN[0] - max(answer))
# Judge status: Accepted
def gcd(a, b):
  while b:
    a, b = b, a%b
  return a

a, b = map(int, input().split())
max = gcd(a, b)
pf=[]

#print(max)
tmp=max
i=2
while tmp % 2 == 0:
    pf.append(2)
    tmp //= 2
f = 3
while f * f <= tmp:
    if tmp % f == 0:
        pf.append(f)
        tmp //= f
    else:
        f += 2
if tmp != 1:
    pf.append(tmp)


#print(pf)
spf = set(pf)
#print(spf)
print(len(spf)+1)
# Judge status: Wrong Answer
W,H,x,y=map(int,input().split())
area=0
if abs(H//2-y)>abs(W//2-x):
    area=H*(min(x,W-x))
else:
    area=W*min(y,H-y)
ans=0
if W/2==x and H/2==y:
    ans=1
else:
    ans=0
print(area,ans)
# Judge status: Wrong Answer
N=int(input())
ans=0
while N:
    if 12<=N<=14:
        N-=6
        ans+=1
    if 1458<=N<=1511:
        N-=729
        ans+=1
    i=0
    while 9**i<=N:
        i+=1
    i-=1
    j=0
    while 6**j<=N:
        j+=1
    j-=1
    N-=max(9**i,6**j)
    ans+=1

print(ans)
# Judge status: Accepted
n=int(input())
l=[[0]*9 for j in range(9)]
for i in range(1,n+1):
    i=str(i)
    if i[0]!='0' and i[-1]!='0':
        l[int(i[-1])-1][int(i[0])-1]+=1
ans=0
for i in range(9):
    for j in range(9):
        ans+=l[i][j]*l[j][i]
print(ans)
# Judge status: Wrong Answer
a,b,c = map(int,input().split())
count = 0


while a % 2 == 0 and b % 2 == 0 and c % 2 == 0:
  if a == b and b == c:
    break
  else:
    aDummy = a/2
    bDummy = b/2
    cDummy = c/2
    a = (bDummy) + (cDummy)
    b = (aDummy) + (cDummy)
    c = (aDummy) + (bDummy)
    count += 1
print(-1 if a == b and b == c else count)
# Judge status: Accepted
a1,a2,a3=map(int,input().split())
print('win' if a1+a2+a3<22 else 'bust')
# Judge status: Accepted
n = int(input())
h = list(map(int,input().split()))
dp = [0]*n
for i in range(1,n):
    dp_0 = dp[i-1] + abs(h[i]-h[i-1])
    if i -2 < 0:
        dp_1 = 10**10
    else:
        dp_1 = dp[i-2] + abs(h[i]-h[i-2])
    dp[i] = min(dp_0,dp_1)
print(dp[-1])
# Judge status: Accepted
import sys

inp=input().split(" ")
thp=int(inp[0])
tat=int(inp[1])
ahp=int(inp[2])
aat=int(inp[3])

for i in range(100):
  ahp-=tat
  if ahp<=0:
    print("Yes")
    sys.exit()
  thp-=aat
  if thp<=0:
    print("No")
    sys.exit()
# Judge status: Accepted
N = int(input())
X = list(map(int,input().split()))
Y = sorted(X)
index = N//2
a,b = Y[index],Y[index-1]
for i in range(N):
    if X[i] < Y[index]:
        print(a)
    else:
        print(b)
# Judge status: Accepted
# import math
# from itertools import permutations as permus
# from fractions import gcd

# import numpy as np
# import scipy as scp

# 入力の受け取り
a = int(input())
b = int(input())
 
ans = 6-a-b

print(ans)
# Judge status: Accepted
#!/usr/bin/env python3
a, b, c, k = map(int, input().split())
if abs(a - b) > 10**18:
    print("Unfair")
else:
    print((a - b) * (-1)**k)
# Judge status: Accepted
n = int(input())
lis = list(map(int,input().split()))
for num in lis:
    if num % 2 == 0:
        if num % 3 != 0:
            if num % 5 != 0:
                print("DENIED")
                exit()
print("APPROVED")
# Judge status: Accepted
a, b, k = map(int, input().split())

count = 0
for i in range(min(a, b), 0, -1):
    if a % i == 0 and b % i == 0:
        count = count + 1
        if count == k:
            print(i)
            exit()
# Judge status: Accepted
import collections
n = int(input())
arr = list(map(int, input().split()))
cnt = collections.Counter(arr)
total = 0
for i in cnt.keys():
  patern = cnt[i]*(cnt[i]-1)//2
  total += patern
for j in range(n):
  tmp = total
  total -= cnt[arr[j]]*(cnt[arr[j]]-1)//2
  total += (cnt[arr[j]]-1)*(cnt[arr[j]]-2)//2
  print(total)
  total = tmp
# Judge status: Accepted
h, a = map(int, input().split())

n = 0
while h > 0:
    h = h - a
    n += 1
print(n)
# Judge status: Wrong Answer
import math
X, Y = map(int, input().split())
c = math.log2(Y // X)
if math.ceil(c) == int(c):
  print(int(c))
else:
  print(math.ceil(c))
# Judge status: Wrong Answer
w = input()
wl = []

for i in range(len(w)):
  wl.append(w[i])
  
wl.sort()

a = 1
judge = 1
for n in range(len(w)-1):
  if wl[a+n] == wl[a+n-1]:
    judge += 1
  else:
    if judge%2 != 0:
      print("No")
      exit()
    else:
      judge = 1
  if n == len(w)-2:
    if judge%2 == 0:
      print("Yes")
    else:
      print("No")
# Judge status: Wrong Answer
n,k = map(int,input().split())
li = list(map(int,input().split()))
time_li = []
for i in range(n-k+1):
    #print(li[i:i+k]) [-30, -10, 10]
    tmp_time_li = []
    tmp = li[i:i+k]
    mi = min(tmp)
    ma = max(tmp)
    if mi*ma >0:
        tmp_time_li.append(ma)
    else:
        orikaeshi = min(abs(mi),abs(ma))*2+max(abs(mi),abs(ma))
        tmp_time_li.append(orikaeshi)
    time_li.append(tmp_time_li[0])
print(min(time_li))
# Judge status: Wrong Answer
import sys
a = []
for l in sys.stdin:
    a.append(l)

if int(a[0]) <= len(a[1]):
  print(a[1][0:7] + '...')
else:
  print(a[1])
# Judge status: Accepted
N = int(input())
*P, = map(int, input().split())

ans = 0
for i in range(N-1):
    if P[i]==(i+1):
        temp = P[i]
        P[i] = P[i+1]
        P[i+1] = temp
        ans = ans + 1
if P[N-1]==(N):
    ans = ans + 1
print(ans)
# Judge status: Accepted
#coding:utf-8
c = input()
ans = ord(c) + 1
print(chr(ans))
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline

n=int(input())
a=list(map(int,input().split()))
b=[0]*10
cnt=0
for i in range(n):
    if a[i]<3200:
        b[a[i]//400]=1
    else:
        cnt+=1
if n==1:
    if a[0]>=3200:
        print(1,1)
        exit()
print(sum(b),sum(b)+cnt)
# Judge status: Accepted
N = int(input())
K = int(input())
X = int(input())
Y = int(input())
def hotel_price(N,K,X,Y):
    if N<=K:
        return N*X
    else:
        return K*X + (N-K)*Y
print(hotel_price(N,K,X,Y))
# Judge status: Accepted
N, K, Q = map(int, input().split())
A = [K-Q] * N
for _ in range(Q):
    i = int(input())
    A[i-1] += 1
cnt = 0
for i in range(N):
    if A[i] > 0:
        ans = 'Yes'
    else:
        ans = 'No'
    print(ans)
# Judge status: Accepted
N = input()
n = len(N)
ans = 'ABC'
if n > 3:
  ans = 'ABD'
print(ans)
# Judge status: Accepted
s = input()
prev = ''
p = 0
count = 0
for i in range(1, len(s) + 1):
    if s[p:i] != prev:
        prev = s[p:i]
        p = i
        count += 1
print(count)
# Judge status: Accepted
N = int(input())
A = []
B = []

for i in range(N):
    a,b = map(int,input().split())
    A.append(a)
    B.append(b)

A.sort()
B.sort()

if N%2 == 1:
    print(B[N//2]-A[N//2]+1)
else:
    x = A[N//2-1]+A[N//2]
    y = B[N//2-1]+B[N//2]
    print(y-x+1)
# Judge status: Accepted
a, b = map(int, input().split())
print('IMPOSSIBLE' if (b + a) % 2 else (b + a) // 2)
# Judge status: Wrong Answer
s = input()
n = len(s)

bef = s[0]
key = 0
ans = 1
for i in range(1, n):
  if key == i:
    continue
  if bef == s[i]:
    if i == n-1:
      continue
    bef = s[i+1]
    ans += 1
    key = i+1
  else:
    bef = s[i]
    ans += 1
print(ans)
# Judge status: Accepted
N = int(input())
S = input()
t_min = min(S.count("#"), S.count("."))
S_first = 0
S_second = S.count(".")
for i in range(0,N):
    if S[i] == "#":
        S_first += 1
    else:
        S_second -= 1
    t = S_first + S_second
    t_min = min(t_min, t)
print(t_min)
# Judge status: Wrong Answer
def exception_handling(n, ali):

    ali.sort(reverse=True)

    alimax = ali[0]
    alimax2 = ali[1]

    ans = []

    for i in ali:
        if i != alimax:
            ans.append(alimax)
        else:
            ans.append(alimax2)

    return ans

def main():
    n = int(input())
    ali = [int(input())for i in range(n)]
    ans = exception_handling(n, ali)
    for i in ans:
        print(i)

if __name__ == '__main__':
    main()
# Judge status: Accepted
H,W = map(int,input().split())
if(min(H,W) == 1):
    print(1)
    exit()
print((H*W+(H*W)%2)//2)
# Judge status: Wrong Answer
import bisect
n = int(input())
l = sorted(list(map(int,input().split())))

ans = 0
for i in range(n - 1):
    for j in range(i + 1, n):
        ans += bisect.bisect_left(l,l[i] + l[j]) - (j + 1)
        print(ans)

print(ans)
# Judge status: Accepted
def solve():
    N = int(input())
    P = list(map(int, input().split()))

    mn = P[0]

    cnt = 0
    for p in P:
        if p <= mn:
            cnt += 1
    
        mn = min(mn, p)

    print(cnt)    

if __name__ == '__main__':
    solve()
# Judge status: Accepted
w = list(input())

c = [0] * 26

for ch in w:
    c[ord(ch) - ord("a")] += 1

f = "Yes"
for cnt in c:
    if cnt % 2 == 1:
        f = "No"

print(f)
# Judge status: Wrong Answer
a, b, c=map(int, input().split())
print(a*b/2)
# Judge status: Wrong Answer
S = input()
T = input()

S = S[::-1]
T = T[::-1]
cnt = 0

def answer(S):
    S = S.replace('?', 'a')
    print(S[::-1])
    exit()

for i in range(len(S)):

    if S[i] == '?' or S[i] == T[cnt]:
        if cnt == len(T) - 1:
            S = S[:(i-cnt)] + T + S[i+1:]
            answer(S)
        else:
            cnt += 1
    else:
        cnt = 0

print('UNRESTORABLE')
# Judge status: Accepted
s= list(set(input()))
print('No' if s.count('N')!=s.count('S') or s.count("W") !=s.count('E') else 'Yes')
# Judge status: Accepted
N, K = map(int, input().split())
p = list(map(int, input().split()))
def expect(i):
    return (i+1) / 2


S=[0]

for i, x in enumerate(p, start=1):
    S.append(S[i-1] + expect(x))
    
ans = 0    

for i in range(N - K + 1):
    r = S[i+K] - S[i]
    if r > ans:
        ans = r
print(ans)
# Judge status: Accepted
a,b,c = [input() for i in range(3)]
sa = 'a'
for i in range(1796):
  try:
    if sa ==  'a':
      sa = a[0]
      a = a[1:]

    elif sa ==  'b':
      sa = b[0]
      b = b[1:]

    elif sa ==  'c':
      sa = c[0]
      c = c[1:]
  except:
    print(sa.upper())
    break
# Judge status: Wrong Answer
list=[1, 1, 1, 1, 1]
for i in range(1, 7):
  list.append(6**i)
for j in range(1, 7):
  list.append(9**j)
list=sorted(list, reverse=True)
N=127
count=0
for i in list:
  if i <= N:
    N=N-i
    count+=1
    if N == 0:
        print(count)
# Judge status: Wrong Answer
A, V = map(int,input().split())
B, W = map(int,input().split())
T = int(input())
if A >= B:
    if A + V * T >= B + W * T:
        print('YES')
    else:
        print('NO')
else:
    if V >= W:
        print('NO')
    elif A + V * T >= B + W * T:
        print('YES')
    else:
        print('NO')
# Judge status: Accepted
import sys
readline = sys.stdin.readline

def main():
    N = int(readline())
    S = readline().rstrip()
    res = S[:]

    pls_left = 0
    pls_right = 0
    for s in S:
        if s == '(':
            pls_right += 1
        else:
            if pls_right == 0:
                pls_left += 1
            else:
                pls_right -= 1

    res = '(' * pls_left + S + ')' * pls_right

    print(res)

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
import collections
N=int(input())
A=list(map(int,input().split()))
s=sum(A)
Q=int(input())
d=collections.Counter(A)
for i in range(Q):
  B,C=map(int,input().split())
  s += d[B]*C - d[B]*B
  print(s)
  if d[C] in d:
    d[C]+=d[B]
  else:
    d[C]=d[B]
  d[B]=0
# Judge status: Accepted
H = int(input())
W = int(input())
N = int(input())

import math

if H > W:
	print(math.ceil(N / H))
else:
	print(math.ceil(N / W))
# Judge status: Accepted
import sys

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

a1 = a
b1 = b
c1 = c
cnt = 0
while (a1%2 ==0) and (b1%2 == 0) and (c1%2 == 0):
    a1,b1,c1 = b1//2 + c1//2, c1//2 + a1//2, a1//2 + b1//2
    cnt += 1
    if (a1 == a) and (b1 == b) and (c1 == c):
        print(-1)
        sys.exit()

print(cnt)
# Judge status: Accepted
def main():
    N = int(input())
    S = str(input())
    ans = ''
    alphabet = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
    for i in range(len(S)):
        c = alphabet.index(S[i]) + N
        if c > 25:
            c = c - 26
        ans = ans + alphabet[c]
    print(ans)
main()
# Judge status: Wrong Answer
print('YNeos'[int(input())<30])
# Judge status: Wrong Answer
s = list(input())
k = int(input())
n = len(s)
for i in range(n):
    d = ord('z')-ord(s[i])+1
    if d<=k:
        s[i] = 'a'
        k -= d

if k>0:
    x = ord(s[-1])+k%26
    d = x-ord('z')
    if d>0:
        x = chr('a')+d-1
    s[-1] = chr(x)


print(''.join(s))
# Judge status: Accepted
N = int(input())
L = list(map(int, input().split()))
 
if max(L) < sum(L) - max(L):
    print('Yes')
 
else:
    print('No')
# Judge status: Accepted
from heapq import heappush, heappushpop

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

tasks = [[] for _ in range(M)]

for _ in range(N):
    a, b = map(int, input().split())
    if a <= M:
        tasks[M-a].append(b)
q = []
for day in range(M):
    for v in tasks[day]:
        if len(q) < day + 1:
            heappush(q, v)
        else:
            heappushpop(q, v)
ans = sum(q)
print(ans)
# Judge status: Accepted
n = int(input())
a = map(int, input().split())

border = list(range(400, 3201, 400))
cnt = [0] * (len(border) + 1)
for aa in a:
    for i, k in enumerate(border):
        if aa < k:
            cnt[i] += 1
            break
    else:
        cnt[i+1] += 1

k = len([i for i in cnt[:-1] if i > 0])
print(k, k + cnt[-1]) if k != 0 else print(1, cnt[-1])
# Judge status: Accepted
n=int(input())
w=[""]*n
a=set()
for i in range(n):
    w[i]=input()
cnt=0
for x in w:
    if x in a:
        print("No")
        exit()
    else:
        if cnt>0:
            if bef!=x[0]:
                print("No")
                exit()
        bef=x[-1]
    cnt+=1
    a.add(x)
print("Yes")
# Judge status: Wrong Answer
s = input().rstrip()
n = len(s)

removed = 0
cnt_s = cnt_t = 0

for i in range(n):
    if s[i] == 'S':
        cnt_s += 1
    else:
        cnt_t += 1
    if cnt_t > cnt_s or i == n-1:
        removed += cnt_s
        cnt_s = cnt_t = 0
#     print(cnt_s,cnt_t)
removed += min(cnt_s,cnt_t)
print(len(s) - removed*2)
# Judge status: Accepted
N,K,S = map(int,input().split())
INF = 10**9

A = []
for i in range(K):
    A.append(S)
if S != INF:
    for i in range(N-K):
        A.append(INF)
else:
    for i in range(N-K):
        A.append(INF-1)

print(" ".join(map(str,A)))
# Judge status: Accepted
x,y,z=map(int,input().split())
cnt=0
x-=z
while x>=0:
    x=x-(y+z)
    if x>=0:
        cnt+=1
    else:
        break
        
print(cnt)
# Judge status: Accepted
import sys
import fractions

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

A, B = lr()
print(lcm(A, B))
# Judge status: Accepted
#!/usr/bin python3
# -*- coding: utf-8 -*-

n = int(input())
s = input()
r = s.count('R')
print(s[:r].count('W'))
# Judge status: Accepted
x, y = map(int, input().split())

ans = 2* (10 **9)

if y - (-x) >= 0:  # 最初だけBを押す
    ans = y + x + 1

if -y -x >= 0:  # 最後だけBを押す
    ans = min(ans, -y -x + 1)

if -y - (-x) >= 0:  # 最初と最後にBを押す
    ans = min(ans, -y +x +2)

if y - x >= 0:  # Bは押さない
    ans = min(ans, y-x)

print(ans)
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))
ans = 100*100*100
for d in range(-100,101):
    t = 0
    for e in A:
        t += (e-d)**2
    ans = min(t,ans)
print(ans)
# Judge status: Accepted
a, b, c = map(int, input().split())

if a == b and a != c:
    print('Yes')
elif b == c and b != a:
    print('Yes')
elif c == a and c != b:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
# abc131_b.py
N, L = map(int,input().split())
apple = []
for i in range(N):
    apple.append(L+i)
taste = sum(apple)
diff = 10**9
ans = 0
for i,v in enumerate(apple):
    if diff > abs(taste-(taste-v)):
        diff = abs(taste-(taste-v))
        ans = taste-v
print(ans)
# Judge status: Accepted
s = list(input())
if int(s[0])*10 + int(s[1]) > 12 or int(s[0]) + int(s[1]) == 0:
    if int(s[2])*10 + int(s[3]) <= 12 and int(s[2]) + int(s[3]) != 0:
        print("YYMM")
    else:
        print("NA")

else:
    if int(s[2])*10 + int(s[3]) > 12 or int(s[2]) + int(s[3]) == 0:
        print("MMYY")
    else:
        print("AMBIGUOUS")
# Judge status: Accepted
a,b,c = map(int,input().split())
abclist = [a,b,c]
if abclist.count(5) == 2:
  print("YES")
else:
  print("NO")
# Judge status: Accepted
S = input()
count = 0
flag = False
if S[0] == "A":
    # print(S[2:-1]) #指定部分獲得できる
    tmp = S[2:-1]
    lower = S[1:]
    for i in range(len(tmp)):
        if tmp[i] == "C":
            count += 1
    if count == 1:
        tmpS = S.replace("A","a")
        tmpSS = tmpS.replace("C","c")
        if tmpSS.islower():
            flag = True

if flag:
    print("AC")
else:
    print("WA")