peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
check = [chr(i) for i in range(97, 97+26)]
n = int(input())
li = [input() for _ in range(n)]
ans = [0] * 26


for i in range(26):
    cnt = 1000
    for j in range(n):
        cnt = min(cnt, li[j].count(check[i]))
    ans[i] = cnt

char = ''

for x, y in zip(check, ans):
    char += x*y

print(char)
# Judge status: Accepted
import math

N,D = map(int,input().split())
iCnt = 0
while N > 0:
    N -= 1 
    x,y = map(int,input().split())
    if math.sqrt(x**2 + y**2) <= D:
        iCnt += 1
print(iCnt)
# Judge status: Accepted
N, Y = map(int, input().split())
Yen = Y/1000

for i in range(N+1):
    for j in range(N+1-i):
        if i*10 + j*5 + (N-i-j) == Yen:
            print(i, j, N-i-j)
            exit()
print('-1 -1 -1')
# Judge status: Accepted
o=str(input())
e=str(input())
ans=''
if len(o)==len(e):
  for i in range(len(o)):
    ans+=o[i]
    ans+=e[i]
else:
  for i in range(len(e)):
    ans+=o[i]
    ans+=e[i]
  ans+=o[len(o)-1]
print(ans)
# Judge status: Accepted
ss=input().split()
s=[si[0].upper() for si in ss]
print("".join(s))
# Judge status: Wrong Answer
import sys
import fractions as fr
import numpy as np
input = sys.stdin.readline

def lcm(a,b):
    return int(a*b/fr.gcd(a,b))

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

a=list((np.array(a))//2)

res = 1
for i in range(N):
    res = lcm(res,a[i])
    if res >= (10**12):
        print(0)
        exit()
#print(res)
if M < res:
    print(0)
    exit()
k = (M-res)//(2*res)+1
print(k)
# Judge status: Wrong Answer
import sys
S = list(input())
s = list(set(S))
s.sort()
alfa = list('abcdefghijklmnopqrstuvwxyg')
ans = 0
if(len(s)==len(alfa)):
  print('None')
else:
  for i in range(len(s)):
    if(s[i]!=alfa[i]):
      print(alfa[i])
      sys.exit()
  print(alfa[len(s)])
# Judge status: Accepted
#from collections import deque,defaultdict
from sys import stdin
input = stdin.readline
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

x = inn()
for i in range(1,361):
    #if ((180-x)*i)%360==0:
    if ((x)*i)%360==0:
        print(i)
        exit()
# Judge status: Wrong Answer
h, w = map(int, input().split())

if h == 1 or w == 1:
    print(1)
print(h * w + 1 // 2)
# Judge status: Wrong Answer
K,S=open(0);K=int(K.split()[1])


def count_unhappy():
    u=0
    for i in range(1,len(S)):
        if S[i] != S[i-1]:u+=1
    return max(u - 2 * K, 1)


print(len(S) - count_unhappy())
# Judge status: Accepted
X, Y, A, B, C = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

p.sort(reverse = True)
q.sort(reverse = True)
r.sort()

p = p[:X]
a = q[:Y] + p
z = []
a.sort(reverse = True)

while len(a) != 0 and len(r) != 0 and r[-1] > a[-1]:
    k = r.pop()
    del a[-1]
    z.append(k)   

print(sum(a) + sum(z))
# Judge status: Wrong Answer
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

l = [a, b, c, d, e]
k = []
for i in l:
    k.append(i - ((i - 1) //10) * 10)
m = 10 - min(k)
for i in l:
    i = (i // 10 + 1) * 10
print(sum(l) - m)
# Judge status: Wrong Answer
n=int(input())
s=[int(input()) for i in range(n)]

s.sort()
S=sum(s)

if S%10!=0:
    print(S)
else:
    for num in s:
        S-=num
        if S%10!=0:
            print(S)
            exit()
    
    print(0)
# Judge status: Wrong Answer
N = int(input())
Sort = [str(x) for x in range(1,N+1)]
P = [str(x) for x in input().split()]

Count = 0
for T in range(0,N):
    if Sort[T] != P[T]:
        print(Sort[T])
        Count += 1
if Count==0 or Count==2:
    print('YES')
else:
    print('NO')
# Judge status: Wrong Answer
n = int(input())
aaa = [int(input()) for _ in range(n)]
num = 1
ans = -1
for i in range(n):
    num = aaa[num - 1]
    if num == 2:
        ans = i + 1
print(ans)
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))

A.sort()

ai = A[-1]

M = min(ai-A[0], A[0])
aj = A[0]

for i in range(N):
    m = min(ai-A[i], A[i])
    if M < m:
        aj = A[i]
        M = m

print(ai,aj)
# Judge status: Accepted
N,P=map(int,input().split())
A=list(map(int,input().split()))
g=k=0
for i in A:
    if i%2:
        k+=1
    else:
        g+=1
a=0
from math import factorial
if P:
    for i in range(1,k+1,2):
        a+=factorial(k)//factorial(i)//factorial(k-i)
else:
    for i in range(0,k+1,2):
        a+=factorial(k)//factorial(i)//factorial(k-i)
print(a*pow(2,g))
# Judge status: Accepted
s = int(input())
mod = 10 ** 9 + 7

fact = [1] * s
inv = [1] * s
invf = [1] * s
for i in range(2, s):
  fact[i] = fact[i-1] * i % mod
  inv[i] = -(mod // i) * inv[mod % i] % mod
  invf[i] = invf[i-1] * inv[i] % mod

count = 0
rest = s
for n in range(1, s // 3 + 1):
  rest -= 3
  count = (count + fact[rest + n - 1] * invf[rest] * invf[n - 1]) % mod
print(count)
# Judge status: Accepted
n,m = map(int,input().split())
q = [0]*n
wa = [0]*n
for _ in range(m):
    pp,s = input().split()
    p = int(pp)

    if q[p-1] == 0:
        if s == "WA":
            wa[p-1] += 1
        else:
            q[p-1] = 1
qq = 0
wawa = 0
for i in range(n):
    if q[i] > 0:
        wawa += wa[i]
    qq += q[i]
print(qq,wawa)
# Judge status: Accepted
# coding: utf-8

# https://atcoder.jp/contests/abc110
# 14:05-


def main():
    a, b, c = map(int, input().split())
    abc = sorted([a, b, c], reverse=True)

    return abc[0] * 10 + abc[1] + abc[2]


print(main())
# Judge status: Accepted
a, b = map(int, input().split())
s = str(input())
slist = list(s)
if not slist.count('-') == 1:
  print('No')
else:
  if slist[a] == '-':
    print('Yes')
  else:
    print('No')
# Judge status: Accepted
from itertools import accumulate
n, m, k = map(int, input().split())
Acum = [0]+list(accumulate(map(int, input().split())))
Bcum = [0]+list(accumulate(map(int, input().split())))

ans = 0
b = m
for a in range(n+1):
    if k < Acum[a]:
        break
    while k < Acum[a]+Bcum[b]:
        b -= 1
    if ans < a+b:
        ans = a+b
print(ans)
# Judge status: Accepted
s=input()

print(s.replace("2017","2018"))
# Judge status: Accepted
a,b,c,x,y = map(int,input().split())
ans=a*x+b*y
if x>y:
    e = c*2*y
    f = a*(x-y)
    ans=min(ans,e+f)
    g= 2*c*x
    ans=min(ans,g)
else:
    e = c*2*x
    f = b*(y-x)
    ans = min(ans,e+f)
    g = 2*c*y
    ans = min(ans,g)

print(ans)
# Judge status: Wrong Answer
n,m=map(int,input().split())
A=[]
W=[]
L=[]
ac=0
wa=0
wa_0=0
for i in range(m):
    a,b=map(str,input().split())
    if int(a) not in A and b == "AC":
        ac+=1
        A.append(int(a))
        wa+=wa_0
        wa_0=0

    elif int(a) not in A and b=="WA":
        wa_0+=1

    
    
print(ac,wa)
# Judge status: Accepted
w,h,n = map(int, input().split())
a,b,c,d = 0,0,w,h
for _ in range(n):
    x,y,i = map(int, input().split())
    if i == 1:
        a = max(a,x)
    elif i == 2:
        c = min(c,x)
    elif i == 3:
        b = max(b,y)
    elif i == 4:
        d = min(d,y)

print(max(0,c-a) * max(0,d-b))
# print(a,b,c,d)
# Judge status: Accepted
a,b = map(int,input().split())
ans = (a + b) % 24
print(ans)
# Judge status: Accepted
a,b,c = map(int, input().split())

if a%2 == 0 or b%2 == 0 or c%2 == 0:
    print(0)
    exit()

al = [a,b,c]
al.sort()
print(al[0]*al[1])
# Judge status: Wrong Answer
N,M = list(map(int,input().split()))
if N%2 == 1:
    for i in range(M):
        print(i+1,2*M-i)
else:
    print(1,2*M+1)
    for i in range(1,M):
        print(i+1,2*M-i)
# Judge status: Wrong Answer
x, y = map(int,input().split())

if x*y < 0: #異符号→反転可能性あり
    print(abs(abs(x)-abs(y))+1)

else: #同符号→反転可能性なし
    if x <= y:
        print(y-x)
    else:
        print(x-y+2)
# Judge status: Wrong Answer
# C - pushpush
n = int(input())
a = list(map(str,input().split()))

b = [""]*n
var = 0

for i in range(n):
    res = a[i]
    var += i*(-1)**i
    ind = n//2 + var
    b[ind] = res

ans = " ".join(b)
print(ans)
# Judge status: Wrong Answer
A=list(map(int,input()))
if (str(A[0])+str(A[1]))==(str(A[2])+str(A[3])):
    print("Good")
else:
    print("Bad")
# Judge status: Accepted
A, B = list(map(int, input().split()))

ans = 0
for i in range(2):
    if A >= B:
        ans += A
        A -= 1
    else:
        ans += B
        B -= 1
print(ans)
# Judge status: Wrong Answer
n = int(input().strip())
# s = input().strip()
# A, B, C = map(int, input().strip().split())
L = list(map(int, input().strip().split()))
# L = [int(input().strip()) for _ in range(n)]
# L = [list(map(int, input().split())) for _ in range(n)]
ans=10**6+1
for p in range(L[-1]+1):
    tmp=0
    for x in L:
        tmp+=(x-p)**2
    ans=min(ans,tmp)
print(ans)
# Judge status: Accepted

n = int(raw_input())
ais = map(int, raw_input().split())
ais.sort()
vv= sum(ais)/len(ais)
def g(ais,m):
	s= 0
	for ai in ais: s+=abs(ai - m) **2
	return s
print min([g(ais,m) for m in [vv+dela for dela in [-1,0,+1]]])
# Judge status: Accepted
N, X, T = map(int, input().split())
count = 1
check = X
if X > 1:
    while True:
        value = int(N / X)
        re = N % X
        if re == 0:
            count = value
            TotalTime = T * count
            break
        else:
            count += value
            TotalTime = T * count
            break
else:
    TotalTime = T * N
print(TotalTime)
# Judge status: Accepted
import numpy as np
n = int(input())
lst = [(a-e-1) for e,a in enumerate(list(map(int,input().split())))]
b = int(np.median(lst))
ans = 0
for a in lst:
    ans += abs(a-b)
print(ans)
# Judge status: Accepted
s, t = input().split()
print(t,s,sep='')
# Judge status: Accepted
def main():
    n = int(input())
    a = list(map(int, input().split()))
    b = [0]*(n+1)
    ans = []
    for i in range(n, 0, -1):
        if sum(b[i::i])%2 != a[i-1]:
            ans.append(i)
            b[i] = (b[i]+1)%2
    print(len(ans))
    if len(ans):
        print(*reversed(ans))

if __name__ == '__main__':
    main()
# Judge status: Accepted
a,b,c = map(int, input().split())
if a+b>=c: print('Yes')
else: print('No')
# Judge status: Accepted
N = int(input())

a = 0
b = 1
c = 1
d = 8

mod = 10**9 + 7

for _ in range(N-1):
    a = (a * 10 + b + c) % mod
    b = (b * 9 + d) % mod
    c = (c * 9 + d) % mod
    d = (d * 8) % mod
print(a)
# Judge status: Accepted
import sys


def input():
    return sys.stdin.readline().strip()


sys.setrecursionlimit(10 ** 9)


def main():
    X = input()
    answer = len(X)
    cnt_s = 0
    for x in X:
        if x == "S":
            cnt_s += 1
            continue
        if cnt_s > 0:
            cnt_s -= 1
            answer -= 2
            
    print(answer)


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
S=input()
if(S>"2019/04/30"):
  print("Heisei")
else:
  print("TBD")
# Judge status: Wrong Answer
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    N, K, S = map(int, input().split())

    s20 = S // 2
    s21 = S - s20
    ans = set()
    for i in range(K):
        ans.add(s20-i)
        ans.add(s21+i)
    if 0 in ans:
        ans.remove(0)
        ans.add(10 ** 9 + 1)
    print(' '.join(map(str, ans)))

if __name__ == '__main__':
    main()
# Judge status: Accepted
# coding: utf-8


def solve(*args: str) -> str:
    n, x, y = map(int, args[0].split())

    ret = [0]*n
    for i in range(1, n):
        for j in range(i+1, n+1):
            ret[min(j-i, 1+abs(x-i)+abs(y-j))] += 1
    return '\n'.join(map(str, ret[1:]))


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))
# Judge status: Accepted
a=input()
s=a[:3]+"8"+a[4:]
print(s)
# Judge status: Wrong Answer
#import 
#=input()
s=int(input())
#=map(int,input().split())
#=list(map(int,input().split()))
#=[list(map(int,input().split())) for _ in range()]
mod = 10 ** 9 + 7

def f(a,b,c):
    re = 1
    q = max(b, c)
    for i in range(q+1, a+1):
        re *= i
    w = min(b, c)
    for i in range(1, w+1):
        re //= i
    return re % mod

ans = 0
fin = s // 3
for n in range(1, fin + 1):
    ans = (ans + f(s - 2*n - 1, s - 3*n, n-1) % mod)
print(ans)
# Judge status: Accepted
n, a, b = map(int, input().split())
s = list(input())

result = []
cnt = 0
cnt_b = 0
limit = a + b

for student in s:
    if student == "c":
        result.append("No")
    elif (student == "a") & (cnt < limit):
        result.append("Yes")
        cnt += 1
    elif (student == "b") & (cnt < limit) & (cnt_b < b):
        result.append("Yes")
        cnt += 1
        cnt_b += 1
    else:
        result.append("No")
print("\n".join(result))
# Judge status: Wrong Answer
A=sorted(list(map(int,input().split())))
K=int(input())
print(A[2]*2*K+sum(A[:2]))
# Judge status: Wrong Answer
s=input()
ans=753
for i in range(3,len(s)+1):
    print(s[i - 3:i])
    ans=min(abs(int(s[i-3:i])-753),ans)
print(ans)
# Judge status: Accepted
import sys
input = sys.stdin.readline


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

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

candidate = [min(A)+min(B)]

for _ in range(m):
    x, y, c = map(int, input().split())
    cost = A[x-1] + B[y-1] - c
    candidate.append(cost)

print(min(candidate))
# Judge status: Accepted
n,m,k=map(int,input().split())
ans="No"
for i in range(n//2+1):
  for j in range(m):
    o=i*j+(m-j)*(n-i)
    x=n*m-o
    if o==k or x==k:
      ans="Yes"
print(ans)
# Judge status: Wrong Answer
N,K = list(map(int,input().split()))
n=(N-K)//(K-1)+1
mod=(N-K)%(K-1)
print(n+1)
# Judge status: Wrong Answer
a, b, k = map(int, input().split())

li = []
for i in range(a, min(a+k,b+1)):
    li.append(i)
for i in range(max(b-k+1, a), b+1):
    li.append(i)
li.sort()
set_li = set(li)
for i in set_li:
    print(i)
# Judge status: Accepted
# input
x = list(map(int, input().split()))

# check
for idx, num in enumerate(x):
    if num == 0:
        print(idx + 1)
        exit(0)
# Judge status: Accepted
a, b = map(int, input().split())
print("Odd" if a*b%2 else "Even")
# Judge status: Wrong Answer
s = str(input())
S = s.split('/')
if int(S[0]) < 2019:
  print('TBD')
elif int(S[0]) == 2019 :
  if int(S[1]) < 4:
    print('TBD')
  else:
    if int(S[2]) < 30:
      print('TBD')
    else:
      print('Heisei')
else:
  print('Heisei')
# Judge status: Accepted
def function(args):
    X = int(args)
    ureshisa = 0
    div, mod = divmod(X,500)
    ureshisa += div*1000
    div, mod = divmod(mod,5)
    ureshisa += div*5
    
    return str(ureshisa)

if __name__ == '__main__':
    print(function(input()))
# Judge status: Accepted
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

N, M = map(int, input().split())
print(max([x for x in make_divisors(M) if x <= M // N]))
# Judge status: Wrong Answer
import math

N = input()
if N == '0':
  print(0)

As = [int(a) for a in input().split()]
Fs = [math.floor(math.log2(a)) if a % 2 == 0 else 0 for a in As]

print(int(min(Fs)))
# Judge status: Accepted
import itertools
N,K = map(int,input().split())
d = list()
A = list()
for _ in range(K):
    d.append(int(input()))
    A.append(list(map(int,input().split())))
A = list(itertools.chain.from_iterable(A))
A = set(A)
print(N-len(A))
# Judge status: Accepted
def main():
    n = input()

    if n[-1] in ['2','4','5','7','9']:
        print('hon')
        return
    elif n[-1] in ['0','1','6','8']:
        print('pon')
        return
    else:
        print('bon' )


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
N = int(input())
s = [input() for i in range(N)]
M = int(input())
t = [input() for i in range(M)]
a = 0
for i in range(0,N):
    if s.count(i) > 0:
        for j in range(0,M):
            if a < (s.count(s[i]) - t.count(t[j])):
                a = s.count(s[i]) - t.count(t[j])
            else:
                continue
print(a)
# Judge status: Accepted
def main():
    n = int(input())
    num_list = list(map(int, input().split()))

    ans = 0
    
    num_list.sort()

    left = num_list[int(n/2)-1] + 1
    right = num_list[int(n/2)]

    for i in range(left,right+1):
        ans += 1
            
    print(ans)

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
a, b = map(int, input().split())
print(a)
print(b)
answer = a * b
print(answer)
# Judge status: Accepted
def gcd(a: int, b: int) -> int:
    return a if b == 0 else gcd(b, a%b)

def lcm(a: int, b: int) -> int:
    return int(a * b / gcd(a, b))

x = int(input())
print(int(lcm(x, 360) / x))
# Judge status: Accepted
#%%
S = input()
if S[-1] == 's':
    print(S+'es')
else:
    print(S+'s')
# Judge status: Accepted
def f(a,b): return a <= 8 and b <= 8
a,b = map(int, raw_input().split())
print 'Yay!' if f(a,b) else ':('
# Judge status: Wrong Answer
import math
def func(x):
    return math.pi*2*x
  
print(func(5))
# Judge status: Accepted
A,B,T =  map(int,input().split())
print((T//A)*B)
# Judge status: Wrong Answer
a = map(int, input().split())
a = int(list(a)[0])

ans = 'No'
while a > 99:
    if a % 10 == 7:
        ans = 'Yes'
        break
    a /= 10
    a = int(a)

print(ans)
# Judge status: Accepted
n, m = map(int, input().split())
arr_ = [tuple(map(int, input().split())) for _ in range(m)]

one = set([b for a, b in arr_ if a == 1])
last = set([a for a, b in arr_ if b == n])
connect = one & last
if len(connect) >= 1:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
# Judge status: Accepted
N = int(input())
ans ='No'
for i in range(1,10):
    for j in range(1,10):
        if i * j == N:
            ans = 'Yes'
            break
    else:
        continue
    break
print(ans)
# Judge status: Accepted
s=input()
key="keyence"
n=len(s)
for i in range(n-1):
    for j in range(1,n):
        if s[:i]+s[j:]==key:
            print("YES")
            exit()
print("NO")
# Judge status: Accepted
al = ["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"]
N = int(input())
M = N
v = 1
while True:
    if(M<=26**v):
        break
    M -= 26**v
    v += 1
for i in range(v):
    N -= 26**i  
ans = []
for i in range(v):
    ans.append("a")
for i in range(v):
    ans[-i-1]=al[N%26]
    N = N//26
ans.reverse()
anss = ""
for i in range(len(ans)):
    anss += ans[-i-1]
print(anss)
# Judge status: Accepted
a=input().split();print(0--~-int(a[0])//~-int(a[1]))
# Judge status: Accepted
x,y = map(int, input().split())
cnt = 0
while x<=y:
    cnt += 1
    x *= 2
print(cnt)
# Judge status: Accepted
k = int(input())
s = 7
num = 1
res = True
if k == 2:
    print(-1)
else:
    for i in range(k):
        s %= k
        if s == 0:
            res = False
            print(num)
            break
        num += 1
        s *= 10
        s += 7
    if res:
        print(-1)
# Judge status: Accepted
n = int(input())
A = [int(input()) for _ in range(n)]
ans = 0
for i in range(n-1):
    x,y = A[i], A[i+1]
    ans += x//2
    if x%2!=0 and y > 0:
        ans += 1
        A[i+1] -= 1
ans += A[-1]//2

print(ans)
# Judge status: Accepted
a,b=input().split()

li=[a*int(b),b*int(a)]
li.sort()

print(li[0])
# Judge status: Accepted
x=list(map(int,input().split()))
print(15-sum(x))
# Judge status: Accepted
H, N = map(int, input().split())
A = 0
for i in input().split():
    A += int(i)

if A >= H:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n = int(input())


if n%10 == 0 or n%10 ==1 or n%10 ==6 or n%10 ==8:
    print("pon")
elif n%10 == 3:
    print("bon")
else:
    print("hon")
# Judge status: Wrong Answer
a = int(input())
a += a**2
a += a*3
print(a)
# Judge status: Accepted
N, X = map(int, input().split())
L = list(map(int, input().split()))
z = 0
L.insert(0,0)
for i in range(len(L)):
  bound = i+1
  z += L[i]
  if z > X:
    bound -= 1
    break
print(bound)
# Judge status: Wrong Answer
n = int(input())

cnt = 0

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

    if cnt >= 3:
        print('Yes')
        exit()
    if a == b:
        cnt += 1

    else:
        cnt = 0

print('No')
# Judge status: Accepted
import heapq


def main():
    for _ in range(M):
        mx = heapq.heappop(A) * -1 // 2 * -1
        heapq.heappush(A, mx)

    print(sum(A) * -1)


if __name__ == "__main__":
    N, M = map(int, input().split())
    A = [int(x) * -1 for x in input().split()]
    heapq.heapify(A)
    main()
# Judge status: Wrong Answer
N, T = map(int, input().split())
lists = [list(map(int, input().split())) for i in range(N)]

cost = 0
count = 0
for i in range(N):
    if lists[i][1] <= T:
        if i == 0:
            cost = lists[i][0]
            count += 1
        elif cost > lists[i][0]:
            cost = lists[i][0]
            count += 1
        else:
            count += 1
            continue
    else:
        continue
if count == 0:
    print("TLE")
else:
    print(cost)
# Judge status: Accepted
import sys
sys.setrecursionlimit(10**7)
mo=10**9+7
n=int(input())
a=[0]*9
for s in map(int,input().split()):
    for i in range(8):
        if int(s)>=i*400 and (i+1)*400>int(s):
            a[i]=1
    if int(s)>=3200:
        #print(int(s),'rain')
        a[8]+=1
    
#print(a)
ans=sum(a[0:8])
#ans=[ans,min(8,a[8]+ans)]
ans=[max(1,ans),a[8]+ans]
print(*ans)
# Judge status: Wrong Answer
w = 199

x = int(input())

if x >= 400 and x < 600:
    print(8)
elif x >= 600 and x < 800:
    print(7)
elif x >= 800 and x < 1000:
    print(6)
elif x >= 1000 and x < 1200:
    print(5)
elif x >= 1200 and x < 1400:
    print(4)
elif x >= 1400 and x < 1600:
    print(3)
elif x >= 1600 and x < 1800:
    print(1)
elif x >= 1800 and x < 2000:
    print(1)
# Judge status: Wrong Answer
import sys

count = 0
for i in sys.stdin:
    if count == 0:
        K = int(i)
        count += 1
    else:
        S = i
        
length = len(S)
if length <= K:
    print(S)
else:
    S_ = S[:K]+"..."
    print(S_)
# Judge status: Accepted
from fractions import gcd
n, m = map(int, input().split())
aa = list(map(int, input().split()))


lcm = 1
def p2(m):
    cnt = 0
    n = m
    while 1:
        if n%2 == 0:
            cnt += 1
            n = n//2
        else:
            break
    return cnt
pp = p2(aa[0])
for a in aa:
    lcm = a * lcm // gcd(a, lcm)
    if pp != p2(a):
        lcm = 10 **18
        break
tmp = lcm // 2
print((m // tmp + 1) // 2)
# Judge status: Wrong Answer
n=int(input())
h=list(map(int,input().split()))
for i in range(n-1):
    if h[i]>h[i+1]:
        h[i]-=1
print('Yes' if h==sorted(h) else 'No')
# Judge status: Wrong Answer

n = int(input())
a = list(map(int,input().split()))
m = max(a)
s = 0

ind = a.index(m)
for i in range(n):
    if i == n-1:
        break
    else:
        if a[i]>a[i+1] and i < ind:
            s += a[i]-a[i+1]

        else:
            a[i]>a[i+1]
            s += a[ind]-a[i+1]
            
print(s)
# Judge status: Accepted
x1, x2, x3, x4, x5= map(int, input().split())
if x1==0:
    print("1")
elif x2 == 0:
    print("2")
elif x3 == 0:
    print("3")
elif x4 ==0:
    print("4")
elif x5 == 0:
    print("5")
# Judge status: Accepted
a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())
if abs(b - a) <= (v - w) * t:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
import bisect
import sys
def input(): return sys.stdin.readline().strip()


N, C, K = map(int, input().split())
T = sorted([int(input()) for i in range(N)])

TT = [i + K for i in T]

cnt = 0
i = 0
temp = -1  # temp番まで運び終わった
while True:
    i = bisect.bisect_right(T, TT[i])
    if i - temp > C:
        i = temp + C + 1
        temp += C
    cnt += 1
    temp = i - 1
    if i >= N:
        break
print(cnt)
# Judge status: Accepted
n =  int(input())
a = list(map(int,input().split()))

for i in range(n):
    if a[i]%2==1:
        pass
    else:
        if a[i]%3 !=0 and a[i]%5 !=0:
            print('DENIED')
            exit(0)
        else:
            pass
print("APPROVED")