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):
n=int(input())
a=list(map(int, input().split()))

color=set()
count=0

for aa in a:
    if aa>=3200:
        count+=1
    else:
        color.add(aa//400)

print(len(color) or 1, end=" ")
print(len(color)+count)

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


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

    if N==1:
        print('1 1')
        return

    C = [False]*8
    r = 0
    for a in A:
        if a<400:
            C[0] = True
        elif a<800:
            C[1] = True
        elif a<1200:
            C[2] = True
        elif a<1600:
            C[3] = True
        elif a<2000:
            C[4] = True
        elif a<2400:
            C[5] = True
        elif a<2800:
            C[6] = True
        elif a<3200:
            C[7] = True
        else:
            r += 1

    c_cnt = C.count(True)
    c_min = max(c_cnt, 1)
    c_max = c_cnt + r
    print(' '.join(map(str, [c_min, c_max])))

if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
s = set()
all = 0
for i in a:
    if i >= 3200:all += 1;continue
    s.add(i//400)
print(len(s) or 1,end=" ")
print(len(s)+all)

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
s = set()
all = 0
for i in a:
    if i >= 3200:
        all += 1
    else:s.add(i//400)
if not s:
    print(1,end=" ")
else:print(len(s),end=" ")
print(len(s)+all)

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

for i in range(n):
    if 1 <= li[i] <=399:
        li[i] = 1
    elif 400<= li[i] <=799: 
        li[i] = 2
    elif 800<= li[i] <=1199:
        li[i] = 3
    elif 1200<= li[i] <=1599:
        li[i] = 4
    elif 1600<= li[i] <=1999:
        li[i] = 5
    elif 2000<= li[i] <=2399:
        li[i] = 6
    elif 2400<= li[i] <=2799:
        li[i] = 7
    elif 2800<= li[i] <=3199:
        li[i] = 8
    elif 3200<= li[i] <=4800:
        li[i] = 10+i
max1 = len(set(li))
li = [x for x in li if x < 9]
if len(li) == 0:
    min1 = 1
else:
    min1 = len(set(li))
print(min1,max1)

Solution (Python):


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

st = set()
super_coder = 0
for ele in a:
    clr = ele // 400
    if clr <= 7:  
        st.add(clr)
    else:  
        super_coder += 1

ans = [max(len(st), 1), len(st) + super_coder]

print(*ans)

Solution (Python):


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

st = set()
super_coder = 0
for ele in a:
    clr = ele // 400
    if clr <= 7:  
        st.add(clr)
    else:  
        super_coder += 1

if super_coder:
    ans = [max(len(st), 1), len(st) + super_coder]
else:
    ans = [len(st), len(st)]

print(*ans)

Solution (Python):
from collections import Counter,defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n = inp()
a = inpl()
d = defaultdict(int)
for i in a:
    d[i//400] += 1
c = 0
f = 0
for key in d.keys():
    if key < 8:
        c += 1
    else:
        f += d[key]
if c == 0:
    print(1,f)
else:
    print(c,c+f)

Solution (Python):
import collections

n = int(input())
ls = list(map(int, input().split()))

counter = collections.Counter()
for a in ls:
    counter[min(8, a // 400)] += 1
n_keys = len(counter.keys())
n8 = counter[8]
if n8 > 0:
    if n_keys == 1:
        n_min = 1
        n_max = n
    else:
        n_min = n_keys - 1
        n_max = n_min + n8
else:
    n_min = n_max = n_keys
print(n_min, n_max)

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

def rate_color(rate):
    if 1 <= rate and rate < 400:
        return 'ash'
    elif 400 <= rate and rate < 800:
        return 'brown'
    elif 800 <= rate and rate < 1200:
        return 'green'
    elif 1200 <= rate and rate < 1600:
        return 'lightblue'
    elif 1600 <= rate and rate < 2000:
        return 'blue'
    elif 2000 <= rate and rate < 2400:
        return 'yellow'
    elif 2400 <= rate and rate < 2800:
        return 'orange'
    elif 2800 <= rate and rate < 3200:
        return 'red'
    else:
        return 'anycolor'


color_list = []
for i in range(N):
    color_list.append(rate_color(a_list[i]))


basic_color_list = ['ash', 'brown', 'green', 'lightblue', 'blue', 'yellow', 'orange', 'red', 'anycolor']

count_list = []
for _ in basic_color_list:
    count_list.append(color_list.count(_))

count_list_but_anycolor = count_list[:-1]

count_anycolor = count_list[-1]
count_0 = count_list_but_anycolor.count(0)

max_result = 8 - count_0 + count_anycolor
min_result = 8 - count_0

if max_result == 0:
    max_result = 1
else:
    pass

if min_result == 0:
    min_result = 1
else:
    pass

print(min_result, max_result)

Solution (Python):
def slove():
    import sys
    input = sys.stdin.readline
    ls = [0] * 9
    n = int(input().rstrip('\n'))
    a = list(map(int, input().rstrip('\n').split()))
    for v in a:
        if 1 <= v <= 399:
            ls[0] = 1
        elif 400 <= v <= 799:
            ls[1] = 1
        elif 800 <= v <= 1199:
            ls[2] = 1
        elif 1200 <= v <= 1599:
            ls[3] = 1
        elif 1600 <= v <= 1999:
            ls[4] = 1
        elif 2000 <= v <= 2399:
            ls[5] = 1
        elif 2400 <= v <= 2799:
            ls[6] = 1
        elif 2800 <= v <= 3199:
            ls[7] = 1
        else:
            ls[8] += 1
    print(max(sum(ls[:8]), 1), sum(ls[:8]) + ls[8])


if __name__ == '__main__':
    slove()

Solution (Python):
n = int(input())
arr = list(map(int,input().split()))
temp = [0 for i in range(9)]

for a in arr:
    t = a//400
    if t >= 8:
        t = 8
    temp[t] += 1

ans = 0
for i in range(8):
    if temp[i] > 0:
        ans += 1

if ans >= 1:
    print(ans,ans+temp[-1])
else:
    print(1,ans+temp[-1])

Solution (Python):
from sys import stdin
N = int(stdin.readline().rstrip())
a = [int(x) for x in stdin.readline().rstrip().split()]
hai = 0
cha = 0
mdr = 0
miz = 0
aao = 0
kii = 0
dai = 0
aka = 0
kan = 0

for i in a:
    if i <= 399:
        hai = 1
    elif i <= 799:
        cha = 1
    elif i <= 1199:
        mdr = 1
    elif i <= 1599:
        miz = 1
    elif i <= 1999:
        aao = 1
    elif i <= 2399:
        kii = 1
    elif i <= 2799:
        dai = 1
    elif i <= 3199:
        aka = 1
    else:
        kan += 1

ans1 = kan+aka+dai+kii+aao+miz+mdr+cha+hai
ans2 = max(aka+dai+kii+aao+miz+mdr+cha+hai,1)
print(ans2,ans1)

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

s=[0]*8
count=0
ans=0

for i in range(n):
  if a[i]<400:
    s[0]+=1
  elif a[i]<800:
    s[1]+=1
  elif a[i]<1200:
    s[2]+=1
  elif a[i]<1600:
    s[3]+=1
  elif a[i]<2000:
    s[4]+=1
  elif a[i]<2400:
    s[5]+=1
  elif a[i]<2800:
    s[6]+=1
  elif a[i]<3200:
    s[7]+=1
  else:
    count+=1

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

if ans==0:
  print(1,count)
  exit()
else:
  print(ans,ans+count)

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

def color(point):
  if point < 3200:
    return point // 400
  else:
    return 8

vals = {}
for i in a:
  cl = color(i)
  vals.setdefault(cl, 0)
  vals[cl] += 1


  
if 8 not in vals.keys():
  print(len(vals), len(vals))
else:
  print(max(1, len(vals) - 1), len(vals) + vals[8] - 1)

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
from collections import defaultdict
B = defaultdict(int)
for i in A:
    B[min(8,i//400)]+=1
ans = 0
jiyuu = 0
for i in B:
    if i != 8:
        ans += 1
    else:
        jiyuu = B[i]

print(*[max(ans,1),ans+jiyuu])

Solution (Python):

import sys
input = sys.stdin.readline
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7


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

ans_min = 0
ans_max = 0
colors = [0] * 8

def get_colors(num):
    if num <= 399:
        return 0
    elif num <= 799:
        return 1
    elif num <= 1199:
        return 2
    elif num <= 1599:
        return 3
    elif num <= 1999:
        return 4
    elif num <= 2399:
        return 5
    elif num <= 2799:
        return 6
    elif num <= 3199:
        return 7
    else:
        return -1

all = 0
for i in range(N):
    color = get_colors(A[i])
    if color == -1:
        all += 1
    else:
        colors[color] += 1



x = colors.count(0)

if all == 0:
    ans_min = 8-x
    ans_max = 8-x
else:
    if x == 8:
        
        ans_min = 1
        ans_max = all
    else:
        
        ans_min = 8-x
        ans_max = ans_min+all

print(ans_min, ans_max)

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
c = []
w = []
for i in range(n):
  t = a[i]//400
  if t < 8 and t not in c:
    c.append(t)
  if t>=8:
    w.append(t)

if len(c)==0 and len(w) >0:
  print(1, len(w))
else:
  print(len(c), len(c)+len(w))

Solution (Python):
N=int(input())
a=list(map(int,input().split()))
b=[0]*8

f=0
for i in a:
  if i//400<=7:
    b[i//400]=1
  else:
    f+=1    
    
sb=sum(b)
print(max(sb,1),sb+f)

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
C = [a//400 for a in A if a<3200]
m = len(set(C))
print(max(1,m),m+N-len(C))

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
c = [0] * 8
monster = 0
for i in range(n):
    if a[i] < 400:
        c[0] = 1
    elif a[i] < 800:
        c[1] = 1
    elif a[i] < 1200:
        c[2] = 1
    elif a[i] < 1600:
        c[3] = 1
    elif a[i] < 2000:
        c[4] = 1
    elif a[i] < 2400:
        c[5] = 1
    elif a[i] < 2800:
        c[6] = 1
    elif a[i] < 3200:
        c[7] = 1
    else:
        monster += 1
print(max(sum(c), 1), sum(c) + monster)

Solution (Python):
reet = [(1,399),(400,799),(800,1199),(1200,1599),
        (1600,1999),(2000,2399),(2400,2799),(2800,3199)]
n = int(input())
alist = list(map(int, input().split()))
 
dorei = []
osama = 0
for a in alist:
    osamaflag = True
    for i in range(len(reet)):
       	bottom, top = reet[i]
        if (bottom <= a <= top):
            dorei.append(i)
            osamaflag = False
            break
    if osamaflag:
        osama += 1

min_ = len(set(dorei))
if min_ == 0:
    min_ = 1
max_ = len(set(dorei)) + osama
print(min_, max_)

Solution (Python):
n,*a=map(int,open(0).read().split());*a,=filter(lambda x:x<3200,a);b=len(set([x//400for x in a]));print(b or 1,n-len(a)+b)

Solution (Python):
n,a=open(0)
s=set();x=0
for i in map(int,a.split()):
	j=i//400
	if j<8:s.add(j)
	else:x+=1
print(max(1,len(s)),len(s)+x)

Solution (Python):
from collections import Counter as C
n=int(input())
A=sorted(C(list(map(lambda x:min(x//400,8),list(map(int,input().split()))))+[8]).most_common())
print(len(A)-1 if A[0][0]!=8 else 1,len(A)+A[-1][1]-2)

Solution (Python):
N = int(input())
rate = [0] * 9
for a in [int(x) for x in input().split()]:
  rate[min(a, 3200) // 400] += 1

ret = 0
for r in rate[:-1]:
  if r:
    ret += 1

print(max(ret, 1), ret + rate[-1])

Solution (Python):
N,*A=map(int,open(0).read().split());l=[0]*9
for a in A:l[min(8,a//400)]+=1
m=sum([0<l[i]for i in range(8)]);print(max(m,1),m+l[8])

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
c = 0
s = set()

for a in A:
  if a >= 3200:
    c += 1
  else:
    s.add(a//400)
print(max(1, len(s)), len(s) + c)

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

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

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

for i in range(N):
	tmp = A[i] // 400
	if tmp >= 9:
		tmp = 8
	flg[tmp] += 1

if flg[8] == 0:
	n = 9-flg.count(0)
	print(n, end = " ")
	print(n)
else:
	n = 8-flg.count(0)
	if n == 0:
		print(1, end=" ")
		print(flg[8])
	else:
		print(n, end = " ")
		print(n+flg[8])

Solution (Python):
def resolve():
    n = int(input())
    a = list(map(int, input().split()))
    over3200 = len([ai for ai in a if ai >= 3200])
    c = set([ai // 400 for ai in a if ai < 3200])
    print(max(1, len(c)), len(c) + over3200)


if __name__ == "__main__":
    resolve()

Solution (Python):
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor


INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LIM(): return list(map(lambda x:int(x) - 1, sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def LIRM(n): return [LIM() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
mod = 1000000007


n = I()
L = LI()
cnt = 0
s = set()
for i in L:
    if i >= 3200:
        cnt += 1
    else:
        s.add(i // 400)


print(max(1, len(s)), len(s) + cnt)

Solution (Python):
N = int(input())
a = list(map(int, input().split()))
c = []
s = 0
for i in range(N):
  c.append(min(a[i]//400, 8))
import collections
colors = collections.Counter(c)
for i in range(8):
  if colors.get(i, 0) != 0:
    s += 1
ss = colors.get(8, 0)

print(max(s, 1), s+ss)

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

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

    rank = [400*(i+1) for i in range(8)] + [10000]
    count = [0] * len(rank)

    for i in range(N):
        for j in range(len(rank)):
            if a[i] < rank[j]:
                count[j] += 1
                break
    ans = 0
    for i in range(len(count) - 1):
        if count[i] > 0:
            ans += 1
    if ans == 0:
        print(1, count[-1])
    else:
        print(ans, ans+count[-1])


if __name__ == "__main__":
    main()

Solution (Python):
N=int(input())
A=map(int,input().split())
c=0
s=set()
for a in A:
  if a>=3200:
    c+=1
  else:
    s.add(a//400)
print(max(1,len(s)),len(s)+c)

Solution (Python):
N=int(input())
A=list(map(int,input().split()))
gray=0
brown=0
green=0
light=0
blue=0
yellow=0
orange=0
red=0
god=0
for a in A:
  if 1<=a and a<=399 and gray==0:
    gray=1
  elif 400<=a and a<=799 and brown==0:
    brown=1
  elif 800<=a and a<=1199 and green==0:
    green=1
  elif 1200<=a and a<=1599 and light==0:
    light=1
  elif 1600<=a and a<=1999 and blue==0:
    blue=1
  elif 2000<=a and a<=2399 and yellow==0:
    yellow=1
  elif 2400<=a and a<=2799 and orange==0:
    orange=1
  elif 2800<=a and a<=3199 and red==0:
    red=1
  elif a>=3200:
    god+=1
mi=max(1,gray+brown+green+light+blue+yellow+orange+red)
ma=gray+brown+green+light+blue+yellow+orange+red+god
print(mi,ma)

Solution (Python):
import numpy as np

n = int(input())
A = np.array(list(map(int,input().split())))



a = len(np.where(A >= 3200)[0])

b = len(set(A[A < 3200] // 400))

print(max(1, b), b+a)

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

cnt_list =[0]*9

cnt_sum=0
num_min=0
num_max=0


for i in a:
    j=int(i/400)
    if j<8:cnt_list[j]=1
    else:cnt_list[8]+=1

      
cnt_sum = sum(cnt_list)-cnt_list[8]
if cnt_list[8]>0:
    if cnt_sum==0:
        num_min=1
    else:num_min=cnt_sum
    num_max=cnt_sum+cnt_list[8]
else:
    num_min=cnt_sum
    num_max=cnt_sum

print(num_min, num_max)

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

cnt_list =[0]*9

cnt_sum=0
num_min=0
num_max=0


for i in a:
    j=int(i/400)
    if j<8:cnt_list[j]=1
    else:cnt_list[8]+=1

      
cnt_sum = sum(cnt_list)-cnt_list[8]
if cnt_list[8]>0:
    if cnt_sum==0:
        num_min=1
    else:num_min=cnt_sum
    num_max=cnt_sum+cnt_list[8]
else:
    num_min=cnt_sum
    num_max=cnt_sum

print(num_min, num_max)

Solution (Python):
n=int(input())
a=[int(i) for i in input().split()]
dic={}
check8=0
for i in a:
    check=i//400
    if check not in dic and check <8:
        dic[check]=1
    if check>=8:
        check8+=1

mi=max(1,len(dic))
ma=len(dic)+check8
print(mi,ma)

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
color = {}
f = 0
for a in A:
    if 1 <= a <= 399:
        color['g'] = 1
    elif 400 <= a <= 799:
        color['br'] = 1
    elif 800 <= a <= 1199:
        color['gr'] = 1
    elif 1200 <= a <= 1599:
        color['m'] = 1
    elif 1600 <= a <= 1999:
        color['b'] = 1
    elif 2000 <= a <= 2399:
        color['y'] = 1
    elif 2400 <= a <= 2799:
        color['o'] = 1
    elif 2800 <= a <= 3199:
        color['r'] = 1
    else:
        f += 1
print(max(1, len(color)), len(color)+f)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
s = set()
free = 0
for ai in a:
    rank = ai // 400
    if rank > 7:
        free += 1
    else:
        s.add(rank)

if len(s) == 0:
    ans = (1, free)
else:
    ans = (len(s), len(s) + free)

print(*ans)

Solution (Python):
from collections import defaultdict

N = int(input())
A = list(map(int, input().split()))
rate_dict = defaultdict(int)
for a in A:
    if 1 <= a <= 399:
        rate_dict["gray"] += 1
    elif 400 <= a <= 799:
        rate_dict["brown"] += 1
    elif 800 <= a <= 1199:
        rate_dict["green"] += 1
    elif 1200 <= a <= 1599:
        rate_dict["light_blue"] += 1
    elif 1600 <= a <= 1999:
        rate_dict["blue"] += 1
    elif 2000 <= a <= 2399:
        rate_dict["yellow"] += 1
    elif 2400 <= a <= 2799:
        rate_dict["orange"] += 1
    elif 2800 <= a <= 3199:
        rate_dict["red"] += 1
    elif 3200 <= a:
        rate_dict["free"] += 1
ans = sum([1 if x in rate_dict else 0
           for x in ["gray", "brown", "green", "light_blue", "blue", "yellow", "orange", "red"]])
min_ans = ans
if "free" in rate_dict:
    if len(set(list(rate_dict.keys()))) == 1:
        min_ans = 1
    max_ans = ans + rate_dict["free"]
else:
    max_ans = min_ans
print("{} {}".format(min_ans, max_ans))

Solution (Python):
from collections import defaultdict

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

rate = defaultdict(int)

for a in A:
    if 1 <= a <= 399:
        rate[1] += 1
    if 400 <= a <= 799:
        rate[2] += 1
    if 800 <= a <= 1199:
        rate[3] += 1
    if 1200 <= a <= 1599:
        rate[4] += 1
    if 1600 <= a <= 1999:
        rate[5] += 1
    if 2000 <= a <= 2399:
        rate[6] += 1
    if 2400 <= a <= 2799:
        rate[7] += 1
    if 2800 <= a <= 3199:
        rate[8] += 1
    if a >= 3200:
        rate[9] += 1

valiable = len(rate.keys())
topcoder = rate[9]

if topcoder:
    if valiable == 1:
        print(1, min(topcoder, 9))
    else:
        print(valiable - 1, valiable + topcoder - 1)
else:
    print(valiable, valiable)

Solution (Python):
N = int(input())
a = list(map(int, input().split()))
colors = [0]*9
for i in a:
    idx = i//400
    if(idx > 8):
        idx = 8
    colors[idx] += 1
ans = 0
for i in colors[0:8]:
    if i != 0:
        ans += 1
if ans == 0:
    print(1, colors[8])
else:
    print(ans, ans+colors[8])

Solution (Python):
N, A = int(input()), list(map(int, input().split()))
C = [a // 400 for a in A]
mini = sum([1 for c in range(8) if c in C])
print(max(mini, 1), mini + sum([1 for c in C if c >= 8]))

Solution (Python):
bound = [3200, 2800, 2400, 2000, 1600, 1200, 800, 400, 1]
d = {b: 0 for b in bound}

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

for a in A:
    for b in bound:
        if b <= a:
            d[b] += 1
            break

mini = 0
for b in bound[1:]:
    if d[b] > 0:
        mini += 1

print(max(mini, 1), mini + d[3200])

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
B = [x//400 for x in A if x//400 <= 7]
num_l = len(B)
var_l = len(set(B))
print(max(1,var_l),var_l+N-num_l)

Solution (Python):
from collections import Counter

n = int(input())
a = list(map(lambda a: int(a) // 400, input().split()))
for i in range(n):
    if a[i] >= 8:
        a[i] = 8
c = Counter(a)
if 8 in c:
    print("{} {}".format(
        max(len(c) - 1, 1),
        len(c) - 1 + c[8]))
else:
    print("{} {}".format(
        len(c), len(c)))

Solution (Python):
n=int(input())
a=[int(i) for i in input().split()]
rate=[0,0,0,0,0,0,0,0,0]
for i in a:
    if i<400:
        rate[0]=1
    elif 400<=i<800:
        rate[1]=1
    elif 800<=i<1200:
        rate[2]=1
    elif 1200<=i<1600:
        rate[3]=1
    elif 1600<=i<2000:
        rate[4]=1
    elif 2000<=i<2400:
        rate[5]=1
    elif 2400<=i<2800:
        rate[6]=1
    elif 2800<=i<3200:
        rate[7]=1
    else:
        rate[8]+=1
color=rate[:8]
x=color.count(1)
color_max=x+rate[8]
if x==0 and rate[8]>0:
    color_min=1
else:
    color_min=x
print('{} {}'.format(color_min,color_max))

Solution (Python):
import sys
import copy
import  math
from _bisect import *
from collections import *
from operator import itemgetter
"""
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
"""
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

def judge(num):
    return bisect_right(rate, num) - 1


rate = [1, 400, 800, 1200, 1600, 2000, 2400, 2800, 3200, float("inf")]
li = [0] * 9
n = ni()
aaa = na()
for a in aaa:
    idx = judge(a)
    if idx == 8:
        li[idx] += 1
    else:
        li[idx] = 1
c = max(sum(li[:-1]), 1)
if sum(li[:-1]) == 0:
    print(c, li[-1])
else:
    print(c, c + li[-1])

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):
    if 1 <= a[i] <= 399:
        color[0] = 1
    elif 400 <= a[i] <= 799:
        color[1] = 1
    elif 800 <= a[i] <= 1199:
        color[2] = 1
    elif 1200 <= a[i] <= 1599:
        color[3] = 1
    elif 1600 <= a[i] <= 1999:
        color[4] = 1
    elif 2000 <= a[i] <= 2399:
        color[5] = 1
    elif 2400 <= a[i] <= 2799:
        color[6] = 1
    elif 2800 <= a[i] <= 3199:
        color[7] = 1
    else:
        color[8] += 1
co = color[:8]
zero = co.count(0)
one = co.count(1)
max = one + color[8]

if one == 0 and color[8] > 0:
    min = 1
else:
    min = one

print("{} {}".format(min, max))

Solution (Python):
n=int(input())
def f(x):
  return x//400 if x<3200 else 8
l=list(map(f,list(map(int,input().split()))))
ds=l.count(8)
sl=set(l)
if ds==0:
  print(len(sl),len(sl))
elif len(sl)==1:print(1,ds)
else:
  print(len(sl)-1,len(sl)+ds-1)

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

cr = []
MAxans = 0

for i in A:
    c = i // 400
    if c < 8 and not c in cr:
        cr.append(c)
    elif c >= 8:
        MAxans += 1


if len(cr)>0:
    Minans = len(cr)
    MAxans = MAxans + Minans
else:
    Minans = 1
print(str(Minans) + " " + str(MAxans))

Solution (Python):
import math

n=int(input())
a=list(map(int, input().split()))  
b=[]
count=0




for i in range(n):
    if a[i]>=3200:
        count+=1
    else:
        b.append(a[i]//400)

ans=len(set(b))

if count==0:
    print(ans,ans)

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

Solution (Python):
from bisect import bisect
def grade(rate,breakpoints=[400,800,1200,1600,2000,2400,2800,3200],grades=["gray","brown","green","light blue","blue","yellow","orange","red","anything"]):
    i = bisect(breakpoints,rate)
    return grades[i]

n = int(input())
a = [int(i) for i in input().split()]
colors = [grade(r) for r in a]
anything_count = colors.count("anything")
ans = len(set(colors))
print(*(ans,ans) if anything_count == 0 else (ans-1+(1 if ans == 1 else 0),ans-1+anything_count))

Solution (Python):
_ = input().strip()
kind_set = set()
rates = list(map(int, input().strip().split(' ')))

def whatcolor(rate):
  if rate < 400:
    return 0
  elif rate < 800:
    return 1
  elif rate < 1200:
    return 2
  elif rate < 1600:
    return 3
  elif rate < 2000:
    return 4
  elif rate < 2400:
    return 5
  elif rate < 2800:
    return 6
  elif rate < 3200:
    return 7
  else:
    return 'free'
  
free_n = 0
for r in rates:
  color = whatcolor(r)
  if color == 'free':
    free_n += 1
  else:
    kind_set.add(color)

ans_min = max(1, len(kind_set))
ans_max = len(kind_set) + free_n
print(ans_min, ans_max)

Solution (Python):
from bisect import bisect_right

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

r = [400, 800, 1200, 1600, 2000, 2400, 2800, 3200]
c = [0] * 9

for score in a:
	i = bisect_right(r, score)
	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()))
B = {}
for i in range(0, 13):
    B[i] = 0
for i in A:
    B[i//400] += 1
ansA = 0
ansB = 0
for i in range(0, 13):
    if i < 8:
        if B[i] > 0:
            ansA += 1
            ansB += 1
    else:
        if B[i] > 0:
            ansB += B[i]
if min(A) >= 3200:
    ansA += 1
print(ansA, ansB)

Solution (Python):
N = int(input())

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

C = [0] * 9

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

num = sum(C[0:8])

ans1 = str(max(num, 1))
ans2 = str( num + C[8])
print(ans1 + " " + ans2)

Solution (Python):
n = int(input())
a = [int(i) for i in input().split()]

hai = 0
tya = 0
midori = 0
mizu = 0
ao = 0
ki = 0
daidai = 0
aka = 0
iro = 0

for i in range(n):
    if a[i] <= 399:
        hai = 1
    elif a[i] <= 799:
        tya = 1
    elif a[i] <= 1199:
        midori = 1
    elif a[i] <= 1599:
        mizu = 1
    elif a[i] <= 1999:
        ao = 1
    elif a[i] <= 2399:
        ki = 1
    elif a[i] <= 2799:
        daidai = 1
    elif a[i] <= 3199:
        aka = 1
    else:
        iro += 1
        
min_iro = hai+tya+midori+mizu+ao+ki+daidai+aka

print(max(min_iro,1),min_iro+iro)

Solution (Python):



n = int(input().split()[0])
a_list = list(map(int, input().split()))

start, end = 0, 399
rate_dict = {}
rate_id = 0

while end < 3200:
    
    
    data = dict(start=start, end=end)
    rate_dict[rate_id] = data
    rate_id += 1
    start += 400
    end += 400

count_dict = {rate_id: 0 for rate_id in rate_dict.keys()}

for a in a_list:
    for rate_id, v in rate_dict.items():
        if v['start'] <= a <= v['end']:
            count_dict[rate_id] += 1

count_over = n - sum(count_dict.values())
ALL_COLOR_N = len(count_dict.keys())  


zero_color_n = len([v for v in count_dict.values() if v == 0])


if count_over == n:
    
    min_n = 1
else:
    
    min_n = ALL_COLOR_N - zero_color_n



max_n = (ALL_COLOR_N - zero_color_n) + count_over

ans = ' '.join([str(min_n), str(max_n)])
print(ans)

Solution (Python):
N=int(input())
a=map(int,input().split())
c=0
s=set()
for i in a:
    if i>=3200:
        c+=1
    else:
        s.add(i//400)
print(max(1,len(s)),len(s)+c)

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

ans = [0] * 8
free = 0

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

num = len(ans) - ans.count(0)
print(str(max(num, 1)) + ' ' + str(num + free))

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

c=[0,0,0,0,0,0,0,0]
cnt=0
for rate in rates:
  for i in range(8):
    if 400*i<=rate<400*(i+1):
      c[i]+=1
      break
  if rate>=3200:
    cnt+=1
    
ans=len(c)-c.count(0)
if ans==0:
  ans=1
print(min(n,ans),min(n,ans+cnt))

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

color=[0 for i in range(8)]
upper=0

for a in A:
    if 1<=a<=399:
        color[0]=1
    elif 400<=a<=799:
        color[1]=1
    elif 800<=a<=1199:
        color[2]=1
    elif 1200<=a<=1599:
        color[3]=1
    elif 1600<=a<=1999:
        color[4]=1
    elif 2000<=a<=2399:
        color[5]=1
    elif 2400<=a<=2799:
        color[6]=1
    elif 2800<=a<=3199:
        color[7]=1
    else:
        upper+=1

lower=sum(color)
if lower==0:
    mn=1
    mx=upper
else:
    mn=lower
    mx=lower+upper
print(mn,mx)