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

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

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

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

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

Solution (Python):
N = int(input())
A = list( map(int,input().split()) )
flag = [0 for i in range(8)]
n = 0
c = 0
for a in A:
  if a  >= 3200:
    n += 1
  elif flag[a//400] == 0:
    flag[a//400] = 1
    c += 1

if c == 0:
  print( 1 , c+n  )
else:
  print( c , c+n )

Solution (Python):
N = int(input())
a = list(map(int, input().split()))
r_table = [1, 400, 800, 1200, 1600, 2000, 2400, 2800, 3200]
rate = [0]*8
god = 0
for x in a:
    for id, y in enumerate(r_table):
        if x >= y:
            if id == 8:
                god += 1
                break
        else:
            rate[id-1] = 1
            break
print(max(sum(rate), 1), sum(rate) + god)

Solution (Python):
from collections import Counter

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

da = [ai//400 for ai in aa if ai<3200]
over = sum([ai>=3200 for ai in aa])

c = Counter(da)

min_v = max(1,len(c))
max_v = len(c)+over

print(min_v,max_v)

Solution (Python):
n = int(input())
a = input().split()
b = []
max = 0
r = (0, 400, 800, 1200, 1600, 2000, 2400, 2800, 3200)
for i in range(n):
    if int(a[i]) >= 3200:
        max += 1
    else:
        for j in range(len(r)-1):
            if int(r[j]) <= int(a[i]) < int(r[j+1]):
                b.append(r[j])

min = len(set(b))
print(str(min)+' '+str(min+max) if min != 0 else '1'+' '+str(max))

Solution (Python):
N = int(input())
Data = list(map(int,input().split()))
Kind = [0] * 9
for d in Data:
    if d < 400:
        Kind[0] += 1
    elif d < 800:
        Kind[1] += 1
    elif d < 1200:
        Kind[2] += 1
    elif d < 1600:
        Kind[3] += 1
    elif d < 2000:
        Kind[4] += 1
    elif d < 2400:
        Kind[5] += 1
    elif d < 2800:
        Kind[6] += 1
    elif d < 3200:
        Kind[7] += 1
    else:
        Kind[8] += 1
k = 0
for i in range(8):
    if Kind[i] > 0:
        k += 1
if Kind[8] == 0:
    min1 = k
elif k == 0:
    min1 = 1
else:
    min1 = max(1,k)
max1 = k + Kind[8]
print(min1,max1)

Solution (Python):
N=int(input())
A=sorted(list(map(int,input().split())))
A=[i//400 for i in A]

Colors=[0,0,0,0,0,0,0,0,0]
for i in A:
    if i>=8:
        Colors[8]+=1
    else:
        Colors[i]+=1

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

print(max(Count,1),Count+Colors[-1])

Solution (Python):

import sys


def solve(N: int, a: "List[int]"):
    color = set()
    rainbow_count = 0
    for i in range(N):
        if a[i]<=399:
            color.add("gray")
        elif a[i]<=799:
            color.add("brown")
        elif a[i]<=1199:
            color.add("green")        
        elif a[i]<=1599:
            color.add("lightblue")        
        elif a[i]<=1999:
            color.add("blue")        
        elif a[i]<=2399:
            color.add("yellow")
        elif a[i]<=2799:
            color.add("orange")        
        elif a[i]<=3199:
            color.add("red")
        else:
            rainbow_count+=1
    
    min_answer = len(color)
    max_answer = len(color) + rainbow_count
    
    if not color and rainbow_count >0:
      min_answer=1
      max_answer=rainbow_count
    print(min_answer,max_answer)

    return


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

if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
ary = list(map(int, input().split()))
dic = {'gray': 0, 'brawn': 0, 'green': 0, 'water': 0, 'blue': 0, 'yellow': 0, 'orange': 0, 'red': 0}
god = 0

for rate in ary:
    if 0 <= rate < 400:
        dic['gray'] = 1
    elif 400 <= rate < 800:
        dic['brawn'] = 1
    elif 800 <= rate < 1200:
        dic['green'] = 1
    elif 1200 <= rate < 1600:
        dic['water'] = 1
    elif 1600 <= rate < 2000:
        dic['blue'] = 1
    elif 2000 <= rate < 2400:
        dic['yellow'] = 1
    elif 2400 <= rate < 2800:
        dic['orange'] = 1
    elif 2800 <= rate < 3200:
        dic['red'] = 1
    else:
        god += 1
cnt = sum(dic.values())
if cnt == 0:
    print(1, god)
else:
    print(cnt, cnt+god)

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

def get_color(point):
    color = ''
    if 400 > point:
        color = 'grey'
    elif 800 > point:
        color = 'brown'
    elif 1200 > point:
        color = 'green'
    elif 1600 > point:
        color = 'light blue'
    elif 2000 > point:
        color = 'blue'
    elif 2400 > point:
        color = 'yellow'
    elif 2800 > point:
        color = 'orange'
    elif 3200 > point:
        color = 'red'
    else:
        color = 'free'
    return color
dict = {}
for i in range(N):
    color = get_color(a[i])
    if color not in dict.keys():
        dict[color] = 1
    else:
        dict[color] += 1

min_cnt = 0
max_cnt = 0
if 'free' not in dict.keys():
    min_cnt = max_cnt = len(dict.keys())
else:
    min_cnt = max(1, len(dict.keys())-1)
    max_cnt = len(dict.keys())-1 + dict['free']

print(min_cnt, max_cnt)

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

colors = [0] * 13
for i in list(map(int, input().split())):
    colors[i//400] += 1

ans = 8 - colors[:8].count(0)
free = sum(colors[8:])

print(max(1, ans), max(1, ans + free))

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
a.sort()
color = set()
free = 0
for i in range(n):
    if a[i] < 3200:
        color.add(a[i]//400)
    else:
        free += 1
print("{} {}".format(max(1, len(color)), free + len(color)))

Solution (Python):
n=int(input())
l=[int(i) for i in input().split()]
c=[0]*8 
ind=0 
for i in l:
    if 1<=i<=399:
        c[0]+=1 
    if 400<=i<=799:
        c[1]+=1 
    if 800<=i<=1199:
        c[2]+=1 
    if 1200<=i<=1599:
        c[3]+=1 
    if 1600<=i<=1999:
        c[4]+=1 
    if 2000<=i<=2399:
        c[5]+=1 
    if 2400<=i<=2799:
        c[6]+=1 
    if 2800<=i<=3199:
        c[7]+=1 
    if i>=3200:
        ind+=1 
s=sum(i>0 for i in c)

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

Solution (Python):
def check(ai, ratemax, d):
    if 3199 < ai:
        ratemax += 1
    else:
        d[ai // 400] = 1
    return ratemax


def main():
    N, *a = map(int, open(0).read().split())
    lst = [0] * 8
    ratemax = 0
    for ai in a:
        ratemax = check(ai, ratemax, lst)
    print(sum(lst) if sum(lst) else 1, sum(lst) + ratemax)
    return


main()

Solution (Python):
from collections import defaultdict


def check(ai, ratemax, d):
    if 3199 < ai:
        ratemax += 1
    else:
        d[ai // 400] += 1
    return ratemax


def main():
    N, *a = map(int, open(0).read().split())
    d = defaultdict(lambda: 0)
    ratemax = 0
    for ai in a:
        ratemax = check(ai, ratemax, d)
    print(len(d) if len(d) else 1, len(d) + ratemax)
    return


main()

Solution (Python):
from collections import defaultdict


def check(ai, ratemax, d):
    if 1 <= ai <= 399:
        d[0] += 1
    elif 400 <= ai <= 799:
        d[1] += 1
    elif 800 <= ai <= 1199:
        d[2] += 1
    elif 1200 <= ai <= 1599:
        d[3] += 1
    elif 1600 <= ai <= 1999:
        d[4] += 1
    elif 2000 <= ai <= 2399:
        d[5] += 1
    elif 2400 <= ai <= 2799:
        d[6] += 1
    elif 2800 <= ai <= 3199:
        d[7] += 1
    else:
        ratemax += 1
    return ratemax


def main():
    N, *a = map(int, open(0).read().split())
    d = defaultdict(lambda: 0)
    ratemax = 0
    for ai in a:
        ratemax = check(ai, ratemax, d)
    print(len(d) if len(d) else 1, len(d) + ratemax)
    return


main()

Solution (Python):
from collections import defaultdict


def check(x, ratemax, d):
    if 1 <= x <= 399:
        d[0] += 1
    elif 400 <= x <= 799:
        d[1] += 1
    elif 800 <= x <= 1199:
        d[2] += 1
    elif 1200 <= x <= 1599:
        d[3] += 1
    elif 1600 <= x <= 1999:
        d[4] += 1
    elif 2000 <= x <= 2399:
        d[5] += 1
    elif 2400 <= x <= 2799:
        d[6] += 1
    elif 2800 <= x <= 3199:
        d[7] += 1
    else:
        ratemax += 1
    return ratemax


def main():
    N, *a = map(int, open(0).read().split())
    d = defaultdict(lambda: 0)
    ratemax = 0
    for x in a:
        ratemax = check(x, ratemax, d)
    print(len(d) if len(d) else 1, len(d) + ratemax)
    return


main()

Solution (Python):
from collections import defaultdict


def main():
    N, *a = map(int, open(0).read().split())
    d = defaultdict(lambda: 0)
    ratemax = 0
    for x in a:
        if 1 <= x <= 399:
            d[0] += 1
        elif 400 <= x <= 799:
            d[1] += 1
        elif 800 <= x <= 1199:
            d[2] += 1
        elif 1200 <= x <= 1599:
            d[3] += 1
        elif 1600 <= x <= 1999:
            d[4] += 1
        elif 2000 <= x <= 2399:
            d[5] += 1
        elif 2400 <= x <= 2799:
            d[6] += 1
        elif 2800 <= x <= 3199:
            d[7] += 1
        else:
            ratemax += 1
    print(len(d) if len(d) else 1, len(d) + ratemax)
    return


main()

Solution (Python):
N = int(input())
A = sorted(list(map(int,input().split())))
G = {i:0 for i in range(9)}
for i in range(N):
    if A[i]<=399:
        G[0] += 1
    elif A[i]<=799:
        G[1] += 1
    elif A[i]<=1199:
        G[2] += 1
    elif A[i] <= 1599:
        G[3] += 1
    elif A[i] <= 1999:
        G[4] += 1
    elif A[i] <= 2399:
        G[5] += 1
    elif A[i] <= 2799:
        G[6] += 1
    elif A[i] <= 3199:
        G[7] += 1
    else:
        G[8] += 1
cnt = 0
for i in range(8):
    if G[i] > 0:
        cnt += 1
if cnt==0:
    cmin = 1
    cmax = G[8]
else:
    cmin = cnt
    cmax = cmin+G[8]
print(cmin,cmax)

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

FD = [0]*9

for i in range(n):
  if A[i]<3200:
    FD[A[i]//400] += 1
  else:
    FD[8] += 1

count = 0
for j in range(8):
  if FD[j]:
    count += 1

print(max(count,1),count+FD[8])

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

c = []
cnt = 0
for a in A:
    if a < 400:
        c.append(0)
    elif a < 800:
        c.append(1)
    elif a < 1200:
        c.append(2)
    elif a < 1600:
        c.append(3)
    elif a < 2000:
        c.append(4)
    elif a < 2400:
        c.append(5)
    elif a < 2800:
        c.append(6)
    elif a < 3200:
        c.append(7)
    else:
        cnt += 1
d = len(set(c))

if d == 0:
    print(1, cnt)
else:
    print(d, d+cnt)

Solution (Python):
N=int(input())
A=list(map(int,input().split()))
cnt=0
X=set()
for i in range(N):
  if(A[i]>=3200):
    cnt+=1
  else:
    X.add(A[i]//400)
if(len(X)):
  print(len(X),len(X)+cnt)
else:
  print(1,cnt)

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
red=0
kind=0
b=[]
for i in range(8):
    b.append([i,0])
for i in range(n):
    if a[i]<3200:
        b[a[i]//400][1]+=1
    else:
        red+=1
for i in range(8):
    if b[i][1]!=0:
        kind+=1
minc=1 if kind==0 else kind
maxc=kind+red 
print(str(minc)+" "+str(maxc))

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
b = [8 for _ in range(n)]
free = 0
for i in range(n):
    if a[i] > 3199:
        free += 1
    else:
        b[i] = a[i] // 400
if 8 in set(b):
    under = len(set(b)) - 1
else:
    under = len(set(b))
if under != 0:
    m = under
else:
    m = 1
M = under + free
print(m, M)

Solution (Python):
n = int(input())
l = list(map(int,input().split()))
color = [0]*10
ans = 0
aans = 0
for i in range(n):
    if l[i] >= 3200:
        aans += 1
    else:
        color[int(l[i]/400)] += 1
for i in color:
    if i > 0:
        ans += 1
if aans == n:
    print(1,n)
else:
    print(ans,aans+ans)

Solution (Python):
colors = [0 for _ in range(8)]
extra = 0
n = int(input())
A = list(map(int,input().split()))

for a in A:
    color = a//400
    if color >=8:
        extra +=1
    else:
        colors[color] = 1

num_8 = sum(colors)
lower = num_8
if lower==0 and extra>0:
    lower = 1
higher = num_8+extra

print(lower,higher)

Solution (Python):
N=int(input())
check=[0,0,0,0,0,0,0,0]
rate=list(map(int,input().split()))
red=0
for n in range(N):
  if 1<=rate[n]<400:
    check[0]=1
  elif 400<=rate[n]<800:
    check[1]=1
  elif 800<=rate[n]<1200:
    check[2]=1
  elif 1200<=rate[n]<1600:
    check[3]=1
  elif 1600<=rate[n]<2000:
    check[4]=1
  elif 2000<=rate[n]<2400:
    check[5]=1
  elif 2400<=rate[n]<2800:
    check[6]=1
  elif 2800<=rate[n]<3200:
    check[7]=1
  else:
    red+=1
if sum(check)==0:
  M=red
  m=1
else:
  M=sum(check)+red
  m=sum(check)
print(m,M)

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


def main():
    N = int(input())
    a = list(map(int, input().split()))
    A = [0]*8
    n = 0
    for i in a:
        if i >= 3200:
            n += 1
        else:
            A[i//400] = 1
    if sum(A) == 0 and n > 0:
        print(1, n)
    else:
        print(sum(A), sum(A) + n)


if __name__ == '__main__':
    main()

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
a.sort()
b=[0]*8
legend=0
for i in range(n):
    if a[i]<=3199:
        b[a[i]//400]=1
    else:
        legend+=1
if b.count(1)==0:
    print(1,legend)
elif b.count(1):
    print(b.count(1),b.count(1)+legend)

Solution (Python):


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

n_gray_to_red = len(set([x//400 for x in a if x < 3200]))
n_3200_and_above = len([x for x in a if x >= 3200])

print(max(n_gray_to_red, 1), n_gray_to_red + n_3200_and_above)

Solution (Python):
import sys
input = sys.stdin.readline
from operator import itemgetter
sys.setrecursionlimit(10000000)

def main():
    n = int(input().strip())
    v = list(map(int, input().strip().split()))
    t = 0
    kind = set()
    for e in v:
        if e // 400 >= 8:
            t += 1
        else:
            kind.add(e // 400)
    print(max(1,len(kind)), len(kind) + t)


if __name__ == '__main__':
    main()

Solution (Python):
n,*a=map(int,open(0).read().split())
r=[400,800,1200,1600,2000,2400,2800,3200]
b=[0]*8
c=0
for i in range(n):
    for j in range(8):
        if a[i]<r[j]:
            b[j]=1
            break
    if a[i]>=3200:    
        c+=1
print(max(1,sum(b)),c+sum(b))

Solution (Python):

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

C = set()
Tourist = 0

for a in A:
    if 1<=a<=399:
        C.add('Glay')
    elif 400<=a<=799:
        C.add('Brown')
    elif 800<=a<=1199:
        C.add('Green')
    elif 1200<=a<=1599:
        C.add('Water')
    elif 1600<=a<=1999:
        C.add('Blue')
    elif 2000<=a<=2399:
        C.add('Yellow')
    elif 2400<=a<=2799:
        C.add('Orange')
    elif 2800<=a<=3199:
        C.add('Red')
    elif 3200<=a:
        C.add('Tourist')
        Tourist += 1

MIN = len(C) - (1 if Tourist >= 1 else 0)
MAX = len(C) + (Tourist -1 if Tourist >= 1 else 0)

if Tourist == N:
    MIN = 1

print(MIN,MAX)

Solution (Python):
n = int(input())
list_a = list(map(int, input().split()))
num_rank = [0 for _ in range(9)]
for one_a in list_a:
  temp_rank = one_a // 400
  if temp_rank > 8:
    temp_rank = 8
  num_rank[temp_rank] += 1
if len([i for i in num_rank[:-1] if i > 0]) > 0:
  min_color = len([i for i in num_rank[:-1] if i > 0])
else:
  min_color = 1
max_color = len([i for i in num_rank[:-1] if i > 0]) + num_rank[-1]
print("{} {}".format(min_color, max_color))

Solution (Python):


N=int(input())
A=list(map(int,input().split()))
l=[0]*9
for a in A:
    if a>=3200:
        l[8]+=1
    else:
        l[int(a//400)]=1

sl=sum(l)-l[8]
print(max(sl,1),(sl+l[8]))

Solution (Python):
def input():
    import sys
    return sys.stdin.readline().rstrip()


def main():
    import math
    import collections
    import itertools

    n = int(input())
    as_ = list(map(int, input().split()))
    colors = [a // 400 for a in as_ if a <= 3199]
    free_num = len([a for a in as_ if a >= 3200])

    num_color = len(set(colors))
    print(max(num_color, 1), num_color + free_num)

if __name__ == '__main__':
    main()

Solution (Python):

N = int(input()) 
a_list = [int(e) for e in input().split()]

color_and_number_of_persons={"gray":0,"brown":0,"green":0,"cyan":0,"blue":0,"yellow":0,"orange":0,"red":0,"other":0}
color_and_min_rate={"gray":1,"brown":400,"green":800,"cyan":1200,"blue":1600,"yellow":2000,"orange":2400,"red":2800,"other":3200}

color_and_min_rate = sorted(color_and_min_rate.items(), reverse=True, key=lambda x : x[1])

for rate in a_list:
    
    for c_and_mr in color_and_min_rate:
        if rate >= c_and_mr[1]:
            
            color_and_number_of_persons[c_and_mr[0]] += 1
            break
            


number_of_color = 0

for number_of_persons in color_and_number_of_persons.values():
    if number_of_persons != 0:
        number_of_color += 1
        
if color_and_number_of_persons["other"] != 0:
    number_of_color -= 1 
    
if number_of_color == 0:
    min_ans = 1
    max_ans = color_and_number_of_persons["other"]
else:
    min_ans = number_of_color
    max_ans = number_of_color + color_and_number_of_persons["other"]

print(min_ans,max_ans)

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
col = [0] * 9
for i in A:
  r = i//400
  if r > 8:
    r = 8
  col[r] += 1

ans = 0
for i in col[:8]:
  if i > 0:
    ans += 1

if ans == 0:
  print(1, col[-1])
else:
  print(ans, ans + col[-1])

Solution (Python):
n=int(input())
a_l=list(map(int,input().split()))
a,b,c,d,e,f,g,h=0,0,0,0,0,0,0,0
cnt=0
for i in a_l:
    if i<400*1:
        a+=1
    elif 400*1<=i<400*2:
        b+=1
    elif 400*2<=i<400*3:
        c+=1
    elif 400*3<=i<400*4:
        d+=1
    elif 400*4<=i<400*5:
        e+=1
    elif 400*5<=i<400*6:
        f+=1
    elif 400*6<=i<400*7:
        g+=1
    elif 400*7<=i<400*8:
        h+=1
    else:
        cnt+=1
ans=0
for i in [a,b,c,d,e,f,g,h]:
    if i!=0:
        ans+=1
if ans!=0:
    print(ans, ans+cnt)
else:
    print(1,cnt)

Solution (Python):
N = int(input())
a =[]
a = input().split()
flag=[False for i in range(8)]
count = 0

while a:
    tmp = int(a.pop())
    if(tmp<400):
        flag[0] = True
    elif(tmp<800):
        flag[1] = True
    elif(tmp<1200):
        flag[2] = True
    elif(tmp<1600):
        flag[3] = True
    elif(tmp<2000):
        flag[4] = True
    elif(tmp<2400):
        flag[5] = True
    elif(tmp<2800):
        flag[6] = True
    elif(tmp<3200):
        flag[7] = True
    else:
        count += 1

if True in flag:
    print(flag.count(True), flag.count(True)+count)
else:
    print(0 if count <1 else 1,count)

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

t = [0] * 8
over = 0
for x in a:
    if x >= 3200:
        over += 1
    else:
        t[x // 400] = 1
print(*[max(sum(t), 0 if over == 0 else 1), sum(t) + over])

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

b=0
for i in range(n):
  if a[i]//400>=8:
    b+=1
c=[s//400 for s in a if s<3200]
C=len(set(c))
print(C or 1, C+b)

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

Solution (Python):
import bisect

def grade(score, breakpoints=[400, 800, 1200, 1600, 2000, 2400, 2800, 3200],
          grades='abcdefghx'):
    i = bisect.bisect(breakpoints, score)
    return grades[i]

N = int(input())
a = list(map(int, input().split()))
grades = [grade(score) for score in a]

normal = [i for i in grades if i != 'x']
ans_max = len(set(normal)) + grades.count('x')
if len(normal) == 0:
    ans_min = 1
else:
    ans_min = len(set(normal))
print(ans_min, ans_max)

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
dic = {}
cnt = 0
for i in range(N):
  if A[i] < 400:
    dic[0] = 1
  elif A[i] < 800:
    dic[1] = 1
  elif A[i] < 1200:
    dic[2] = 1
  elif A[i] < 1600:
    dic[3] = 1
  elif A[i] < 2000:
    dic[4] = 1
  elif A[i] < 2400:
    dic[5] = 1
  elif A[i] < 2800:
    dic[6] = 1
  elif A[i] < 3200:
    dic[7] = 1
  else:
    dic[8] = 1
    cnt += 1
if cnt > 0:
  if len(dic) == 1:
    print(1,cnt)
  else:
    print(len(dic) - 1,len(dic) + cnt - 1)
else:
  print(len(dic),len(dic))

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

over_count = 0
gray = 0
brawn = 0
green = 0
lightblue = 0
blue = 0
yellow = 0
orange = 0
red = 0

for a in As:
  if 1 <= a <= 399:
    gray = 1
  elif 400 <= a <= 799:
    brawn = 1
  elif 800 <= a <= 1199:
    green = 1
  elif 1200 <= a <= 1599:
    lightblue = 1
  elif 1600 <= a <= 1999:
    blue = 1
  elif 2000 <= a <= 2399:
    yellow = 1
  elif 2400 <= a <= 2799:
    orange = 1
  elif 2800 <= a <= 3199:
    red = 1
  elif 3200 <= a <= 4800:
    over_count += 1
    
min_count = gray + brawn + green + lightblue + blue + yellow + orange + red
max_count = min_count + over_count

if min_count == 0 and over_count >= 1:
  min_count = 1

print("{} {}".format(min_count, max_count))

Solution (Python):
def rank(n):
    n = int(n)
    if n < 400:
        return 'a'
    if n < 800:
        return 'b'
    if n < 1200:
        return 'c'
    if n < 1600:
        return 'd'
    if n < 2000:
        return 'e'
    if n < 2400:
        return 'f'
    if n < 2800:
        return 'g'
    if n < 3200:
        return 'h'
    else:
        return 'x'


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

normal = [i for i in a if i != 'x']
ans_max = len(set(normal)) + a.count('x')
if len(normal) == 0:
    ans_min = 1
else:
    ans_min = len(set(normal))
print(ans_min, ans_max)

Solution (Python):
clst = [0, 0, 0, 0, 0, 0, 0, 0, 0]

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

for i in a:
    if i <= 399:
        clst[0] += 1
    elif i <= 799:
        clst[1] += 1
    elif i <= 1199:
        clst[2] += 1
    elif i <= 1599:
        clst[3] += 1
    elif i <= 1999:
        clst[4] += 1
    elif i <= 2399:
        clst[5] += 1
    elif i <= 2799:
        clst[6] += 1
    elif i <= 3199:
        clst[7] += 1
    else:
        clst[8] += 1
minans = 0
maxans = 0

for i in range(9):
    if 0 < clst[i] and i != 8:
        minans += 1
    if i == 8 and minans == 0:
        minans += 1
maxans = minans + clst[8]

if sum(clst[:8]) == 0:
    maxans -= 1

print(minans, maxans)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
li = [0]*15
tourist = 0

for i in a:
    if i // 400 >= 8:
        tourist += 1

    if li[i//400] == 0:
        li[i//400] = 1

maxrate = sum(li[:8]) + tourist

minrate = 0

if sum(li[:8]) == 0:
    minrate = 1
else:
    minrate = sum(li[:8])

print(minrate, maxrate)

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

ans = 0
free = 0
tmp = a[0] // 400
for i in a:
    if i >= 3200:
        free += 1
    elif i >= 400 * tmp:
        tmp = i//400 + 1
        ans += 1
if ans > 0:
    print(ans, ans+free)
else:
    print(1, ans+free)

Solution (Python):

N = int(input())
a = list(map(int, input().split()))
DP = [0]*8
tmp = 0

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

ans1 = sum(DP)

if ans1 == 0:
    ans1 = 1 
else:
    pass

ans2 = sum(DP)+tmp
print(ans1,ans2)

Solution (Python):
def color(x):
  if(1 <= x and x <= 399):
    return "灰色"
  if(400 <= x and x <= 799):
    return "茶色"
  if(800 <= x and x <= 1199):
    return "緑色"
  if(1200 <= x and x <= 1599):
    return "水色"
  if(1600 <= x and x <= 1999):
    return "青色"
  if(2000 <= x and x <= 2399):
    return "黄色"
  if(2400 <= x and x <= 2799):
    return "橙色" 
  if(2800 <= x and x <= 3199):
    return "赤色"
  if(3200 <= x):
    return "free"

from collections import defaultdict
d = defaultdict(int)
n = int(input())
a = list(map(int, input().split()))
free = 0
for score in a:
  if color(score) == "free":
    free +=1
  else:
    d[color(score)] += 1
print(len(d) if len(d) != 0 else 1, len(d) + free)

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

colors = [0]*8
higher = 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:
        higher +=1
print(max(1,sum(colors)),sum(colors)+higher)

Solution (Python):
participant = int(input())
rate = list(map(int, input().split()))
ratecolorCheck = [0] *8
maxColor, minColor = 0, 0
for i in range(participant):
  if 1 <= rate[i] and rate[i] <= 399:
    ratecolorCheck[0] = 1
  elif 400 <= rate[i] and rate[i] <= 799:
    ratecolorCheck[1] = 1
  elif 800 <= rate[i] and rate[i] <= 1199:
    ratecolorCheck[2] = 1
  elif 1200 <= rate[i] and rate[i] <= 1599:
    ratecolorCheck[3] = 1
  elif 1600 <= rate[i] and rate[i] <= 1999:
    ratecolorCheck[4] = 1
  elif 2000 <= rate[i] and rate[i] <= 2399:
    ratecolorCheck[5] = 1
  elif 2400 <= rate[i] and rate[i] <= 2799:
    ratecolorCheck[6] = 1
  elif 2800 <= rate[i] and rate[i] <= 3199:
    ratecolorCheck[7] = 1
  else:
    maxColor += 1
for i in range(8):
  if ratecolorCheck[i] == 1:
    minColor += 1
    maxColor += 1
if minColor == 0:
  minColor = 1
print(str(minColor) + " " + str(maxColor))

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

for i in a:
    color[min(i, 3200) // 400] += 1

x = 8 - color[:-1].count(0)
ans = [max(1, x), x + color[8]]
print(' '.join(map(str, ans)))

Solution (Python):
N=input()
N=int(N)
a=input()
a=a.split()
score=[0]*8
legend=0
inrank=0
a=[int(item) for item in a]
for i in range(0,N):
    p=int(a[i]/400)
    if p >= 8:
        legend+=1
    else:
        score[p]=1
inrank=score.count(1)
if legend!=0:
    if inrank==0:
        t_max=legend
        t_min=1
    else:
        t_max=inrank+legend
        t_min=inrank
else:
    t_max=inrank
    t_min=inrank
print(str(t_min)+" "+str(t_max))

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

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

cnt = 0
for i in range(8):
    if d[i]:
        cnt += 1

if cnt == 0:
    print(1, N)
else:
    print(cnt, cnt+d[8])

Solution (Python):
def main():
    n=int(input())
    a=list(map(int,input().split(' ')))
    color = [0]*8
    ans_max = 0
    for i in a:
        if 1<= i <= 399:
            color[0] = 1
        elif i <= 799:
            color[1]=1
        elif i <= 1199:
            color[2] = 1
        elif i <= 1599:
            color[3] = 1
        elif i <= 1999:
            color[4] = 1
        elif i <= 2399:
            color[5] = 1
        elif i <= 2799:
            color[6] = 1
        elif i <= 3199:
            color[7] = 1
        else:
            ans_max += 1
    print(max(1,sum(color)),ans_max+sum(color))
if __name__ == '__main__':
    main()

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

score_list = [400, 800, 1200, 1600, 2000, 2400, 2800, 3200]
counter = [0] * 9
for i in range(len(a)):
    if a[i] >= 3200:
        counter[8] += 1
    for j in range(8):
        if a[i] < score_list[j]:
            counter[j] += 1
            break
ans_min = 0
for i in range(len(counter) - 1):
    if counter[i] != 0:
        ans_min += 1
if counter[8] >= 1:
    ans_max = ans_min + counter[8]
    if ans_min == 0:
        ans_min += 1
else:
    ans_max = ans_min
print(ans_min, ans_max)

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
color = [0,0,0,0,0,0,0,0,0]
cmin = 0
cmax = 0

for i in range(n) :
    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
    elif a[i] < 3200 :
        color[7] += 1
    else :
        color[8] += 1
        
for i in range(8) :
    if color[i] > 0 :
        cmin  += 1

if cmin == 0 :
    cmin = 1
    cmax = color[8]
else :
    cmax = cmin + color[8]

print (cmin, cmax)

Solution (Python):
n = int(input());l = [0]*9
for i in map(int, input().split()):l[min(8,i//400)]+=1
mn = len(list(filter(lambda x:x>0, l[:8])))
print(max(1, mn), mn+l[8])

Solution (Python):
import collections

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

for i in range(N):
    sort[i] = sort[i] // 400

normal = [i for i in sort if i < 8]
incredible = [i for i in sort if i >= 8]

min = len(collections.Counter(normal))
max = len(collections.Counter(normal)) + len(incredible)

min = 1 if min < 1 else min


print(min, max)