Harryxun/stf_run huggingface dataset:
# No DP No LIFE
# 配るDP, 要復習
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def main():
    H, N = MAP()
    L = [LIST() for i in range(N)]
    A = []
    B = []
    for i in range(N):
        A.append(L[i][0])
        B.append(L[i][1])

    dp = [INF] * 20010
    dp[0] = 0
    for i in range(10010):
        for j in range(N):
            dp[i+A[j]] = min(dp[i+A[j]], dp[i]+B[j])
    ans = INF
    for i in range(H, 20010):
        ans = min(ans, dp[i])
    print(ans)

if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def main():
    h, a = MAP()
    count = 0
    while h > 0:
        h = h - a
        count += 1
    print(count)

if __name__ == "__main__":
    main()
a,b = input().split(" ")
a_plus_b = a+b
a_minus_b = a-b
a_mul_b = a*b

max_three = max(a_plus_b, max(a_minus_b, a_mul_b))
print(max_three)

### FIXED CODE ###

a,b = [int(s) for s in input().split(" ")]
a_plus_b = a+b
a_minus_b = a-b
a_mul_b = a*b

max_three = max(a_plus_b, max(a_minus_b, a_mul_b))
print(max_three)
N = int(input())
a_list = list(map(int, input().split()))
a_list = [ (i+2, s) for i, s in enumerate(a_list) ]
a_list = sorted(a_list, key=lambda x: x[1])
count = 0
boss = 1
for a in a_list:
    if a[1] == boss:
        count += 1
    else:
        diff = a[1] - boss
        for _ in range(diff):
            print(count)
            count = 0
        boss = a[1]
        count += 1

for _ in range(N - a_list[-1][1]+1):
    print(count)
    count = 0

### FIXED CODE ###

print(int(input()) * 2 * 3.141)
a, b, c = map(int, input().split())
print(a * b // 2))

### FIXED CODE ###

a, b, c = map(int, input().split())
print(int(a * b / 2))
k = int(input())
s = input()

n = len(s)
mod = 10**9+7


def framod(n, mod, a=1):
    for i in range(1, n+1):
        a = a * i % mod
    return a


def power(n, r, mod):
    if r == 0:
        return 1
    if r % 2 == 0:
        return power(n*n % mod, r//2, mod) % mod
    if r % 2 == 1:
        return n * power(n, r-1, mod) % mod


def comb(n, k, mod):
    a = framod(n, mod)
    b = framod(k, mod)
    c = framod(n-k, mod)
    return (a * power(b, mod-2, mod) * power(c, mod-2, mod)) % mod


com = [1]*k
for i in range(k+1):
    comb[i+1] = comb

a25 = [1]*(k+1)
for i in range(k):
    a25[i+1] = a25[i]*25 % mod
a26 = [1]*(k+1)
for i in range(k):
    a26[i+1] = a26[i]*26 % mod
num = 0
for i in range(0, k+1):
    num = (num+comb(i+n-1, n-1, mod)*a25[i] % mod * a26[k-i]) % mod
print(num)


### FIXED CODE ###

k = int(input())
s = input()

n = len(s)
mod = 10**9+7


def framod(n, mod, a=1):
    for i in range(1, n+1):
        a = a * i % mod
    return a


def power(n, r, mod):
    if r == 0:
        return 1
    if r % 2 == 0:
        return power(n*n % mod, r//2, mod) % mod
    if r % 2 == 1:
        return n * power(n, r-1, mod) % mod


def comb(n, k, mod):
    a = framod(n, mod)
    b = framod(k, mod)
    c = framod(n-k, mod)
    return (a * power(b, mod-2, mod) * power(c, mod-2, mod)) % mod


com = [1]*(k+1)
for i in range(k):
    com[i+1] = com[i]*(n+i)*pow(i+1, mod-2, mod) % mod

a25 = [1]*(k+1)
for i in range(k):
    a25[i+1] = a25[i]*25 % mod
a26 = [1]*(k+1)
for i in range(k):
    a26[i+1] = a26[i]*26 % mod
num = 0
for i in range(0, k+1):
    num = (num+com[i]*a25[i] % mod * a26[k-i]) % mod
print(num)
input = input()

a = int(input[0])
b = int(input[1])
c = int(input[2])

if (a+b+c < 22): print("bust")
else: print("win")

### FIXED CODE ###

input = input().split()

a = int(input[0])
b = int(input[1])
c = int(input[2])

if (a + b + c < 22): print("win")
else: print("bust")
def insertion_sort(a, n, g):
    ct = 0
    for i in range(g, n):
        v = a[i]
        j = i-g
        while j >= 0 and a[j] > v:
            a[j+g] = a[j]
            j -= g
            ct += 1
        a[j+g] = v
    return ct

def interval_list(n):
    m = 0
    gi= 1
    g = []
    while b <= n:
        m += 1
        g.append(gi)
        b = 4**m + 3 * 2**(m-1) + 1
        # shell_sort ???????????¨????????????????????????????????\?????????URL
        # http://www.programming-magic.com/20100507074241/
    return g.reverse()

if __name__ == "__main__":
    n = int(input())
    A = list(int(input()) for _ in range(n))
    G = interval_list(n)
    print(len(G))
    print(*G)
    
    ct= 0
    for i in G:
        ct += insertion_sort(A, n, i)
    print(ct)
    print(*A, sep="\n")

### FIXED CODE ###

def insertion_sort(a, n, g):
    ct = 0
    for i in range(g, n):
        v = a[i]
        j = i-g
        while j >= 0 and a[j] > v:
            a[j+g] = a[j]
            j -= g
            ct += 1
        a[j+g] = v
    return ct

def interval_list(n):
    m = 0
    gi= 1
    g = []
    while gi <= n:
        m += 1
        g.append(gi)
        gi = 4**m + 3 * 2**(m-1) + 1
        # good convergence
        # http://www.programming-magic.com/20100507074241/
    g.reverse()
    return g


if __name__ == "__main__":
    n = int(input())
    A = list(int(input()) for _ in range(n))
    G = interval_list(n)
    print(len(G))
    print(*G)
    
    ct= 0
    for i in G:
        ct += insertion_sort(A, n, i)
    print(ct)
    print(*A, sep="\n")
R = int(raw_input())
G = int(raw_input())
b = 2*G + R
print(b)

### FIXED CODE ###

R = int(input())
G = int(input())
b = 2*G - R
print(b)
N=input()
li = list(map(int,input().split()))

mal = 1
for i in li:
    mal = mal * i
cnt =0
while mal % 2 == 0:
    mal = mal / 2
    cnt += 1
print(cnt)

### FIXED CODE ###

N=input()
li = list(map(int,input().split()))
cnt =0
for i in li:
    while i % 2 == 0:
        i =  i / 2
        cnt += 1
print(cnt)
import math

N,X = map(int,input().split())
x = [int(i) for i in input().split()]

for i in range(N):
    x[i] = abs(X-x[i])

if N == 1:
    print(x[0])
    exit()

ans = math.gcd(x[0],x[1])

if N == 2:
    print(ans)
    exit()
    
for i in range(N-2):
    ans = math.gcd(ans,x[i+2])
    
print(ans)

### FIXED CODE ###

import fractions

N,X = map(int,input().split())
x = [int(i) for i in input().split()]

for i in range(N):
    x[i] = abs(X-x[i])

if N == 1:
    print(x[0])
    exit()

ans = fractions.gcd(x[0],x[1])

if N == 2:
    print(ans)
    exit()
    
for i in range(N-2):
    ans = fractions.gcd(ans,x[i+2])
    
print(ans)
s = input() + "lllllll"
n = len(s)
tt = 0
ts = 0
for i in range(n-3):
    #print(s[i])
    if s[i] == "B" and s[i+1] == "W":
        #print("Hello")
        tt+=1
        #if s[i+2] == "B" and s[i+3] == "W":tt+=1
        for j in range(1,n-i,2):
            if s[i+j+1] == "B" and s[i+j+2] == "W":tt+=1
        for k in range(1,i+1):
            #print(k,i)
            if i - k >= 0 and s[i-k] == "B":tt+=1
            else:break
        for j in range(1,n-i):
            #print(j,i)
            if i + j <= n-2 and s[i+j+1] == "W":tt+=1
            else:break
        i = i+j+1
print(tt)

### FIXED CODE ###

a = input()
b = 0
bt = 0
w = 0
wt = 0
for i in range(len(a)):
    if a[i] == "B":bt = 1
    if bt == 1 and a[i] == "B":b+=1
    if a[i] =="W":
        w+=b
        wt +=1
print(w)
A,B = map(int, input().split())
print((B-1)//(A-2) + 1)

### FIXED CODE ###

import math
Input = input().split(" ")
A = int(Input[0])
B = int(Input[1])
n = (B-1)/(A-1)
print(math.ceil(n))
import numpy as np
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
 
num_str = input()

num_sum = 0
for i in range(len(num_str)):
  num_sum+=int(num_str[i])
 
if num_sum%9 == 0:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

import numpy as np
import sys
# input = sys.stdin.readline
# sys.setrecursionlimit(10**8)
 
num_str = input()

num_sum = 0
for i in range(len(num_str)):
  num_sum+=int(num_str[i])
 
if num_sum%9 == 0:
  print("Yes")
else:
  print("No")
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy,copy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def main():
    s = list(input())
    t = list(input())
    n = len(s)
    s_dict = defaultdict(int)
    t_dict = defaultdict(int)
    for i in range(n):
        s_dict[s[i]] += 1
        t_dict[t[i]] += 1

    print(s_dict)
    print(t_dict)

    if list(s_dict.values().sort()) == list(t_dict.values().sort()):
        print('Yes')
    else:
        print('No')
        

if  __name__=='__main__':
    main()


### FIXED CODE ###

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy,copy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def main():
    s = list(input())
    t = list(input())
    n = len(s)
    s_dict = defaultdict(int)
    t_dict = defaultdict(int)
    for i in range(n):
        s_dict[s[i]] += 1
        t_dict[t[i]] += 1

    #print(s_dict)
    #print(t_dict)

    if sorted(list(s_dict.values()))== sorted(list(t_dict.values())):
        print('Yes')
    else:
        print('No')
        

if  __name__=='__main__':
    main()
N = input()

tmp = len(N)

ans = 0
for i in range(tmp):
    if i&1 == 1:
        ans += 10**(i) - 10**(i-1)
    elif i == tmp-1:
        ans += int(N[1:]) + 1

# if N[0] == "1" and N[1:]
print(ans)


### FIXED CODE ###

N = input()

tmp = len(N)

if tmp == 1:
    print(int(N))
else:
    ans = 0
    for i in range(tmp):
        if i&1 == 1:
            ans += 10**(i) - 10**(i-1)
        elif i == tmp-1:
            ans += int(N) - int("9"*i)

    # if N[0] == "1" and N[1:]
    print(ans)
import collections
N = int(input())
x = []
for i in range(N):
	x.append(list(map(int, input().split())))
L = []
for i in range(N):
	a, b = x[i][0], x[i][1]
	for j in range(N):
		if a >= x[j][0] and b >= x[j][1] and not(a == x[j][0] and b == x[j][1]):
			L.append((a - x[j][0], b - x[j][1]))
c = collections.Counter(L)
max = c.most_common()[0][1]
print(N - max)

### FIXED CODE ###

import collections
N = int(input())
x = []
for i in range(N):
	x.append(list(map(int, input().split())))
if N == 1:
	print(1)
else:
	L = []
	for i in range(N):
		a, b = x[i][0], x[i][1]
		for j in range(N):
			if a > x[j][0] or b > x[j][1]:
				L.append((a - x[j][0], b - x[j][1]))
	c = collections.Counter(L)
	max = c.most_common(1)[0][1]
	print(N - max)
s=input()
x={}
for i in s:
  if i in x:
    print('no')
    exit()
  else:
    x.add(i)
print('yes')

### FIXED CODE ###

s=input()
x={1}
for i in s:
  if i in x:
    print('no')
    exit()
  else:
    x.add(i)
print('yes')
S = input()
T = input()

S = list(S)
T = list(T)

not_find = False
start_i = 0
for i in range(s_l - t_l + 1):
    start_i = s_l - i - t_l
    here = True
    for j in range(t_l):
        if S[start_i+j] == T[j] or S[start_i+j] == '?':
            here = True
        else:
            here = False
            break
    if here:
        break
    if start_i == 0:
        not_find = True

if not_find:
    print("UNRESTORABLE")
else:
    for s in range(len(S[:start_i])):
        if S[s] == '?':
            S[s] = 'a'

    S[start_i:start_i+t_l] = T

    for s in range(len(S[start_i+t_l:])):
        if S[s] == '?':
            S[s] = 'a'
    print(S)

### FIXED CODE ###

import numpy as np

S = input()
T = input()

npS =  np.array(list(S))
npT =  np.array(list(T))

must_sym_i = npS != '?'

accepted = []
for i in range(len(S)-len(T)+1):
    and_ = npS[i:i+len(T)] == npT
    if all(and_[must_sym_i[i:i+len(T)]]):
        temp = np.copy(npS)
        temp[i:i+len(T)] = npT
        temp[temp == '?'] = 'a'
        accepted.append(temp)

acc = [''.join(list(accepted[i])) for i in range(len(accepted))]

if len(acc) > 0:
    print(sorted(acc)[0])
else:
    print("UNRESTORABLE")
X = int(input())

for n in range(32):
    for e in range(2,11):
        if n**e <= X:
            se = set(n**e)

answer = max(se)
print(answer)

### FIXED CODE ###

X = int(input())
se = set(n**e for n in range(32) for e in range(2,11) if n**e <= X)

answer = max(se)
print(answer)
N = int(input())
H = list(map(int, input().split()))
max_count = 0
for i in range(N):
  tmp_count = 0
  for j in range(i+1, N-i):
  	if H[j-1] <= H[j]:
      tmp_count+=1
  if tmp_count > max_count:
    max_count = tmp_count
print(max_count)

### FIXED CODE ###

N = int(input())
H = list(map(int, input().split()))
tmp = 0
s = 0
for i in range(N-1):
  if H[i] >= H[i+1]:
    tmp += 1
    s = max(s, tmp)
  else:
    tmp = 0
    
print(s)
import math
N = int(input())
a = input().split()
a = [int(i) for i in a]
res_list = {}
def lcm(x,y):
    return (x * y) // math.gcd(x, y)
for i in range(len(a)):
    if i == 0:
        res = a[i]
        continue
    else:
        res = lcm(res,a[i])
res2 = 0
for i in a:
    res2 += (res-1) % i
print(res2)

### FIXED CODE ###


N = int(input())
a = input().split()
a = [int(i) for i in a]
res_list = {}
def gcd(a,b):
    while b:
        a, b = b, a % b
    return a
def lcm(x,y):
    return (x * y) // gcd(x, y)
for i in range(len(a)):
    if i == 0:
        res = a[i]
        continue
    else:
        res = lcm(res,a[i])
res2 = 0
for i in a:
    res2 += (res-1) % i
print(res2)
s=input()
print (chr(ord(s) + 1)

### FIXED CODE ###

s=input()
print (chr(ord(s) + 1))
a,b,c=map(int, input(),split())
if a+b+c >= 22:
  print(bust)
else:
  print(win)

### FIXED CODE ###

a,b,c=map(int,input().split())
if a+b+c>=22:
  print("bust")
else:
  print("win")
s,t = map(input().split())
a,b = map(int,input().split())
u = input()

if s == u:
    print(a-1,b)
else:
    print(a,b-1)

### FIXED CODE ###

s,t = input().split()
a,b = map(int,input().split())
u = input()

if s == u:
    print(a-1,b)
else:
    print(a,b-1)
S = list(input())
S = S[::-1]

t = 0
ans = 0
bc_score = 0
flag = 1

if len(S) <= 2:
    print(0)
    exit()

while t <= len(S)-1:
    if S[t]=="C" and S[t+1] == "B":
        bc_score = 0
        bc_score += 1
        t += 2
        flag = 1
        if t == len(S)-1:
            if S[t] == "A":
                ans += 1
            t += 1
        while flag == 1 and t < len(S) - 1:
            flag = 0
            if S[t]=="C" and S[t+1] == "B":
                bc_score += 1
                t += 2
                flag = 1
            if t <= len(S) - 1:
                if S[t] == "A":
                    ans += bc_score
                    t += 1
                    flag = 1
    else:
        t += 1

print(ans)

### FIXED CODE ###

S = list(input())
S = S[::-1]

t = 0
ans = 0
bc_score = 0
flag = 1

if len(S) <= 2:
    print(0)
    exit()

while t <= len(S)-2:
    if S[t]=="C" and S[t+1] == "B":
        bc_score = 0
        bc_score += 1
        t += 2
        flag = 1
        if t == len(S)-1:
            if S[t] == "A":
                ans += 1
            t += 1
        while flag == 1 and t <= len(S) - 1:
            flag = 0
            if S[t]=="C" and S[t+1] == "B":
                bc_score += 1
                t += 2
                flag = 1
            if t <= len(S) - 1:
                if S[t] == "A":
                    ans += bc_score
                    t += 1
                    flag = 1
    else:
        t += 1

print(ans)
W, H ,x, y = map(int, input().split())
difx = W - x
dify = H - y
if W % x == 0 and H % y == 0:
    print(W * dify, 1)
else:
    if difx >= dify:
        print(difx* H, 0)
    else:
        print(dify * W,0)


### FIXED CODE ###

W, H ,x, y = map(int, input().split())

print(W * H / 2, end=" ")
if 2 * x == W and 2 * y == H:
    print(1)
else:
    print(0)
import fractions
from functools import reduce
import random
import copy

def gcd(numbers):
    return reduce(fractions.gcd, numbers)

n = int(input())
a = list(map(int, input().split()))
ans = 1

if n < 100:
  for i in range(n):
    b = copy.copy(a)
    b.pop(i)
    t = gcd(b)
    if ans < t:
      ans = t
else:
  for _ in 100:
    t = gcd(random.sample(a, 3))
    if ans < t:
      ans = t

print(ans)

### FIXED CODE ###

import fractions
from functools import reduce
import random
import copy

def gcd(numbers):
    return reduce(fractions.gcd, numbers)

n = int(input())
a = list(map(int, input().split()))
ans = 1

if n < 1000:
  for i in range(n):
    b = copy.copy(a)
    b.pop(i)
    t = gcd(b)
    if ans < t:
      ans = t
else:
  for _ in range(200):
    t = gcd(random.sample(a, 500))
    if ans < t:
      ans = t

print(ans)
import functools
import heapq
import logging
import math
import random
import string
import sys
from argparse import ArgumentParser
from collections import defaultdict
from copy import deepcopy
from typing import Dict, List, Optional, Set, Tuple


def solve(values: List[int], nb: int) -> Optional[int]:
    for _v in values:
        pass
    return nb


def do_job():
    "Do the work"
    LOG.debug("Start working")
    # first line is number of test cases
    N = int(input())
    values = list(map(int, input().split()))
    result = solve(values, N)
    print(result)

print(0)

### FIXED CODE ###

#!/usr/bin/env python3
# vim: set fileencoding=utf-8

# pylint: disable=unused-import, invalid-name, missing-docstring, bad-continuation


"""Module docstring
"""

import functools
import heapq
import logging
import math
import random
import string
import sys
from argparse import ArgumentParser
from collections import defaultdict
from copy import deepcopy


def solve(values, nb):
    cost_to = [0] * nb
    cost_to[1] = abs(values[1] - values[0])
    for i in range(2, nb):
        cost_to[i] = min(
            cost_to[i - 2] + abs(values[i] - values[i - 2]),
            cost_to[i - 1] + abs(values[i] - values[i - 1]),
        )
    return cost_to[nb - 1]


def do_job():
    "Do the work"
    LOG.debug("Start working")
    # first line is number of test cases
    N = int(input())
    values = list(map(int, input().split()))
    result = solve(values, N)
    print(result)


def print_output(testcase, result) -> None:
    "Formats and print result"
    if result is None:
        result = "IMPOSSIBLE"
    print("Case #{}: {}".format(testcase + 1, result))


def configure_log(log_file=None) -> None:
    "Configure the log output"
    log_formatter = logging.Formatter(
        "%(asctime)s - %(filename)s:%(lineno)d - " "%(levelname)s - %(message)s"
    )
    if log_file:
        handler = logging.FileHandler(filename=log_file)
    else:
        handler = logging.StreamHandler(sys.stdout)
    handler.setFormatter(log_formatter)
    LOG.addHandler(handler)


LOG = None
# for interactive call: do not add multiple times the handler
if not LOG:
    LOG = logging.getLogger("template")
    configure_log()


def main(argv=None):
    "Program wrapper."
    if argv is None:
        argv = sys.argv[1:]
    parser = ArgumentParser()
    parser.add_argument(
        "-v",
        "--verbose",
        dest="verbose",
        action="store_true",
        default=False,
        help="run as verbose mode",
    )
    args = parser.parse_args(argv)
    if args.verbose:
        LOG.setLevel(logging.DEBUG)
    do_job()
    return 0


if __name__ == "__main__":
    import doctest

    doctest.testmod()
    sys.exit(main())
a, b, c=map(int, raw_input().split())
if a<b<c:
????????print "Yes"
else: 
????????print "No"

### FIXED CODE ###

a, b, c = map(int, raw_input().split())
if a < b < c:
    print "Yes"
else:
    print"No"
N=int(input())
if N[-1]=="2" or N[-1]=="4" or N[-1]=="5" or N[-1]=="7" or N[-1]=="9":
  print("hon")
elif N[-1]=="0" or N[-1]=="1" or N[-1]=="6" or N[-1]=="8":
  print("pon")
elif N[-1]=="3":
  print("bon")


### FIXED CODE ###

N=input()
if N[-1]=="2" or N[-1]=="4" or N[-1]=="5" or N[-1]=="7" or N[-1]=="9":
  print("hon")
elif N[-1]=="0" or N[-1]=="1" or N[-1]=="6" or N[-1]=="8":
  print("pon")
elif N[-1]=="3":
  print("bon")
number = int(input())
rate = [int(i) for i in input().split()]


# In[7]:

counter = {}
for r in rate:
    if 1 <= r < 400:
        counter["grey"] = counter.get("grey", 0) + 1
    if 400 <= r < 800:
        counter["brown"] = counter.get("brown", 0) + 1
    if 800 <= r < 1200:
        counter["green"] = counter.get("green", 0) + 1
    if 1200 <= r < 1600:
        counter["sky"] = counter.get("sky", 0) + 1
    if 1600 <= r < 2000:
        counter["blue"] = counter.get("blue", 0) + 1
    if 2000 <= r < 2400:
        counter["yellow"] = counter.get("yellow", 0) + 1
    if 2400 <= r < 2800:
        counter["orange"] = counter.get("orange", 0) + 1
    if 2800 <= r < 3200:
        counter["red"] = counter.get("red", 0) + 1
    if 3200 <= r:
        counter["color"] = counter.get("color", 0) + 1

answer = 0
for k, v in counter.items():
    if not v == 0:
        answer += 1
        
if counter.get("color", 0) == 0:
    print(str(answer) + " " + str(answer))
else:
    if answer == 1:
        print("1 " + str(counter["colors"]))
    else:
        print(str(answer-1) + " " + str(answer-1+counter["color"]))


### FIXED CODE ###

number = int(input())
rate = [int(i) for i in input().split()]


# In[7]:

counter = {}
for r in rate:
    if 1 <= r < 400:
        counter["grey"] = counter.get("grey", 0) + 1
    if 400 <= r < 800:
        counter["brown"] = counter.get("brown", 0) + 1
    if 800 <= r < 1200:
        counter["green"] = counter.get("green", 0) + 1
    if 1200 <= r < 1600:
        counter["sky"] = counter.get("sky", 0) + 1
    if 1600 <= r < 2000:
        counter["blue"] = counter.get("blue", 0) + 1
    if 2000 <= r < 2400:
        counter["yellow"] = counter.get("yellow", 0) + 1
    if 2400 <= r < 2800:
        counter["orange"] = counter.get("orange", 0) + 1
    if 2800 <= r < 3200:
        counter["red"] = counter.get("red", 0) + 1
    if 3200 <= r:
        counter["color"] = counter.get("color", 0) + 1

answer = 0
for k, v in counter.items():
    if not v == 0:
        answer += 1
        
if counter.get("color", 0) == 0:
    print(str(answer) + " " + str(answer))
else:
    if answer == 1:
        print("1 " + str(counter["color"]))
    else:
        print(str(answer-1) + " " + str(answer-1+counter["color"]))