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()))

cnt = [0] * 8
free = 0

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

if free == n:
    print(1, free)
else:
    print(sum(cnt), sum(cnt) + free)

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n = int(input())
    A = list(map(int, input().split()))

    Color = [0] * 9
    for a in A:
        if a >= 3200:
            Color[-1] += 1
        else:
            Color[a // 400] = 1

    mi = sum(Color[:8]) + (1 if sum(Color[:8]) == 0 and Color[8] > 0 else 0)
    ma = sum(Color[:8]) + Color[8]

    print(mi, ma)


if __name__ == '__main__':
    resolve()

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
for i in range(n):
  if 1<=a[i]<=399:
    a[i]="gray"
  elif 400<=a[i]<=799:
    a[i]="brown"
  elif 800<=a[i]<=1199:
    a[i]="green"
  elif 1200<=a[i]<=1599:
    a[i]="lightblue"
  elif 1600<=a[i]<=1999:
    a[i]="blue"
  elif 2000<=a[i]<=2399:
    a[i]="yellow"
  elif 2400<=a[i]<=2799:
    a[i]="orange"
  elif 2800<=a[i]<=3199:
    a[i]="red"
  elif 3200<=a[i]:
    a[i]="free"

from collections import Counter

c=Counter(a)
ans=len(c)
free=c["free"]
v_min=ans
v_max=ans
if free>0:
  v_min-=1
if free>0:
  v_max+=free-1
if free==n:
  v_min=1
print(v_min,v_max)

Solution (Python):
import sys
import collections

sys.setrecursionlimit(10 ** 8)
ni = lambda: int(sys.stdin.readline())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())
ns = lambda: sys.stdin.readline().rstrip()

N = ni()
A = nl()


def solve():
    c = collections.Counter()
    cf = 0
    for a in A:
        if a < 400:
            c[0] += 1
        elif a < 800:
            c[1] += 1
        elif a < 1200:
            c[2] += 1
        elif a < 1600:
            c[3] += 1
        elif a < 2000:
            c[4] += 1
        elif a < 2400:
            c[5] += 1
        elif a < 2800:
            c[6] += 1
        elif a < 3200:
            c[7] += 1
        else:
            cf += 1
    mn = len(c)
    if mn == 0 and cf > 0:
        mn = 1
    mx = len(c) + cf
    print(mn, mx)


solve()

Solution (Python):
n = int(input())
A = list(map(int, input().split()))
c = []
other = 0
for a in A:
  if a < 400: c.append("gray")
  elif a < 800: c.append("brown")
  elif a < 1200: c.append("green")
  elif a < 1600: c.append("mblue")
  elif a < 2000: c.append("blue")
  elif a < 2400: c.append("yellow")
  elif a < 2800: c.append("orange")
  elif a < 3200: c.append("red")
  else: other += 1
c = set(c)
if c:
  print(len(c), len(c)+other)
else:
  print(1, other)

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

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

base = sum(d[:-1])
mx = base + d[8]
mn = max(1, base)
print(mn, mx)

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

cs = [0]*9
for a in A:
    if a >= 3200:
        cs[-1] += 1
    else:
        cs[a//400] += 1
mn = len([1 for c in cs[:-1] if c>0])
if mn==0:
    print(1,N)
else:
    print(mn,mn+cs[-1])

Solution (Python):
from bisect import bisect_left

N = int(input())
a = sorted(list(map(int, input().split())))
ans = set()
max_ans = 0
c = 0
for aa in a:
  if aa < 400:
    ans.add(0)
  elif aa < 800:
    ans.add(1)
  elif aa < 1200:
    ans.add(2)
  elif aa < 1600:
    ans.add(3)
  elif aa < 2000:
    ans.add(4)
  elif aa < 2400:
    ans.add(5)
  elif aa < 2800:
    ans.add(6)
  elif aa < 3200:
    ans.add(7)
  else:
    if not ans:
      ans.add(0)
      continue
    max_ans += 1

print(len(ans), len(ans) + max_ans if max_ans else len(ans))

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

as_ = map(int, input().strip().split())


def color(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 8


colors = [0] * 8
num_expert = 0
for a in as_:
    c = color(a)
    if c == 8:
        num_expert += 1
    else:
        colors[c] += 1

num_colors = len([True for c in colors if c > 0])
min_colors = max(num_colors, 1)
max_colors = num_colors + num_expert


print(min_colors, max_colors)

Solution (Python):
n = int(input())
ls = list(map(int,input().split()))
a = [0]*8
p = 0
q = 0
co = 0
comax = 0
for i in range(n):
    p = ls[i]//400
    if p < 8:
        if a[p] == 0:
            a[p] += 1
            co += 1
        else:
            pass
    else:
        q += 1
comax = co + q
if co == 0:
    co = 1
print(co,comax)

Solution (Python):
N=int(input())
aN=list(map(int,input().split()))
colors=set()
sp_col=0
for a in aN:
  if      1<=a and a<= 399:colors.add('gray')
  elif  400<=a and a<= 799:colors.add('brown')
  elif  800<=a and a<=1199:colors.add('green')
  elif 1200<=a and a<=1599:colors.add('splash')
  elif 1600<=a and a<=1999:colors.add('blue')
  elif 2000<=a and a<=2399:colors.add('yellow')
  elif 2400<=a and a<=2799:colors.add('orange')
  elif 2800<=a and a<=3199:colors.add('red')
  else:sp_col+=1
  pass

if len(colors)==0:min_col=1
else:min_col=len(colors)
print("{} {}".format(min_col,len(colors)+sp_col))

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

Solution (Python):
n = int(input())
A = list(map(int, input().split()))
C = [0] * 8
free = 0
for a in A:
	if a >= 3200:
		free += 1
	else:
		C[a // 400] = 1
print(max(1, sum(C)), sum(C) + free)

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

d = {}
cnt = 0
for i in range(N):
    if 1<=a[i]<=399:
        if 'gray' in d.keys():
            d['gray'] += 1
        else:
            d['gray'] = 1
    elif 400<=a[i]<=799:
        if 'brown' in d.keys():
            d['brown'] += 1
        else:
            d['brown'] = 1
    elif 800<=a[i]<=1199:
        if 'green' in d.keys():
            d['green'] += 1
        else:
            d['green'] = 1
    elif 1200<=a[i]<=1599:
        if 'light_blue' in d.keys():
            d['light_blue'] += 1
        else:
            d['light_blue'] = 1
    elif 1600<=a[i]<=1999:
        if 'blue' in d.keys():
            d['blue'] += 1
        else:
            d['blue'] = 1
    elif 2000<=a[i]<=2399:
        if 'yellow' in d.keys():
            d['yellow'] += 1
        else:
            d['yellow'] = 1
    elif 2400<=a[i]<=2799:
        if 'orange' in d.keys():
            d['orange'] += 1
        else:
            d['orange'] = 1
    elif 2800<=a[i]<=3199:
        if 'red' in d.keys():
            d['red'] += 1
        else:
            d['red'] = 1
    else:
        cnt += 1
if len(d) == 0:
    print(1,len(d)+cnt)
else:
    print(len(d),len(d)+cnt)

Solution (Python):
n=int(input())
A=list(map(int, input().split()))
col=[0]*8
def transcol(x):
  if 1<=x and x<=399:
    return 0
  elif 400<=x and x<=799:
    return 1
  elif 800<=x and x<=1199:
    return 2
  elif 1200<=x and x<=1599:
    return 3
  elif 1600<=x and x<=1999:
    return 4
  elif 2000<=x and x<=2399:
    return 5
  elif 2400<=x and x<=2799:
    return 6
  elif 2800<=x and x<=3199:
    return 7
free=0
for a in A:
  if a>=3200:
    free+=1
  else:
    tmp=transcol(a)
    if col[tmp]==0:
      col[tmp]=1

minans=sum(col)
maxans=minans+free
if minans==0:
  minans=1
print(minans, maxans)

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

tmp = [0]*8
r = 0
for i in s:
    if i <= 399:
        tmp[0] = 1
    elif i <= 799:
        tmp[1] = 1
    elif i <= 1199:
        tmp[2] = 1    
    elif i <= 1599:
        tmp[3] = 1        
    elif i <= 1999:
        tmp[4] = 1
    elif i <= 2399:
        tmp[5] = 1
    elif i <= 2799:
        tmp[6] = 1
    elif i <= 3199:
        tmp[7] = 1
    else:
        r += 1

if sum(tmp) == 0:
    ans_min = 1
else:
    ans_min = sum(tmp)
ans_max = sum(tmp) + r

print(ans_min, ans_max)

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

Solution (Python):
def main():
    N = int(input())
    A = list(map(int, input().split(' ')))
    cnt = [0 for _ in range(9)]
    for a in A:
        c = min([8, a // 400])
        cnt[c] += 1
    cnt_top = cnt[-1]
    n_color = 0
    for c in range(8):
        if cnt[c] > 0:
            n_color += 1
    min_n_color = max([1, n_color])
    max_n_color = n_color + cnt_top
    print('{} {}'.format(min_n_color, max_n_color))


if __name__ == '__main__':
    main()

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

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

d = [0]*8
tourist = 0

for i in range(N):
  if(1<= list_a[i]< 400):
    d[0]+= 1
  elif(400<= list_a[i]< 800):
    d[1]+= 1
  elif(800<= list_a[i]< 1200):
    d[2]+= 1
  elif(1200<= list_a[i]< 1600):
    d[3]+= 1
  elif(1600<= list_a[i]< 2000):
    d[4]+= 1
  elif(2000<= list_a[i]< 2400):
    d[5]+= 1
  elif(2400<= list_a[i]< 2800):
    d[6]+= 1
  elif(2800<= list_a[i]< 3200):
    d[7]+= 1
  else:
    tourist+= 1
    
color = 8- d.count(0)
min_color = max(color, 1)
max_color = color+ tourist

print(min_color, max_color)

Solution (Python):

def main():
    N = int(input())
    a_list = list(map(int, input().split()))
    rate_table = set([])
    over = 0

    for a in a_list:
        if a < 3200:
            rate_table.add(a//400)
        else:
            over += 1
            
    mini = len(rate_table)
    maxi = mini + over
    
    print(max(1,mini), maxi)


if __name__ == "__main__":
    main()

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

rating = []
s = 0

for i in range(N):
  if a[i] >= 3200:
    s += 1

  if a[i] < 400:
    rating.append('0')
  elif a[i] < 800:
    rating.append('1')
  elif a[i] < 1200:
    rating.append('2')
  elif a[i] < 1600:
    rating.append('3')
  elif a[i] < 2000:
    rating.append('4')
  elif a[i] < 2400:
    rating.append('5')
  elif a[i] < 2800:
    rating.append('6')
  elif a[i] < 3200:
    rating.append('7')

min = len(list(set(rating)))

if min == 0:
  print(1, min + s)
else:
  print(min, min + s)

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

print(max(sum(m),1), sum(color))

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

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

smallest = color.count(1)
greatest = smallest + strong
if smallest == 0:
    smallest = 1

print(smallest, greatest)

Solution (Python):
def main():
    n = int(input())
    a = list(map(int, input().split()))
      
    l = set()    
    free = 0
    for aa in a:
        if aa // 400 >= 8:
            free += 1
        else:
            l.add(aa // 400)
    print(max(1,len(l)), len(l) + free)
        
    
if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
a = sorted([i//400 for i in a])
min_a = 0
max_a = 0
flag = -1
for i in range(n):
  if a[i] >= 8:
    max_a += 1
  elif flag != a[i]:
    min_a += 1
    max_a += 1
  flag = a[i]
print(max(1,min_a),max_a)

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

silver = 0
rate = set([])
for a in A:
    if a >= 3200:
        silver += 1
    elif 2800 <= a <= 3199:
        rate.add("red")
    elif 2400 <= a <= 2799:
        rate.add("orange")
    elif 2000 <= a <= 2399:
        rate.add("yellow")
    elif 1600 <= a <= 1999:
        rate.add("blue")
    elif 1200 <= a <= 1599:
        rate.add("cyan")
    elif 800 <= a <= 1199:
        rate.add("green")
    elif 400 <= a <= 799:
        rate.add("brown")
    else:
        rate.add("hai")

if len(rate) == 0:
    print(1, silver)
else:
    print(len(rate), len(rate)+silver)

Solution (Python):
import sys


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


def resolve():
    n = int(input())
    l = list(map(int, input().split()))
    check=[False]*8
    jiyu=0
    for i in l:
       if i<3200:
           check[i//400]=True
       else:
           jiyu+=1
    cnt=0
    for j in check:
        if j:
            cnt+=1
    if cnt==0:
        print(1,jiyu)
    else:
        print(cnt,cnt+jiyu)
resolve()

Solution (Python):
import sys


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


def resolve():
    n = int(input())
    l = list(map(int, input().split()))
    cnt=0
    cnt3200=0
    for i in range(1,9):
        x=400*i
        y=400*(i-1)
        for j in l:
            if y<=j<x:
                cnt+=1
                break
    for i in l:
        if i>=3200:
            cnt3200+=1
    if cnt==0:
        print(1,cnt3200)
    else:
        print(cnt,cnt+cnt3200)
resolve()

Solution (Python):
import sys


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


def resolve():
    n = int(input())
    ll = list(map(int, input().split()))
    l = [0] * 9
    for i in ll:
        if i < 400:
            l[0] += 1
        elif i < 800:
            l[1] += 1
        elif i < 1200:
            l[2] += 1
        elif i < 1600:
            l[3] += 1
        elif i < 2000:
            l[4] += 1
        elif i < 2400:
            l[5] += 1
        elif i < 2800:
            l[6] += 1
        elif i < 3200:
            l[7] += 1
        else:
            l[8] += 1
    cnt = 0
    for j in l[:8]:
        if j >= 1:
            cnt += 1
    if cnt==0:
        print(1,l[8])
    else:
        print(cnt, cnt + l[8])

resolve()

Solution (Python):
n = int(input())
a_li = list(map(int,input().split()))
a_li.sort()
ans_min = [0]*8
ans_max = [0]*8
dum = 0
for i in a_li:
    if 0 < i < 400:
        ans_max[0] = 1
        ans_min[0] = 1
    elif 400 <= i < 800:
        ans_max[1] = 1
        ans_min[1] = 1
    elif 800 <= i < 1200:
        ans_max[2] = 1
        ans_min[2] = 1
    elif 1200 <= i < 1600:
        ans_max[3] = 1
        ans_min[3] = 1
    elif 1600 <= i < 2000:
        ans_max[4] = 1
        ans_min[4] = 1
    elif 2000 <= i < 2400:
        ans_max[5] = 1
        ans_min[5] = 1
    elif 2400 <= i < 2800:
        ans_max[6] = 1
        ans_min[6] = 1
    elif 2800 <= i < 3200:
        ans_max[7] = 1
        ans_min[7] = 1
    else:
        dum += 1
ans_max_sum = sum(ans_max) + dum
ans_min_sum = sum(ans_min)
if ans_min_sum == 0:
    ans_min_sum = 1


print(ans_min_sum,ans_max_sum)

Solution (Python):
n = int(input())
l = list(map(int,input().split()))
ll = [0,400,800,1200,1600,2000,2400,2800,3200]
al = [0] * 8

ans = 0
cnt = 0

for i in range(n):
  for j in range(0,8):
    if ll[j] <= l[i] < ll[j+1]:
      al[j] = 1
    if l[i] >= 3200:
      cnt += 1
      break
print(sum(al) if sum(al) > 0 else 1, sum(al) + cnt)

Solution (Python):


import sys






























def main():
    mod = 1000000007                
    inf = float('inf')              
    
    sys.setrecursionlimit(10**6)    
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    
    color = [0] * 9
    n = ii()
    L = lmi()
    for num in L:
        if num >= 3200:
            color[8] += 1
        else:
            color[num // 400] += 1
    variety = 0
    for i in range(8):
        if color[i] > 0:
            variety += 1
    if variety == 0:
        print("1 {}".format(color[8]))
    else:
        print("{} {}".format(variety, variety + color[8]))
    



if __name__ == "__main__":
    main()

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

rate = {}
for i in range(9):
    rate[i] = 0

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

ans_min = 0
ans_max = 0
count_zero = 0
count_3200over = rate[8]

for i in range(8):
    if rate[i]>=1:
        ans_min = ans_min + 1
    else:
        count_zero = count_zero + 1
ans_max = ans_min

if count_zero==8:
    print(1, max(count_3200over, 1))
    exit()

print(ans_min, ans_max+count_3200over)

Solution (Python):
d=[0]*9
N=int(input())
a=list(map(int,input().split()))
for i in a:
  if 1<=i<=399 and d[0]==0:
    d[0]=1
  elif 400<=i<=799 and d[1]==0:
    d[1]=1
  elif 800<=i<=1199 and d[2]==0:
    d[2]=1
  elif 1200<=i<=1599 and d[3]==0:
    d[3]=1
  elif 1600<=i<=1999 and d[4]==0:
    d[4]=1
  elif 2000<=i<=2399 and d[5]==0:
    d[5]=1
  elif 2400<=i<=2799 and d[6]==0:
    d[6]=1
  elif 2800<=i<=3199 and d[7]==0:
    d[7]=1
  elif i>=3200:
    d[8]+=1
print(max(sum(d[:8]),1),sum(d[:8])+d[8])

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

ans = [0 for _ in range(9)]
for i in list(map(int,input().split())):
    if i < 400:
        ans[0] = 1
    elif i < 800:
        ans[1] = 1
    elif i < 1200:
        ans[2] = 1
    elif i < 1600:
        ans[3] = 1
    elif i < 2000:
        ans[4] = 1
    elif i < 2400:
        ans[5] = 1
    elif i < 2800:
        ans[6] = 1
    elif i < 3200:
        ans[7] = 1
    else:
        ans[8] += 1

if sum(ans[:8]) != 0:
    print(sum(ans[:8]), sum(ans))
else:
    print(1,sum(ans))

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

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

l=[0]*9
for rate in a:
    if rate<=399:
        l[0]=1
    elif rate<=799:
        l[1]=1
    elif rate<=1199:
        l[2]=1
    elif rate<=1599:
        l[3]=1
    elif rate<=1999:
        l[4]=1
    elif rate<=2399:
        l[5]=1
    elif rate<=2799:
        l[6]=1
    elif rate<=3199:
        l[7]=1
    else:
        l[8]+=1

large=sum(l)

if sum(l)-l[8]==0:
    small=1
else:
    small=sum(l)-l[8]

print(small, large)

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

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

large=sum(l)

if sum(l)-l[8]==0:
    small=1
else:
    small=sum(l)-l[8]

print(small, large)

Solution (Python):
N = int(input())
S = list(map(int,input().split()))
count = 0
color = list()

for i in range(len(S)):
  if S[i] < 400:
    S[i] = "grey"
    
  elif S[i] < 800:
    S[i] = "blown"
    
  elif S[i] < 1200:
    S[i] = "green"
  
  elif S[i] < 1600:
    S[i] = "water"
    
  elif S[i] < 2000:
    S[i] = "blue"
  
  elif S[i] < 2400:
    S[i] = "yellow"
  
  elif S[i] < 2800:
    S[i] = "orange"
   
  elif S[i] < 3200:
    S[i] = "red"
    
  elif 3200 <= S[i]:
    S[i] = "wanwan"
    count += 1
  color.append(S[i])


color_set = set(color)

if count == 0:
  print(len(color_set),len(color_set))
elif count >= 1 and len(color_set) == 1:
  print(len(color_set),len(color_set) + count -1)
else:
  print(len(color_set) -1,len(color_set) + count -1)

Solution (Python):
from itertools import groupby

RANGE_TO_COLORS = {
    range(1, 400): "gray",
    range(400, 800): "brown",
    range(800, 1200): "green",
    range(1200, 1600): "lightblue",
    range(1600, 2000): "blue",
    range(2000, 2400): "yellow",
    range(2400, 2800): "orange",
    range(2800, 3200): "red",
    range(3200, 4801): "all"
}


def rate_to_color(r: int) -> str:
    for _range, color in RANGE_TO_COLORS.items():
        if r in _range:
            return color
    else:
        return "Unknown"


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

groups = []
unique_keys = []
data = sorted(A, key=rate_to_color)
for k, g in groupby(data, rate_to_color):
    groups.append(len(list(g)))
    unique_keys.append(k)

if "all" in unique_keys:
    idx = unique_keys.index("all")
    n = groups[idx]
    c = len(unique_keys) - 1
else:
    n = 0
    c = len(unique_keys)

print(c if c >= 1 else 1, n + c)

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

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

l = [0]*9


for i in a:
    if i >= 3200:
        l[8] +=1
    else:    
        l[i//400] +=1

b = [i for i in l[:8] if i > 0]
mx = 0
mn = 0

if len(b) >= 1:
    mx = len(b)+l[8]
    mn = len(b)
else:
    mx = len(b)+l[8]
    mn = 1
    
print(mn,mx)

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

color = [False for _ in range(8)]
x = 0
for a in A:
    if a >= 3200:
        x += 1
    else:
        tmp = a // 400
        color[tmp] = True

ans = color.count(True)
if ans == 0:
    print(1, ans + x)
else:
    print(ans, ans + x)

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
num = [n for n in range(1,4801)]
kind = 0
kindlist = [0]*8
gekiyabacount=0

for i in a:
  if i in num[:400] and kindlist[0] == 0:
    kind += 1
    kindlist[0] = 1
  elif i in num[399:799] and kindlist[1] == 0:
    kind += 1
    kindlist[1] = 1
  elif i in num[799:1199] and kindlist[2] == 0:
    kind += 1
    kindlist[2] = 1
  elif i in num[1199:1599] and kindlist[3] == 0:
    kind += 1
    kindlist[3] = 1  
  elif i in num[1599:1999] and kindlist[4] == 0:
    kind += 1
    kindlist[4] = 1
  elif i in num[1999:2399] and kindlist[5] == 0:
    kind += 1
    kindlist[5] = 1
  elif i in num[2399:2799] and kindlist[6] == 0:
    kind += 1
    kindlist[6] = 1
  elif i in num[2799:3199] and kindlist[7] == 0:
    kind += 1
    kindlist[7] = 1
  elif i in num[3199:]:
    gekiyabacount += 1
    
if sum(kindlist) >= 1:
  print(sum(kindlist),sum(kindlist)+gekiyabacount)
else:
  print(1,gekiyabacount)

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
over = 0
M = [0 for _ in range(8)]
for a in A:
    if 1 <= a <= 399:
        M[0] = 1
    elif 400 <= a <= 799:
        M[1] = 1
    elif 800 <= a <= 1199:
        M[2] = 1
    elif 1200 <= a <= 1599:
        M[3] = 1
    elif 1600 <= a <= 1999:
        M[4] = 1
    elif 2000 <= a <= 2399:
        M[5] = 1
    elif 2400 <= a <= 2799:
        M[6] = 1
    elif 2800 <= a <= 3199:
        M[7] = 1
    elif 3200 <= a:
        over += 1
count = sum(M)
if count == 0:
    print(str(1)+' '+str(over))
else:
    print(str(count)+' '+str(count+over))

Solution (Python):

import collections
import itertools as it
import math

 

n  = int(input())

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



colors = [a_ // 400 for a_ in a if a_ < 3200]
colors_3200 = [a_ // 400 for a_ in a if a_ >= 3200]
c = collections.Counter(colors)

min_ = len(c) if c else 1
max_ = len(c) + len(colors_3200)
print(min_, max_)

Solution (Python):


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

D = {400:0, 800:0, 1200:0, 1600:0, 2000:0, 2400:0, 2800:0, 3200:0}

cnt = 0
for a in A:
    if a < 400:
        D[400]+=1
    elif a < 800:
        D[800]+=1
    elif a < 1200:
        D[1200]+=1
    elif a < 1600:
        D[1600]+=1
    elif a < 2000:
        D[2000]+=1
    elif a < 2400:
        D[2400]+=1
    elif a < 2800:
        D[2800]+=1
    elif a < 3200:
        D[3200]+=1
    elif a >= 3200:
        cnt += 1

mi = 0
ma = 0

for k, v in D.items():
    if v !=0:
        mi += 1

ma = mi + cnt
if mi == 0: mi = 1

print(str(mi) + ' ' + str(ma))

Solution (Python):
n = int(input())
A = list(map(int, input().split()))
ratelist = [1, 400, 800, 1200, 1600, 2000, 2400, 2800, 3200]
rate = [0] * n
count = 0
for i in range(n):
    rate[i] = sum([A[i] >= j for j in ratelist])
    if rate[i] == 9:
        count += 1
ans = len(set(rate))
if count > 0:
    ans -= 1
print('{} {}'. format(max(1, ans), ans + count))

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

color = [0] * 8
free = 0
for i in a:
    if i < 3200:
        c = i // 400
        color[c] = 1
    else:
        free += 1

ans = sum(color)
print(max(1, ans), ans + free)

Solution (Python):
n = int(input())
person = list(map(int,input().split())) 
color = [False] * 8
over = []

for i in range(n) :
    if (person[i] < 400) :
        color[0] = True
    elif (person[i] < 800) :
        color[1] = True
    elif (person[i] < 1200) :
        color[2] = True
    elif (person[i] < 1600) :
        color[3] = True
    elif (person[i] < 2000) :
        color[4] = True
    elif (person[i] < 2400) :
        color[5] = True
    elif (person[i] < 2800) :
        color[6] = True
    elif (person[i] < 3200) :
        color[7] = True
    else :
        over.append(True)

p = color.count(True)
if ((color.count(True) == 0) and (over.count(True) > 0)) :
    p = 1

q = color.count(True) + over.count(True)

print(p,q)

Solution (Python):
N = int(input())
rate = list(map(int, input().split()))
color = [0 for _ in range(9)]
for i in range(N):
    if rate[i] <= 399:
        color[0] += 1
    if rate[i] >= 400 and rate[i] <= 799:
        color[1] += 1
    if rate[i] >= 800 and rate[i] <= 1199:
        color[2] += 1
    if rate[i] >= 1200 and rate[i] <= 1599:
        color[3] += 1
    if rate[i] >= 1600 and rate[i] <= 1999:
        color[4] += 1
    if rate[i] >= 2000 and rate[i] <= 2399:
        color[5] += 1
    if rate[i] >= 2400 and rate[i] <= 2799:
        color[6] += 1
    if rate[i] >= 2800 and rate[i] <= 3199:
        color[7] += 1
    if rate[i] >= 3200:
        color[8] += 1
CV = 8- color[0:8].count(0)
if CV == 0:
    mi = 1
else:
    mi = CV
ma = CV + color[8]
print(mi, ma)