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())
array = [int(i) for i in input().split()]
ans_array = [0]*8
upper_num = 0

for i in array:
  if 1 <= i <= 399:
    ans_array[0] =  1
  elif 400 <= i <= 799:
    ans_array[1] =  1
  elif 800 <= i <= 1199:
    ans_array[2] =  1
  elif 1200 <= i <= 1599:
    ans_array[3] =  1
  elif 1600 <= i <= 1999:
    ans_array[4] =  1
  elif 2000 <= i <= 2399:
    ans_array[5] =  1
  elif 2400 <= i <= 2799:
    ans_array[6] =  1
  elif 2800 <= i <= 3199:
    ans_array[7] =  1
  else:
    upper_num += 1
    
min_num = max(sum(ans_array),1)
max_num = sum(ans_array) + upper_num

print(min_num, max_num)

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

red = 0
rate = []

for a in A:
    if(a>=3200):
        red += 1
    else:
        rate.append(min(a//400,7))

cnt = len(set(rate))

print(max(1,cnt),cnt+red)

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

conds = [400*i for i in range(1,9)]
colors = set()
frees = 0
for i in range(N):
    for c in conds:
        if A[i] < c:
            colors.add(c)
            break
    else:
        frees += 1
clen = len(colors)
print(clen if clen else 1, clen+frees)

Solution (Python):










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

colors = []
color = ""
another = 0

for point in scores:
  if point <= 399:
    color = "gray"
    if color not in colors:
      colors.append(color)
  elif point <= 799:
    color = "brown"
    if color not in colors:
      colors.append(color)
  elif point <= 1199:
    color = "green"
    if color not in colors:
      colors.append(color)
  elif point <= 1599:
    color = "sky"
    if color not in colors:
      colors.append(color)
  elif point <= 1999:
    color = "blue"
    if color not in colors:
      colors.append(color)
  elif point <= 2399:
    color = "yellow"
    if color not in colors:
      colors.append(color)
  elif point <= 2799:
    color = "orange"
    if color not in colors:
      colors.append(color)
  elif point <= 3199:
    color = "red"
    if color not in colors:
      colors.append(color)
  elif point > 3199:
    another += 1
    
ans = len(colors)
if ans == 0:
  print(1,another)
else:
  print(ans,ans + another)

Solution (Python):
N=int(input())
A=[int(x) for x in input().split()]
B=[0]*9
for i in range(N):
  R=A[i]//400
  if R>8:
    R=8
  B[R] +=1
answer_min=0
for i in range(8):
  if not B[i]==0:
    answer_min +=1
answer_max=answer_min+B[8]
if answer_min==0:
  answer_min=1
print(answer_min,answer_max)

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

max_=sum(l)
    
if sum(l[:-1])==0:
    min_=1
else:
    min_=sum(l[:-1])
    
print(min_,max_)

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

Colors = [0 for _ in range(8)]
any_color = 0

for a in A:
    if a <= 399:
        Colors[0] = 1
    elif a <= 799:
        Colors[1] = 1
    elif a <= 1199:
        Colors[2] = 1
    elif a <= 1599:
        Colors[3] = 1
    elif a <= 1999:
        Colors[4] = 1
    elif a <= 2399:
        Colors[5] = 1
    elif a <= 2799:
        Colors[6] = 1
    elif a <= 3199:
        Colors[7] = 1
    else:
        any_color += 1

ans_min = max(sum(Colors), 1)
ans_max = sum(Colors) + any_color

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

Solution (Python):
import sys
input = sys.stdin.readline
import collections
N = int(input())
a = [int(x) for x in input().split()]
rate = [0] * 8
flag = 0
for i in a:
    if 1 <= i <= 399:
        rate[0] = 1
    elif 400 <= i <= 799:
        rate[1] = 1
    elif 800 <= i <= 1199:
        rate[2] = 1
    elif 1200 <= i <= 1599:
        rate[3] = 1
    elif 1600 <= i <= 1999:
        rate[4] = 1
    elif 2000 <= i <= 2399:
        rate[5] = 1
    elif 2400 <= i <= 2799:
        rate[6] = 1
    elif 2800 <= i <= 3199:
        rate[7] = 1
    elif 3200 <= i:
        flag += 1
color_count = rate.count(1)
if flag:
    ans = [max(1, color_count),color_count + flag]
    print(* ans)
else:
    ans = [color_count, color_count]
    print(* ans)

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

color = set()
cnt = 0
for i in a:
  if 1 <= i <= 399:
    color.add("gray")
  elif 400 <= i <= 799:
    color.add("brown")
  elif 800 <= i <= 1199:
    color.add("green")
  elif 1200 <= i <= 1599:
    color.add("water")
  elif 1600 <= i <= 1999:
    color.add("blue")
  elif 2000 <= i <= 2399:
    color.add("yellow")
  elif 2400 <= i <= 2799:
    color.add("orange")
  elif 2800 <= i <= 3199:
    color.add("red")
  else:
    cnt += 1

print("%s %s" %(max(len(color),1), len(color) + cnt))

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
color = [0] * 9

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

num = 0
for i in range(8):
    if color[i] != 0:
        num += 1

ans = [max(1,num), num + color[8]]
print(" ".join(str(s) for s in ans))

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

grey = 0
brown = 0
green = 0
cyan = 0
blue = 0
yellow = 0
orange = 0
red = 0

minimo = 0
maximo = 0
coresLivres = 8

for valor in i:
    if 1 <= valor <= 399:
        if grey == 0:
            minimo += 1
            coresLivres -= 1
        grey += 1
    elif 400 <= valor <= 799:
        if brown == 0:
            minimo += 1
            coresLivres -= 1
        brown += 1
    elif 800 <= valor <= 1199:
        if green == 0:
            minimo += 1
            coresLivres -= 1
        green += 1
    elif 1200 <= valor <= 1599:
        if cyan == 0:
            minimo += 1
            coresLivres -= 1
        cyan += 1
    elif 1600 <= valor <= 1999:
        if blue == 0:
            minimo += 1
            coresLivres -= 1
        blue += 1
    elif 2000 <= valor <= 2399:
        if yellow == 0:
            minimo += 1
            coresLivres -= 1
        yellow += 1
    elif 2400 <= valor <= 2799:
        if orange == 0:
            minimo += 1
            coresLivres -= 1
        orange += 1
    elif 2800 <= valor <= 3199:
        if red == 0:
            minimo += 1
            coresLivres -= 1
        red += 1
    else:
        maximo += 1
 
if coresLivres == 8:
    print(1, maximo)

else:
    print(minimo, minimo+maximo)

Solution (Python):
Nc = input()
N = int(Nc)
c = map(int,input().split())
cor = ''
l = list(c)
l2 = []
maxL = 0
m = 0

for num in l:
    if 1 <= N <= 100 and 1 <= num <= 4800 and type(num) == int and len(l) == N:
        if  1 <= num <= 399:
            cor = 'cinzento'
            if cor not in l2:
                l2.append(cor)
                maxL = maxL + 1
                m = m + 1
        elif 400 <= num <= 799:
            cor = 'a'
            if cor not in l2:
                l2.append(cor)
                maxL = maxL + 1
                m = m + 1
        elif 800 <= num <= 1199:
            cor = 'b'
            if cor not in l2:
                l2.append(cor)
                maxL = maxL + 1
                m = m + 1
        elif 1200 <= num <= 1599:
            cor = 'c'
            if cor not in l2:
                l2.append(cor)
                maxL = maxL + 1
                m = m + 1
        elif 1600 <= num <= 1999:
            cor = 'd'
            if cor not in l2:
                l2.append(cor)
                maxL = maxL + 1
                m = m +1
        elif 2000 <= num <= 2399:
            cor = 'e'
            if cor not in l2:
                l2.append(cor)
                maxL = maxL + 1
                m = m + 1
        elif 2400 <= num <= 2799:
            cor = 'f'
            if cor not in l2:
                l2.append(cor)
                maxL = maxL + 1
                m = m + 1
        elif 2800 <= num <= 3199:
            cor = 'g'
            if cor not in l2:
                l2.append(cor)
                maxL = maxL + 1
        else:
            maxL = maxL + 1
            cor = 'escolha'
            if cor not in l2:
                l2.append(cor)
                m = m + 1
            
           
print(m, maxL)

Solution (Python):
Nc = input()
N = int(Nc)
c = map(int,input().split())
cor = ''
l = list(c)
l2 = []
maxL = 0
gambiarra = 0
m = 0

for num in l:
    if 1 <= N <= 100 and 1 <= num <= 4800 and type(num) == int and len(l) == N:
        if  1 <= num <= 399:
            cor = 'cinzento'
            if cor not in l2:
                l2.append(cor)
                maxL = maxL + 1
                m = m + 1
        elif 400 <= num <= 799:
            cor = 'a'
            if cor not in l2:
                l2.append(cor)
                maxL = maxL + 1
                m = m + 1
        elif 800 <= num <= 1199:
            cor = 'b'
            if cor not in l2:
                l2.append(cor)
                maxL = maxL + 1
                m = m + 1
        elif 1200 <= num <= 1599:
            cor = 'c'
            if cor not in l2:
                l2.append(cor)
                maxL = maxL + 1
                m = m + 1
        elif 1600 <= num <= 1999:
            cor = 'd'
            if cor not in l2:
                l2.append(cor)
                maxL = maxL + 1
                m = m +1
        elif 2000 <= num <= 2399:
            cor = 'e'
            if cor not in l2:
                l2.append(cor)
                maxL = maxL + 1
                m = m + 1
        elif 2400 <= num <= 2799:
            cor = 'f'
            if cor not in l2:
                l2.append(cor)
                maxL = maxL + 1
                m = m + 1
        elif 2800 <= num <= 3199:
            cor = 'g'
            if cor not in l2:
                l2.append(cor)
                maxL = maxL + 1
        elif 3199 <= num <= 4800:
            maxL = maxL + 1
            cor = 'escolha'
            if cor not in l2:
                l2.append(cor)
                m = m + 1
            
           
print(m, maxL)

Solution (Python):
Nc = input()
N = int(Nc)
c = map(int,input().split())
cor = ''
l = list(c)
l2 = []
maxL = 0
gambiarra = 0
m = 0

for num in l:
    if 1 <= N <= 100 and 1 <= num <= 4800 and type(num) == int and len(l) == N:
        if  1 <= num <= 399:
            cor = 'cinzento'
            if cor not in l2:
                l2.append(cor)
                maxL = maxL + 1
                m = m + 1
        elif 400 <= num <= 799:
            cor = 'a'
            if cor not in l2:
                l2.append(cor)
                maxL = maxL + 1
                m = m + 1
        elif 800 <= num <= 1199:
            cor = 'b'
            if cor not in l2:
                l2.append(cor)
                maxL = maxL + 1
                m = m + 1
        elif 1200 <= num <= 1599:
            cor = 'c'
            if cor not in l2:
                l2.append(cor)
                maxL = maxL + 1
                m = m + 1
        elif 1600 <= num <= 1999:
            cor = 'd'
            if cor not in l2:
                l2.append(cor)
                maxL = maxL + 1
                m = m +1
        elif 2000 <= num <= 2399:
            cor = 'e'
            if cor not in l2:
                l2.append(cor)
                maxL = maxL + 1
                m = m + 1
        elif 2400 <= num <= 2799:
            cor = 'f'
            if cor not in l2:
                l2.append(cor)
                maxL = maxL + 1
                m = m + 1
        elif 2800 <= num <= 3199:
            cor = 'g'
            if cor not in l2:
                l2.append(cor)
                maxL = maxL + 1
        elif 3199 <= num <= 4800:
            maxL = maxL + 1
            cor = 'escolha'
            if cor not in l2:
                l2.append(cor)
                m = m + 1
            else:
                l2.append(cor)
                gambiarra = gambiarra + 1
            
            
           
print(m, maxL)

Solution (Python):
def color_check(n):
    if n < 400:
        return "grey"
    elif n < 800:
        return "brown"
    elif n < 1200:
        return "green"
    elif n < 1600:
        return "cyan"
    elif n < 2000:
        return "blue"
    elif n < 2400:
        return "yellow"
    elif n < 2800:
        return "orange"
    elif n < 3200:
        return "red"
    else:
        return "any"

colors_so_far = set()
cany = 0
n = input()
c = map(int, input().split())

for i in c:
    color = color_check(i)
    if color != "any":
        colors_so_far.add(color)
    else:
        cany += 1

x = len(colors_so_far)
if x < 1:
    print(1, cany)
else:
    print(x, len(colors_so_far)+cany)

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

Solution (Python):
li=[0]*8
o=0
n,*a=map(int,open(0).read().split())
for i in a:
  if i>=3200:
    o+=1  
  else:
    li[i//400]=1




if sum(li)==0:
  print(1,min(o,8))
else:
  print(sum(li),(sum(li)+o))

Solution (Python):
import sys
import numpy as np

n = int(sys.stdin.readline().rstrip())
a = np.array(sys.stdin.readline().split(), dtype=np.int64)

def main():
    res = np.bincount(np.minimum(a // 400, 8), minlength=9)
    
    ans_min = np.count_nonzero(res[:8])
    ans_max = ans_min + res[8]
    if ans_min == 0:
        ans_min = 1
 
    return ans_min, ans_max

if __name__ == '__main__':
    ans = main()
    print(*ans, sep=' ')

Solution (Python):
color = [0 for i in range(8)]

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

p = 0
for a in al:
    if a < 3200:
        color[a//400] = 1
    else:
        p += 1
print(max(sum(color), 1))
print(sum(color) + p)

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def main():
    over=0
    n=int(input())
    aa=LI()
    cnt=[0]*8
    for a in aa:
        if a>=3200:over+=1
        else:cnt[a//400]=1
    s=sum(cnt)
    print(max(1,s),s+over)

main()

Solution (Python):
ratings = [(400 * i - 1) for i in range(1, 9)]
present = [0 for i in range(1, 9)]
n = int(input())
a = list(map(int, input().split()))
hi = 0
for x in a:
	itr = 0
	while itr < len(ratings) and x > ratings[itr]:
		itr = itr + 1
	if (itr == len(ratings)):
		hi = hi + 1
	else:
		present[itr] = 1
sm = sum(present)
mn, mx = sm, sm + hi
if sm == 0:
	mn = 1
print("%d %d" % (mn, mx))

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
c1 = c2 = c3 = c4 = c5 = c6 = c7 = c8 = c9 = 0
for i in range(n):
    if 1 <= a[i] < 400:
        c1 = 1
    elif 400 <= a[i] < 800:
        c2 = 1
    elif 800 <= a[i] < 1200:
        c3 = 1
    elif 1200 <= a[i] < 1600:
        c4 = 1
    elif 1600 <= a[i] < 2000:
        c5 = 1
    elif 2000 <= a[i] < 2400:
        c6 = 1
    elif 2400 <= a[i] < 2800:
        c7 = 1
    elif 2800 <= a[i] < 3200:
        c8 = 1
    else:
        c9 += 1
print(max(1, c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8),
      c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 + c9)

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

Solution (Python):


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

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

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

print('1' if ans == 0 else ans, end=' ')
print(ans + color[8])

Solution (Python):
N = int(input())
a = list(map(int, input().split()))
color = [0] * 9
for p in a:
    if p >= 3200: color[8] += 1
    else: color[p // 400] += 1
small = len([c for c in color[0:8] if c > 0])
big = small + color[8]
if not small: small += 1
print(small, big)

Solution (Python):
import sys
N = int(sys.stdin.readline())
A = list(map(int, sys.stdin.readline().split()))
maxA = max(A)
L=[0 for _ in range(9)]
for a in A:
    if a <=399:
        L[0]+=1
    elif a <=799:
        L[1]+=1
    elif a <=1199:
        L[2]+=1
    elif a <=1599:
        L[3]+=1
    elif a <=1999:
        L[4]+=1
    elif a <=2399:
        L[5]+=1
    elif a <=2799:
        L[6]+=1
    elif a <=3199:
        L[7]+=1
    else:
        L[8]+=1
cnt=0
for i in range(8):
    if L[i] !=0:
        cnt+=1
if cnt==0 and L[8]!=0:
    Min =1
else:
    Min = cnt
print(Min, cnt+L[8])

Solution (Python):
n = int(input())
l = [int(i) for i in input().split()]
ans = [0 for _ in range(9)]
free = 0
for i in l:
    if i < 3200:
        ans[i//400] += 1
    else:
        free += 1
        
ans = [i for i in ans if i != 0]
print(len(ans) if ans else 1,len(ans) + free)

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

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
C = set()
R = 0
for a in A:
    c = a//400 if a<3200 else 8
    C.add(c)
    if c==8: R+=1

print(len(C) - min(1, R, len(C)-1), len(C) + max(0, R-1))

Solution (Python):
N = int(input())
L = [0 for i in range(9)]
S = list(map(int, input().split()))
for i in range(N):
  p = S[i] // 400
  if p <= 7:
    L[p] += 1
  else:
    L[8] += 1
Z, M, m = 0, 0, 0
for i in range(8):
  if L[i] == 0:
    Z += 1
  else:
    M += 1
    m += 1
M += L[8]
if m == 0 and L[8] != 0:
  m = 1
print(m, M)

Solution (Python):

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

n = int(input())
a = list(map(int, input().split()))
ans = 0
color = [False]*8
for i in a:
    if i >= 3200:
        ans += 1
        continue
    color[i//400] = True
print(max(color.count(True), 1), ans+color.count(True))

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

d = {"Gray": 0, "Brown": 0, "Green": 0, "Sky": 0, "Blue": 0, "Yellow": 0, "Orange": 0, "Red": 0}
f = 0

for i in range(N):
    s = A[i]
    if s <= 399:
        d["Gray"] += 1
    elif s >= 400 and s <= 799:
        d["Brown"] += 1
    elif s >= 800 and s <= 1199:
        d["Green"] += 1
    elif s >= 1200 and s <= 1599:
        d["Sky"] += 1
    elif s >= 1600 and s <= 1999:
        d["Blue"] += 1
    elif s >= 2000 and s <= 2399:
        d["Yellow"] += 1
    elif s >= 2400 and s <= 2799:
        d["Orange"] += 1
    elif s >= 2800 and s <= 3199:
        d["Red"] += 1
    elif s >= 3200:
        f += 1

MIN = 0
for v in d.values():
    if v > 0:
        MIN += 1

MAX = MIN + f

if MIN == 0 :
    MIN = 1

print(MIN, MAX)

Solution (Python):
n=int(input())
a=sorted(list(map(int,input().split())))
c=[0]*8
k=n
for i in range(n):
    for j in range(8):
        if 400*j<=a[i]<400*(j+1):
            c[j]=1
            break
    else:
        k=i
        break


d=c.count(1)
if d==0:
    print(1, end=" ")
else:
    print(d, end=" ")

print(d+(n-k))

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

min_color = 0
max_color = 0

cnt = 0

color = [0] * 8

for i in a:
    if i < 400 and color[0] == 0:
        min_color += 1
        max_color += 1
        color[0] = 1

    elif 400 <= i and i < 800 and color[1] == 0:
        min_color += 1
        max_color += 1
        color[1] = 1

    elif 800 <= i and i < 1200 and color[2] == 0:
        min_color += 1
        max_color += 1
        color[2] = 1

    elif 1200 <= i and i < 1600 and color[3] == 0:
        min_color += 1
        max_color += 1
        color[3] = 1

    elif 1600 <= i and i < 2000 and color[4] == 0:
        min_color += 1
        max_color += 1
        color[4] = 1

    elif 2000 <= i and i < 2400 and color[5] == 0:
        min_color += 1
        max_color += 1
        color[5] = 1

    elif 2400 <= i and i < 2800 and color[6] == 0:
        min_color += 1
        max_color += 1
        color[6] = 1

    elif 2800 <= i and i < 3200 and color[7] == 0:
        min_color += 1
        max_color += 1
        color[7] = 1

    elif i >= 3200:
        max_color += 1
        cnt += 1

if cnt == N:
    min_color = 1

print(min_color, max_color)

Solution (Python):
import sys

if sys.platform =='ios':
	sys.stdin=open('Untitled.txt')
input = sys.stdin.readline
def INT(): return int(input())
def MAP(): return [int(s) for s in input().split()]

N = INT()
A = MAP()

norm = []
genius = []
for a in A:
	if a >= 3200: genius.append(a//400)
	else: norm.append(a//400)




print(len(set(norm)) if norm else 1, len(set(norm))+len(genius))

Solution (Python):
from sys import stdin
n = int(stdin.readline().rstrip())
a = list(map(int, stdin.readline().rstrip().split()))

c = [0] * 9
for i in a:
    if i >= 3200:
        c[8] += 1
    else:
        for j in range(9):
            if 400 * j <= i <= 400 * j + 399:
                c[j] += 1

res = len([i for i in c[:-1] if i > 0])
print(1 if res == 0 else res, res + c[-1])

Solution (Python):
import sys
import collections


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n = int(readline())
    a = list(map(int, readline().split()))
    d = collections.defaultdict(int)
    for i in range(n):
        if 1 <= a[i] <= 399:
            d[0] += 1
        elif 400 <= a[i] <= 799:
            d[1] += 1
        elif 800 <= a[i] <= 1199:
            d[2] += 1
        elif 1200 <= a[i] <= 1599:
            d[3] += 1
        elif 1600 <= a[i] <= 1999:
            d[4] += 1
        elif 2000 <= a[i] <= 2399:
            d[5] += 1
        elif 2400 <= a[i] <= 2799:
            d[6] += 1
        elif 2800 <= a[i] <= 3199:
            d[7] += 1
        else:
            d[8] += 1
    print(len(d) if 8 not in d else 1 if len(d) == 1 else len(d) - 1, len(d) if 8 not in d else len(d) + d[8] - 1)


if __name__ == '__main__':
    solve()

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):
n = int(input())
a = list(map(int, input().split()))
colorSet = set()
minAns = 0
maxAns = 0
cnt = 0

for i in range(n):
    color = a[i] // 400
    if color < 8:
        colorSet.add(color)
    else:
        colorSet.add(8)

    if color >= 8:
        cnt += 1



if len(colorSet) > 1 and any(item >= 8 for item in colorSet):
    minAns = len(colorSet) - 1
else:
    minAns = len(colorSet)

if cnt > 0:
    
    maxAns = len(colorSet) - 1 + cnt
else:
    maxAns = len(colorSet)

print(minAns, maxAns)

Solution (Python):
import bisect
N = int(input())
a = sorted(list(map(int, input().split())))
color = [400, 800, 1200, 1600, 2000, 2400, 2800, 3200]
border = []
for i in color:
    border.append(bisect.bisect_left(a, i))
border = [0] + border
num = []
for i in range(len(color)):
    num.append(border[i+1] - border[i])
num.append(N - sum(num))
colornum = sum(x>0 for x in num[:-1])
print(str(max(1, colornum)) + " " + str(colornum + num[-1]))

Solution (Python):
N = int(input())
a = list(map(int,input().split()))
col = [0]*8
wild = 0
for i in a:
    if i//400 <= 7:
        col[i//400] = 1
    else:
        wild += 1
minimum = max(1,sum(col))
maximum = sum(col)+wild
print(minimum,maximum)

Solution (Python):
N = int(input())
a = list(map(int,input().split()))
num = [0 for i in range(9)]
for i in range(N):
    if a[i] < 3200:
        num[a[i]//400] += 1
    else:
        num[-1] += 1

if num[-1] == 0:
    num = [i for i in num if i != 0]
    print(len(num),len(num))
else:

    n = num.pop(-1)

    num2 = [i for i in num if i != 0]
    print(max(1,len(num2)),len(num2)+n)

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

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

k = len(list(filter(lambda x: x > 0, color[:-1])))
print(1 if k == 0 else k, k + color[-1])

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

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

k = len(list(filter(lambda x: x > 0, color[:-1])))
print(1 if k == 0 else k, k + color[-1])

Solution (Python):
n = int(input())
l = list(map(int, input().split()))
c = [False] * 8
red = 0
for i in range(n):
    if l[i] <= 399:
        c[0] = True
    elif l[i] <= 799:
        c[1] = True
    elif l[i] <= 1199:
        c[2] = True
    elif l[i] <= 1599:
        c[3] = True
    elif l[i] <= 1999:
        c[4] = True
    elif l[i] <= 2399:
        c[5] = True
    elif l[i] <= 2799:
        c[6] = True
    elif l[i] <= 3199:
        c[7] = True
    else:
        red += 1
ans_min = max(1, c.count(True))
ans_max = c.count(True) + red
print(ans_min, ans_max)

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
r=[0]*9
for i in range(n):
    if a[i]<=399:
        r[0]+=1
    elif a[i]<=799:
        r[1]+=1
    elif a[i]<=1199:
        r[2]+=1
    elif a[i]<=1599:
        r[3]+=1
    elif a[i]<=1999:
        r[4]+=1
    elif a[i]<=2399:
        r[5]+=1
    elif a[i]<=2799:
        r[6]+=1
    elif a[i]<=3199:
        r[7]+=1
    else:
        r[8]+=1
c=0
for i in range(8):
    if r[i]:
        c+=1
print(max(c,1),c+r[8])

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
cnt = [0,0,0,0,0,0,0,0]
count = 0
num = 0

for i in a:
    if 1 <= i <= 399:
        cnt[0] += 1
    elif 400<= i <= 799:
        cnt[1] += 1
        
    elif 800<= i <= 1199:
        cnt[2] += 1
        
    elif 1200<= i <= 1599:
        cnt[3] += 1
        
    elif 1600<= i <= 1999:
        cnt[4] += 1
        
    elif 2000<= i <= 2399:
        cnt[5] += 1
        
    elif 2400<= i <= 2799:
        cnt[6] += 1
       
    elif 2800 <= i <= 3199:
        cnt[7] += 1
        
    else:
        count += 1
for i in range(len(cnt)):
    if cnt[i] > 0:
        num +=1
if num == 0:
    num += 1
    print(num,num+count-1)
    exit()
print(num,num+count)

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

for i in range(9):
  dct[i] = 0
  
for i in A:
  if (i >= 1 and i < 400):
    dct[0] += 1
  elif (i >= 400 and i < 800):
    dct[1] += 1
  elif (i >= 800 and i < 1200):
    dct[2] += 1
  elif (i >= 1200 and i < 1600):
    dct[3] += 1    
  elif (i >= 1600 and i < 2000):
    dct[4] += 1    
  elif (i >= 2000 and i < 2400):
    dct[5] += 1    
  elif (i >= 2400 and i < 2800):
    dct[6] += 1    
  elif (i >= 2800 and i < 3200):
    dct[7] += 1    
  else:
    dct[8] += 1  

color1 = 0
color2 = 0
for i in dct.items():  
  if (i[0] == 8):
    color2 = i[1]
  else:
    if (i[1] > 0):
      color1 += 1

ans1 = color1
ans2 = color1+color2
if (color1 == 0):
  ans1 = 1
print(ans1,ans2)

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

for i in range(N):
    if a[i] >= 3200:
        CntOver3200 = N - i
        break
    rate[a[i] // 400] = True
min_val = max(sum(rate) , 1)
if any(rate):
    max_val = min_val + CntOver3200
else:
    max_val = CntOver3200
print(min_val , max_val)

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


plst = [int(i) for i in input().split()]
lst = [0] * 8
kami = 0
for i in plst:
    l = i // 400
    if l >= 8:
        kami += 1
    else:
        lst[l] = 1
s = sum(lst)
print(max(s, 1), s + kami)

Solution (Python):
n=int(input())
a=sorted(list(map(int,input().split())))
c=[0]*8
k=n
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:
        k=i
        break

d=0
for i in range(8):
    if c[i]==1:
        d+=1
if d==0:
    print(1, end=" ")
else:
    print(d, end=" ")



print(d+(n-k))