Problem:
 Score : 300 points    Problem Statement In AtCoder, a person who has participated in a contest receives a color , which corresponds to the person's rating as follows:   Rating 1 - 399 : gray  Rating 400 - 799 : brown  Rating 800 - 1199 : green  Rating 1200 - 1599 : cyan  Rating 1600 - 1999 : blue  Rating 2000 - 2399 : yellow  Rating 2400 - 2799 : orange  Rating 2800 - 3199 : red   Other than the above, a person whose rating is 3200 or higher can freely pick his/her color, which can be one of the eight colors above or not. Currently, there are N users who have participated in a contest in AtCoder, and the i -th user has a rating of a_i . Find the minimum and maximum possible numbers of different colors of the users.      Constraints  1 ≤ N ≤ 100  1 ≤ a_i ≤ 4800  a_i is an integer.         Input Input is given from Standard Input in the following format:  N  a_1  a_2  ...  a_N       Output Print the minimum possible number of different colors of the users, and the maximum possible number of different colors, with a space in between.        Sample Input 1 4
2100 2500 2700 2700      Sample Output 1 2 2  The user with rating 2100 is "yellow", and the others are "orange". There are two different colors.       Sample Input 2 5
1100 1900 2800 3200 3200      Sample Output 2 3 5  The user with rating 1100 is "green", the user with rating 1900 is blue and the user with rating 2800 is "red". If the fourth user picks "red", and the fifth user picks "blue", there are three different colors. This is one possible scenario for the minimum number of colors. If the fourth user picks "purple", and the fifth user picks "black", there are five different colors. This is one possible scenario for the maximum number of colors.       Sample Input 3 20
800 810 820 830 840 850 860 870 880 890 900 910 920 930 940 950 960 970 980 990      Sample Output 3 1 1  All the users are "green", and thus there is one color.

Solution (Python):
from bisect import bisect_right

N = int(input())
A = [int(s) for s in input().split()]
r = [400, 800, 1200, 1600, 2000, 2400, 2800, 3200]
c = [0] * 9
for a in A:
    i = bisect_right(r, a)
    c[i] += 1
ans = 8 - c[:-1].count(0)
print(max(1, ans), ans + c[8])

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
thresholds = [1, 400, 800, 1200, 1600, 2000, 2400, 2800, 3200]
thresholds.reverse()

counts = [0 for _ in range(len(thresholds))]
for a_i in a:
    for i, threshold in enumerate(thresholds):
        if a_i >= threshold:
            counts[i] += 1
            break

sum = 0
for i in range(1, len(counts)):
    sum += 1 if counts[i] > 0 else 0
print("{} {}".format(max(1, sum), sum + counts[0]))

Solution (Python):
import sys
import bisect
input = sys.stdin.readline
 
def main():
    n=int(input())
    a = list(map(int,input().split()))
    s=[0, 0, 0, 0, 0, 0, 0, 0, 0]
    for i in range(n):
        if(a[i]>=3200):
            s[8]+=1
        else:
            s[(a[i]//400)]=1
    ans=0
    for i in range(8):
        ans+=s[i]
    M=ans+s[8]
    if(ans==0):
        ans=1
    print(ans,M)
    
    
main()

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
color = [0 for _ in range(8)]
e = 0

for a in A:
    k = a // 400
    if k < 8 and color[k] == 0:
        color[k] += 1
    elif k >= 8:
        e += 1

c = color.count(1)
y = e + c

if c == 0:
    x = 1
else:
    x = c

print(x, y)

Solution (Python):
def main():
    N = int(input())
    A = [int(a) for a in input().split()]

    if all(a >=3200 for a in A):
        return 1, len(A)

    cls = set()
    count = 0
    for a in A:
        isAbove = True
        for i in range(8):
            if 400*i <= a < 400*(i+1):
                cls.add(i)
                isAbove = False
                break
        if isAbove:
            count += 1
    return len(cls), len(cls)+count

if __name__ == '__main__':
    output = main()
    print(" ".join(map(str, output)))

Solution (Python):
def main():
    N = int(input())
    a = list(map(int,input().split()))
    col_list = [0]*8
    free = 0
    for i in range(N):
        if a[i] < 3200:
            col = a[i]//400
            col_list[col] += 1
        else:
            free += 1
    non_col = col_list.count(0)
    print(max(1,8-non_col),8-non_col+free)

if __name__ == "__main__":
    main()

Solution (Python):
N = int(input())
As = list(map(int, input().split()))
s = set()
ne = 0
for A in As:
  t = A//400
  if t >= 8:
    ne += 1
  else:
    s.add(t)
if len(s) == 0 and ne > 0:
  tmin = 1
else:
  tmin = len(s)
tmax = len(s)+ne
print(tmin, tmax)

Solution (Python):
from collections import defaultdict
n = int(input())
a = list(map(int, input().split()))

d = defaultdict(int)
for i in range(n):
    for border in reversed(range(0, 3201, 400)):
        if a[i] >= border:
            d[border] += 1
            break

ans_min = ans_max = 0
if 3200 in d:
    if len(d) > 1:
        ans_min, ans_max = len(d)-1, len(d)-1+d[3200]
    else:
        ans_min, ans_max = 1, d[3200]
else:
    ans_min, ans_max = len(d), len(d)

print(ans_min, ans_max)

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
for i in range(n):
	a[i]//=400
free=0
b=set()
for i in range(n):
	if a[i]>=8:
		free+=1
	else:
		b.add(a[i])
cnt=len(b)
x=max(cnt,1)
y=(cnt+free)
print(x,y)

Solution (Python):
import bisect
color = range(400,3201,400)
num_color = len(color)
p = [0]*(num_color+1)
N=int(input())
for a in input().split():
    a=int(a)
    p[bisect.bisect_right(color, a)]+=1
print(max(1, num_color-p[:-1].count(0)), num_color-p[:-1].count(0)+p[-1])

Solution (Python):

import math

if __name__ == '__main__':
    N = int(input())
    a = list(map(int, input().split()))

    A = set()
    over = 0
    for b in a:
        val = b // 400
        if val >= 8:
            over += 1
        else:
            A.add(val)

    num = len(A)
    min = num
    if min == 0 and over >= 1:
        min = 1

    if over >= 1:
        num += over
        
            

    print(min, num)

Solution (Python):
import bisect
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7

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

C = np.array([a // 400 for a in A])
C[C >= 8] = 8

ans = 0
for i in range(8):
    ans += np.any(C == i)
print(max(ans, 1), ans + (C == 8).sum())

Solution (Python):
N = int(input())
a = list(map(int,input().split()))
A = []
B = []
d = []
for i in a:
    add = i // 400
    if add < 8:
        A.append(add)
    else:
        B.append(add)
    if add not in d and add < 8:
        d.append(add)
ans_min = len(d)
if len(d) == 0 and len(B) > 0:
    ans_min = 1
ans_max = len(d) + len(B)
print(ans_min)
print(ans_max)

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
max_l = set()
min_l = set()

for i in range(n):
    if 1 <= a[i] < 400:
        min_l.add(1)
    elif 400 <= a[i] < 800:
        min_l.add(2)
    elif 800 <= a[i] < 1200:
        min_l.add(3)
    elif 1200 <= a[i] < 1600:
        min_l.add(4)
    elif 1600 <= a[i] < 2000:
        min_l.add(5)
    elif 2000 <= a[i] < 2400:
        min_l.add(6)
    elif 2400 <= a[i] < 2800:
        min_l.add(7)
    elif 2800 <= a[i] < 3200:
        min_l.add(8)
    else:
        max_l.add(i)

min_v = max(1,len(min_l))



max_v = len(min_l)+len(max_l)
        
print(min_v,max_v)

Solution (Python):
N = int(input())
a = list(map(int,input().split()))
li = [0]*8
overrate = kind = 0
for i in range(N):
    if a[i]>=3200:
        overrate += 1
        continue
    else:
        li[a[i]//400] += 1

for j in range(8):
    if li[j]!=0:
        kind += 1

if kind==0:
    print(1,kind+overrate)
else:
    print(min(8,kind),kind+overrate)

Solution (Python):
n = int(input())
*l, = map(int,input().split())
pro = 0
amature = set()
for i in l:
  j = i//400
  if j >=8:
    pro+=1
  else:
    amature.add(j)
minans = max([1,len(amature)])
maxans = len(amature) + pro
print(minans, maxans)

Solution (Python):
n = int(input())
an = [int(x) for x in input().split()]
result = [0] * 8
colorful = 0
for a in an:
    if a >= 3200:
        colorful += 1
    else:
        result[a // 400] += 1
color = len([x for x in result if x > 0])
print(max(1, color), color + colorful)

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
color = [0 for _ in range(8)]
e = 0

for a in A:
    k = a // 400
    if k < 8 and color[k] == 0:
        color[k] += 1
    elif k >= 8:
        e += 1

c = color.count(1)
y = e + c

if c == 0:
    x = 1
else:
    x = c

print(x, y)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
b = [0] * 9
for i in a:
    if 1 <= i <= 399:
        b[0] += 1
    elif 400 <= i <= 799:
        b[1] += 1
    elif 800 <= i <= 1199:
        b[2] += 1
    elif 1200 <= i <= 1599:
        b[3] += 1
    elif 1600 <= i <= 1999:
        b[4] += 1
    elif 1999 <= i <= 2399:
        b[5] += 1
    elif 2400 <= i <= 2799:
        b[6] += 1
    elif 2800 <= i <= 3199:
        b[7] += 1
    else:
        b[8] += 1
cnt = 0
for i in range(len(b)-1):
    if b[i] != 0:
        cnt += 1
print(cnt if cnt != 0 else 1 if b[-1] != 0 else 0, cnt if b[-1] == 0 else cnt + b[-1])

Solution (Python):
N = int(input())
a = list(map(int, input().split()))

check = [0] * 9
for i in range(N):
    if 1 <= a[i] <= 399:
        check[0] += 1
    elif 400 <= a[i] <= 799:
        check[1] += 1
    elif 800 <= a[i] <= 1199:
        check[2] += 1
    elif 1200 <= a[i] <= 1599:
        check[3] += 1
    elif 1600 <= a[i] <= 1999:
        check[4] += 1
    elif 2000 <= a[i] <= 2399:
        check[5] += 1
    elif 2400 <= a[i] <= 2799:
        check[6] += 1
    elif 2800 <= a[i] <= 3199:
        check[7] += 1
    elif 3200 <= a[i]:
        check[8] += 1

tmp = 0
for i in range(len(check)-1):
    if check[i] >= 1:
        tmp += 1

ans_min = max(1,tmp)
ans_max = tmp + check[-1]

ans = str(ans_min) + ' ' + str(ans_max)
print(ans)

Solution (Python):

import sys
from collections import Counter
INF = float("inf")


def solve(N: int, a: "List[int]"):
    c = Counter()
    for aa in a:
        c[min(aa//400, 8)] += 1

    tot = 0
    for k in c:
        if k == 8:
            continue
        else:
            tot += 1
    if tot == 0 and c[8] > 0:
        print(1, c[8])
    else:
        print(tot, tot+c[8])

    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    a = [int(next(tokens)) for _ in range(N)]  
    solve(N, a)


if __name__ == '__main__':
    main()

Solution (Python):
from collections import defaultdict

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

colorCount = defaultdict(int)

for a in A:
    if a < 400:
        colorCount['a'] += 1
    elif a < 800:
        colorCount['b'] += 1
    elif a < 1200:
        colorCount['c'] += 1
    elif a < 1600:
        colorCount['d'] += 1
    elif a < 2000:
        colorCount['e'] += 1
    elif a < 2400:
        colorCount['f'] += 1
    elif a < 2800:
        colorCount['g'] += 1
    elif a < 3200:
        colorCount['h'] += 1
    else:
        colorCount['z'] += 1

minAns = len(colorCount)
maxAns = minAns
if colorCount['z'] > 0:
    if minAns == 1:
        minAns = 1
        maxAns = colorCount['z']
    else:
        minAns -= 1
        maxAns = maxAns - 1 + colorCount['z']

print(minAns, maxAns)

Solution (Python):
N=input()
a=list(map(int,input().split()))
j=range(400,3600,400)
c=[0]*8
r=0
for i in a:
    for k in range(8):
        if i>=3200:
            r+=1
            break
        if i<j[k]:
            c[k]+=1
            break
ans=8-c.count(0)
print(max(ans,1),ans+r)

Solution (Python):
N = int(input())
a = list(map(int, input().split()))

rates = [400, 800, 1200, 1600, 2000, 2400, 2800, 3200]
l = [0] * 8
tmp = 0
for i in range(N):
    for j in range(8):
        if a[i] < rates[j]:
            l[j] = 1
            break
    else:
        tmp += 1

print(max(sum(l), 1), sum(l)+tmp)

Solution (Python):
import sys
input = sys.stdin.readline

N = int(input())
a = [int(i) for i in input().split()]

color = [0] * 8
over = 0
for i in range(N) :
    if a[i] >= 3200 :
        over += 1
    else :
        color[a[i]//400] += 1

m = 8 - color.count(0)
print(max(1, m), m + over)

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
color = [0,0,0,0,0,0,0,0,0]
for i in range(n):
    for j in range(1,9):
        if a[i]<400*j and 400*(j-1) <= a[i] and color[j-1] == 0:
            color[j-1] += 1
    if a[i] >= 3200:
        color[8] += 1
print(max(1,sum(color[0:8])),sum(color))

Solution (Python):


def f(v):
    idx = [399, 799, 1199, 1599, 1999, 2399, 2799, 3199, 9999]
    for i, maxval in enumerate(idx):
        if v <= maxval: return i


def solve():
    N = int(input())
    colors = [0] * 9

    for i in [int(v) for v in input().split()]:
        colors[f(i)] += 1

    _cnt = len([c for c in colors[:-1] if c > 0])

    max_cnt = _cnt + colors[-1]
    min_cnt = 1 if _cnt == 0 else _cnt
    print(min_cnt, max_cnt)

solve()

Solution (Python):

n = int(input())
rt = list(map(int,input().split()))
clr = [0 for _ in range(9)]
for i in range(n):
  now = rt[i] // 400
  try:
    clr[now] += 1
  except:
    clr[8] += 1
ans = 0
top = clr[8]
for j in range(8):
  if clr[j] != 0:
    ans += 1
if top == 0:
  print(ans,ans)
else:
  print(max(ans,1),ans+top)

Solution (Python):
rates  = [399,799,1199,1599,1999,2399,2799,3199]
from collections import defaultdict


def return_index(score):
  for i in rates:
    if score <= i:
      return rates.index(i)
  else:
    return 8

N = int(input())
A = list(map(int,input().split()))
d = defaultdict(int)
for a in A:
  d[return_index(a)] += 1
key_len = len(d.keys())
num_of_9s = d[8]
has_9 = 1 if num_of_9s > 0 else 0
print("{} {}".format(max(1,key_len-has_9),key_len-has_9+num_of_9s ))

Solution (Python):
n = int(input())
a = list(map(int, input().split()))

l = []
over3200 = 0
for i in a:
    if i >= 3200:
        over3200 += 1
    else:
        l.append(i//400)
if over3200 == n:
    print(1, over3200)
else:
    print(len(set(l)),len(set(l))+over3200)

Solution (Python):

from collections import Counter


def main():
    n = int(input())
    C = Counter(map(lambda x: int(x) // 400, input().split()))
    colored = sum(i < 8 for i in C.keys())  
    free = sum(j for i, j in C.items() if i >= 8)  
    x, y = max(1, colored), colored + free  
    print(x, y)


if __name__ == "__main__":
    main()

Solution (Python):
n = int(input())
lst = [int(i) for i in input().split()]
rate = [0] * 8
num = 0

for i in range(n):
    k = lst[i] // 400
    if k < 8 and rate[k] == 0:
        rate[k] += 1
    elif k >= 8:
        num += 1


c = rate.count(1)
y = num+c
if c == 0:
    x = 1
else:
    x = c

print(x,y)

Solution (Python):


from bisect import bisect_left

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

pre=0
cnt=0
for i in range(1,9):
    idx=bisect_left(a,i*400)
    if idx==pre or idx==0:continue
    cnt+=1
    pre=idx

    
if idx<n:
    if cnt==0:
        cnt+=1
        res=n-idx
    else:
        res=n-idx+cnt

else:res=cnt
print(cnt,res,sep=' ')

Solution (Python):
N = int(input())
a = list(map(int, input().split()))
score = [[1,399,0],[400,799,0],[800,1199,0],[1200,1599,0],[1600,1999,0],[2000,2399,0],[2400,2799,0],[2800,3199,0],[3200,4800,0]]

for i in range(N):
    for j in range(len(score)):
        if score[j][0] <= a[i] <= score[j][1]:
            score[j][2] += 1
            break
        else:
            continue
ans = 0
for _,_,cnt in score[:-1]:
    if cnt >= 1:
        ans += 1
print(max(1, ans, ans-score[-1][2]), ans+score[-1][2])

Solution (Python):
n=int(input())
a = list(map(int, input().split()))
b = 0
c = 0
d = 0
e = 0
f = 0
g = 0
h = 0
k = 0
ans = 0
j=0
for i in range(n):
    col = a[i]
    if col <= 399 and b == 0:
        b = 1
        ans += 1
    elif 400 <= col <= 799 and c == 0:
        c = 1
        ans += 1
    elif 800 <= col <= 1199 and d == 0:
        d = 1
        ans += 1
    elif 1200 <= col <= 1599 and e == 0:
        e = 1
        ans += 1
    elif 1600 <= col <= 1999 and f == 0:
        f = 1
        ans += 1
    elif 2000 <= col <= 2399 and g == 0:
        g = 1
        ans += 1
    elif 2400 <= col <= 2799 and h == 0:
        h = 1
        ans += 1
    elif 2800 <= col <= 3199 and k == 0:
        k = 1
        ans += 1
    elif 3200<=col:
        ans += 1
        j += 1
if ans == j:
    print(1, "", ans)
else:
    print(ans-j,"",ans)

Solution (Python):
N=int(input())
a=list(map(int,input().split()))
b,c=[],0
b.append(len([a for a in a if a<400]))
b.append(len([a for a in a if a<800 and a>=400]))
b.append(len([a for a in a if a<1200 and a>=800]))
b.append(len([a for a in a if a<1600 and a>=1200]))
b.append(len([a for a in a if a<2000 and a>=1600]))
b.append(len([a for a in a if a<2400 and a>=2000]))
b.append(len([a for a in a if a<2800 and a>=2400]))
b.append(len([a for a in a if a<3200 and a>=2800]))
b.append(len([a for a in a if a>=3200]))
for i in range(8):
    if b[i]>0:
        c+=1
if b[8]>0:
    if c==0:
        print(1,b[8])
    else:        
        print(c,c+b[8])
else:
    print(c,c)

Solution (Python):

n = int(input())
an = list(map(int,input().split()))
rate_bucket = [0] * 9
ret = 0
for a in an:
    rate_bucket[min(a//400,8)]+=1
for i in rate_bucket[0:-1:]:
    if i > 0:
        ret+=1
print("{} {}".format(max(ret,1),ret+rate_bucket[-1]))

Solution (Python):
from bisect import bisect as bisect

def main():
    score = [1, 400, 800, 1200, 1600, 2000, 2400, 2800, 3200]
    M = len(score)
    N = int(input())
    A = [int(x) for x in input().split()]

    colors = set()
    m = 0
    for a in A:
        i = bisect(score, a)
        if i != M:
            colors.add(i)
        elif i == M:
            m += 1
    print(len(colors) if len(colors) > 0 else 1, len(colors)+m)

main()

Solution (Python):
n = int(input())
a = list(map(int, input().split()))

colorlist = [0] * 8
freecolor = 0
colormin = 0
for i in a:
    if i >= 3200:
        freecolor += 1
    else:
        colorlist[i // 400] += 1




for i in colorlist:
    if i != 0:
        colormin += 1


if colormin == 0:
    print(1, end=' ')
else:
    print(colormin, end=' ')


s = colormin + freecolor
if s > n:
    s = n
print(s)

Solution (Python):
li_a = [399, 799, 1199, 1599, 1999, 2399, 2799, 3199, 1000000]
li_b = ["a", "b", "c", "d", "e", "f", "g", "h", 1]

n = int(input())
people = list(map(int,input().split()))
ans = []
cnt = 0

s = 0
t = 0

for i in range(n):
    for j in range(9):
        if people[i] >= 3200:
            cnt += 1
            break
        elif people[i] <= li_a[j]:
            ans.append(li_b[j])
            break

ans = list(set(ans))
if cnt > 0:
    t = cnt
if len(ans) == 0:
    s = 1
print(len(ans)+s,len(ans)+t)

Solution (Python):
n = int(input())
li = list(map(int, input().split()))
co_li = [0]*8
any_col = 0
for s in li:
    if s < 400:
        co_li[0] += 1
    elif 400 <= s < 800:
        co_li[1] += 1
    elif 800 <= s < 1200:
        co_li[2] += 1
    elif 1200 <= s < 1600:
        co_li[3] += 1
    elif 1600 <= s < 2000:
        co_li[4] += 1
    elif 2000 <= s < 2400:
        co_li[5] += 1
    elif 2400 <= s < 2800:
        co_li[6] += 1
    elif 2800 <= s < 3200:
        co_li[7] += 1
    elif 3200 <= s:
        any_col += 1
color_kind = sum(x>0 for x in co_li)
is_all_any_color = sum(co_li) == 0
min_sum = color_kind + (1 if is_all_any_color is True else 0)
max_sum = color_kind + any_col
print(min_sum,max_sum)

Solution (Python):
N = int(input())
rates = list(map(int, input().split()))
over = 0
colors = []
GREY = 0
BROWN = 1
GREEN = 2
SKY = 3
BLUE = 4
YELLOW = 5
ORANGE = 6
RED = 7

for rate in rates:
  if rate <= 399:
    if not GREY in colors:
      colors.append(GREY)
  elif rate <= 799:
    if not BROWN in colors:
      colors.append(BROWN)
  elif rate <= 1199:
    if not GREEN in colors:
      colors.append(GREEN)
  elif rate <= 1599:
    if not SKY in colors:
      colors.append(SKY)
  elif rate <= 1999:
    if not BLUE in colors:
      colors.append(BLUE)
  elif rate <= 2399:
    if not YELLOW in colors:
      colors.append(YELLOW)
  elif rate <= 2799:
    if not ORANGE in colors:
      colors.append(ORANGE)
  elif rate <= 3199:
    if not RED in colors:
      colors.append(RED)
  else:
    over += 1
min_c = max(1, len(colors))
max_c = len(colors)+over
print(min_c, max_c)

Solution (Python):

import sys


def solve(N: int, a: "List[int]"):
    ans = [0] * 8
    a32 = 0
    for i in a:
        if(i >= 3200):
            a32 += 1
        else:
            if(i < 400):
                ans[0] +=1
            elif(400 <= i < 800):
                ans[1] +=1
            elif(800 <= i < 1200):
                ans[2] +=1
            elif(1200 <= i < 1600):
                ans[3] +=1
            elif(1600 <= i < 2000):
                ans[4] +=1
            elif(2000 <= i < 2400):
                ans[5] +=1
            elif(2400 <= i < 2800):
                ans[6] +=1
            elif(2800 <= i < 3200):
                ans[7] +=1

    if(ans.count(0) == 8):
        if(a32 > 0):
            print(1, a32)
        else:
            print(0, 0)
    else:
        print(8-ans.count(0), 8-ans.count(0)+a32)
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    a = [ int(next(tokens)) for _ in range(N) ]  
    solve(N, a)

if __name__ == '__main__':
    main()

Solution (Python):

import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import math
import itertools
import random
 




 
def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    N = inputInt()
    A = inputList()
    
    free = 0
    a = [0 for _ in range(8)]
    
    for i in A:
        if i < 400:
            a[0] += 1
        elif i < 800:
            a[1] += 1
        elif i < 1200:
            a[2] += 1
        elif i < 1600:
            a[3] += 1
        elif i < 2000:
            a[4] += 1
        elif i < 2400:
            a[5] += 1
        elif i < 2800:
            a[6] += 1
        elif i < 3200:
            a[7] += 1
        else:
            free += 1
            
    ans = 0
    for i in a:
        if i == 0:
            continue
        if i != 0:
            ans += 1
            
    if ans != 0:
        print("{} {}".format(ans, ans+free))
    else:
        print("{} {}".format(1, ans+free))
    
        
if __name__ == "__main__":
	main()

Solution (Python):
from collections import Counter

N = int(input())
A = [int(_) // 400 if int(_) <= 3199 else 8 for _ in input().split()]

min_counter = Counter(A).copy()
if 8 in min_counter.keys():
    min_counter.pop(8)
    if not min_counter:
        minimum = 1
    else:
        minimum = len(min_counter)
else:
    minimum = len(min_counter)

maximum = 0
max_counter = Counter(A).copy()

if 8 in max_counter.keys():
    maximum = max_counter[8]
    max_counter.pop(8)
    maximum += len(max_counter)
else:
    maximum += len(max_counter)

print(minimum, maximum)

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
cnt=0
arr=[]
for i in range(n):
  color=a[i]//400
  if color>=8:
    cnt+=1
  else:
    arr.append(color)
b=max(1,len(set(arr)))
c=len(set(arr))+cnt
print(b,c)

Solution (Python):
N = int(input())
S = [int(zz) for zz in input().split()]

ans = set()
p = 0
for i in S:
    q = i // 400
    if q < 8:
        ans.add(q)
    else:
        p += 1

if N == 1:
    print(1, 1)
else:
    print(max(1,len(ans)), len(ans) + p)

Solution (Python):
import sys
input=sys.stdin.readline
n=int(input())
a_list=list(map(int,input().split()))
rate=[False]*8
free=0
for i in a_list:
    if i<3200:
        rate[i//400]=True
    else:
        free+=1
count=0
for i in rate:
    if i:
        count+=1
if count==0:
    Min=1
else:
    Min=count
Max=count+free
print(Min,Max)

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
l=[0]*9
for i in range(n):
    if a[i]//400<8:l[a[i]//400]=1
    else: l[8]+=1
print(max(1,sum(l[:8])),sum(l))

Solution (Python):
N = int(input())
A = list(map(int, input().split()))

rate = [0 for _ in range(8)]
free = 0
for a in A:
    r = a // 400
    if r >= 8:
        free += 1
    else:
        rate[r] += 1

a1 = 0
for r in rate:
    if r != 0:
        a1 += 1
a2 = free + a1
if a1 == 0:
    a1 = 1
print(a1, a2)

Solution (Python):
from collections import Counter
 
n = int(input())
a = [int(i) for i in input().split()]
c = Counter()
b = 0
for i in a:
    if i < 3200:
        c.update([i//400])
    else: b += 1
print(len(c) if len(c) else 1, len(c) + b)

Solution (Python):
import sys

n = int(sys.stdin.readline())
a_list = [int(x) for x in sys.stdin.readline().split()]

color_list = [0] * 8
rainbow = 0
for i in a_list:
    if int(i / 400) < 8:
        color_list[int(i / 400)] += 1
    else:
        rainbow += 1
color_list = [i for i in color_list if i != 0]
confirm = len(color_list)
if confirm == 0:
    print(1, min(8, rainbow))
else:
    print(confirm, confirm + rainbow)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
color = {"grey":False, "brown":False, "green":False, "light_blue":False, "blue":False, "yellow":False, "orange":False, "red":False}
free = 0
def rate(n):
    global free
    if 1 <= n <= 399:
        color["grey"] = True
    elif 400 <= n <= 799:
        color["brown"] = True
    elif 800 <= n <= 1199:
        color["green"] = True
    elif 1200 <= n <= 1599:
        color["light_blue"] = True
    elif 1600 <= n <= 1999:
        color["blue"] = True
    elif 2000 <= n <= 2399:
        color["yellow"] = True
    elif 2400 <= n <= 2799:
        color["orange"] = True
    elif 2800 <= n <= 3199:
        color["red"] = True
    else:
        free += 1
for i in range(n):
    rate(a[i])
print(max(list(color.values()).count(True), 1), list(color.values()).count(True) + free)

Solution (Python):
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
ch_cnt = 0
b = []
for i in range(n):
    if a[i] >= 3200:
        ch_cnt += 1
        b.append('special')
    elif a[i] < 3200 and a[i] >= 2800:
        b.append('red')
    elif a[i] < 2800 and a[i] >= 2400:
        b.append('orange')
    elif a[i] < 2400 and a[i] >= 2000:
        b.append('yellow')
    elif a[i] < 2000 and a[i] >= 1600:
        b.append('blue')
    elif a[i] < 1600 and a[i] >= 1200:
        b.append('cyan')
    elif a[i] < 1200 and a[i] >= 800:
        b.append('green')
    elif a[i] < 800 and a[i] > 400:
        b.append('brown')
    else:
        b.append('gray')
b_cnt = Counter(b)
spe_cnt = 0
if b_cnt['special']:
    spe_cnt += b_cnt['special']
    if len(b_cnt) == 1:
        print(1, min(8, spe_cnt))
    else:
        print(len(b_cnt)-1, len(b_cnt)-1+spe_cnt)
else:
    print(len(b_cnt), len(b_cnt))

Solution (Python):
from sys import stdin
N = int(stdin.readline().rstrip())
A = [int(_) for _ in stdin.readline().rstrip().split()]
count = 0
colors = [False]*8
for a in A:
    q, r = divmod(a, 400)
    if q < 8:
        colors[q] = True
    else:
        count += 1
ans = sum(colors)
if ans > 0:
    print(ans, ans + count)
else:
    print(1, ans + count)

Solution (Python):
N=int(input())
A=list(map(int,input().split()))
C=[]
r=0
cnt=0
for a in A:
    aa=min(a//400,8)
    if aa in C:pass
    else:
        C.append(aa)
        cnt+=1
    if aa==8:r+=1
if r==0:print(cnt,cnt)
else:print(max(1,cnt-1),cnt+r-1)

Solution (Python):
n=int(input())
L=list(map(int,input().split()))
L.sort()
tmp=0
cnt=0
min_c=0
max_c=0

for i in range(n):
	if L[i] <= 399:
		cnt+=1
		tmp=i
		break

for i in range(tmp,n):
	if L[i] >= 400 and L[i] <= 799:
		cnt+=1
		tmp=i
		break

for i in range(tmp,n):
	if L[i] >= 800 and L[i] <= 1199:
		cnt+=1
		tmp=i
		break
		
for i in range(tmp,n):
	if L[i] >= 1200 and L[i] <= 1599:
		cnt+=1
		tmp=i
		break
		
for i in range(tmp,n):
	if L[i] >= 1600 and L[i] <= 1999:
		cnt+=1
		tmp=i
		break

for i in range(tmp,n):
	if L[i] >= 2000 and L[i] <= 2399:
		cnt+=1
		tmp=i
		break
		
for i in range(tmp,n):
	if L[i] >= 2400 and L[i] <= 2799:
		cnt+=1
		tmp=i
		break

for i in range(tmp,n):
	if L[i] >= 2800 and L[i] <= 3199:
		cnt+=1
		tmp=i
		break
		
min_c=cnt
max_c=cnt

for i in range(tmp,n):
	if L[i] >= 3200:
		max_c=cnt+len(L[i:])
		if min_c==0:
			min_c+=1
		break
		
print(min_c,max_c)

Solution (Python):
from copy import *
from sys import *
import math
import queue
from collections import defaultdict,Counter,deque
from fractions import Fraction as frac

setrecursionlimit(1000000)


def main():
	n = int(input())
	a = list(map(int,input().split()))
	color = [0 for i in range(8)]
	free = 0
	for i in a:
		if(i//400>7):
			free+=1
		else:
			color[i//400] = 1
	print(str(max(1,sum(color)))+' '+str(min(10**100,sum(color)+free)))


def zip(a):
	mae = a[0]
	ziparray = [mae]
	for i in range(1,len(a)):
		if(mae != a[i]):
			ziparray.append(a[i])
			mae = a[i]
	return ziparray

def is_prime(n):
	if n < 2: return False

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

	return True

def list_replace(n,f,t):
	return [t if i==f else i for i in n]

def base_10_to_n(X, n):
	X_dumy = X
	out = ''
	while X_dumy>0:
		out = str(X_dumy%n)+out
		X_dumy = int(X_dumy/n)
	if(out == ''): return '0'
	return out

def gcd(m,n):
	x = max(m,n)
	y = min(m,n)
	while(x%y!=0):
		z = x%y
		x = y
		y = z
	return y

class Queue():
	def __init__(self):
		self.q = deque([])
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.popleft()
	def size(self):
		return len(self.q)
	def debug(self):
		return self.q

class Stack():
	def __init__(self):
		self.q = []
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.pop()
	def size(self):
		return len(self.q)
	def debug(self):
		return self.q

class graph():
	def __init__(self):
		self.graph = defaultdict(list)
	def addnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].append(t)
		self.graph[t].append(f)
	def rmnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].remove(t)
		self.graph[t].remove(f)
	def linked(self,f):
		return self.graph[f]

class dgraph():
	def __init__(self):
		self.graph = defaultdict(set)
	def addnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].append(t)
	def rmnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].remove(t)
	def linked(self,f):
		return self.graph[f]

main()

Solution (Python):
N = int(input())
a = list(map(int, input().split()))

colors = set()
free_num = 0
for rate in a:
    if rate < 400:
        colors.add("grey")
    elif rate < 800:
        colors.add("brown")
    elif rate < 1200:
        colors.add("green")
    elif rate < 1600:
        colors.add("sky")
    elif rate < 2000:
        colors.add("blue")
    elif rate < 2400:
        colors.add("yellow")
    elif rate < 2800:
        colors.add("orange")
    elif rate < 3200:
        colors.add("red")
    else:
        free_num += 1
if len(colors) > 0:        
    print(len(colors), free_num + len(colors))
else:
    print(1, free_num)

Solution (Python):
input()
an = [int(i) for i in input().split()]
score = [0]*13
ans = 0

for i in an:
  score[i//400] += 1   
for i in score[:8]:
  if i:
    ans += 1

k = sum(score[8:])

if ans == 0 and k:
  print(1,k)
else:
  print(ans,ans+k)