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

colors = [0 for _ in range(8)]
over = 0

for a in A:
    if 1 <= a < 400:
        colors[0] = 1
    if 400 <= a < 800:
        colors[1] = 1
    if 800 <= a < 1200:
        colors[2] = 1
    if 1200 <= a < 1600:
        colors[3] = 1
    if 1600 <= a < 2000:
        colors[4] = 1
    if 2000 <= a < 2400:
        colors[5] = 1
    if 2400 <= a < 2800:
        colors[6] = 1
    if 2800 <= a < 3200:
        colors[7] = 1
    if 3200 <= a:
        over += 1

c = colors.count(1)

maxi = c + over

if c == 0:
    mini = 1
else:
    mini = c

print(mini, maxi)

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

colors = [0 for _ in range(8)]
over = 0

for a in A:
    if 1 <= a < 400:
        colors[0] = 1
    if 400 <= a < 800:
        colors[1] = 1
    if 800 <= a < 1200:
        colors[2] = 1
    if 1200 <= a < 1600:
        colors[3] = 1
    if 1600 <= a < 2000:
        colors[4] = 1
    if 2000 <= a < 2400:
        colors[5] = 1
    if 2400 <= a < 2800:
        colors[6] = 1
    if 2800 <= a < 3200:
        colors[7] = 1
    if 3200 <= a:
        over += 1

c = colors.count(1)

if over == 0:
    maxi = c
else:
    maxi = c + over

if c == 0:
    mini = 1
else:
    mini = c

print(mini, maxi)

Solution (Python):

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


class ColorRank():
    def __init__(self, color, low, high):
        self.color = color
        self.low = low
        self.high = high
        self.cnt = 0

rate_list = [ ColorRank( "hai", 1, 399 )
             ,ColorRank( "cha", 400, 799 )
             ,ColorRank( "midori", 800, 1199 )
             ,ColorRank( "mizu", 1200, 1599 )
             ,ColorRank( "ao", 1600, 1999 )
             ,ColorRank( "ki", 2000, 2399 )
             ,ColorRank( "daidai", 2400, 2799 )
             ,ColorRank( "aka", 2800, 3199 )
             ,ColorRank( "top", 3200, 4800 )
             ]


for an in An_list:
    for i,rate in enumerate( rate_list ):
        if rate.low <= an <= rate.high:
            rate_list[i].cnt += 1
            break

rateN = len([ color_rank for color_rank in rate_list if color_rank.cnt > 0 and color_rank.color != "top" ])
N_min = 1 if rateN == 0 and rate_list[8].cnt > 0 else 0
N_max = rate_list[8].cnt if rate_list[8].cnt > 0 else 0
rateN_min = rateN + N_min
rateN_max = rateN + N_max
print( ' '.join( [ str(rateN_min), str(rateN_max) ] ) )

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

maximum = 0
minimum = 0
used = [0]*9
for i in A:
    i //= 400
    if i >= 8:
        maximum += 1
    elif used[i] == 0:
        maximum += 1
        minimum += 1
        used[i] = 1
if minimum == 0:
    minimum += 1
print(minimum, maximum)

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

color = [0] * 8
cnt = 0
for val in a:
    for i in range(8):
        if 400 * i <= val < 400 * (i + 1):
            color[i] = 1
    if val >= 3200:
            cnt += 1

if all([c == 0 for c in color]):
    s = 1
else:
    s = sum(color)
l = sum(color) + cnt

print(s, l)

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

def main():
    scores = [i*400 for i in range(1, 8)]
    scores.reverse()

    scores_d = {}
    input()
    god = []
    for a in map(int,input().split()):
        if a >= 3200:
            god.append(a)
            continue
        for i in scores:
            if a >= i:
                scores_d[i] = 1
                break
        if a < 400:
            scores_d[0] = 1

    counts = sum(scores_d.values())
    print(counts if counts > 0 else 1, counts + len(god))

main()

Solution (Python):
N=int(input())
A=list(map(int,input().split()))
C=[]
cnt=0
for i in A:
  if 1<=i<=399:
    C.append('a')
  elif 400<=i<=799:
    C.append('b')
  elif 800<=i<=1199:
    C.append('c')
  elif 1200<=i<=1599:
    C.append('d')
  elif 1600<=i<=1999:
    C.append('e')
  elif 2000<=i<=2399:
    C.append('f')
  elif 2400<=i<=2799:
    C.append('g')
  elif 2800<=i<=3199:
    C.append('h')
  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()))


ans = 0

a.sort()
wk_r = -1
a_max = 0
cnt = 0
for i in range(n):
    if a[i] >= 3200:
        a_max = cnt + (n - i)
        break
    
    rank = a[i] // 400
    if wk_r != rank:
        cnt = cnt + 1
        wk_r = rank

a_min = max(1, cnt)
if a[n-1] < 3200:
    a_max = cnt


print(a_min, a_max)

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

l = [0 for i in range(9)]
for a in A:
  ind = 0
  while ind < 8:
    if a < (ind+1)*400:
      break
    ind += 1
  l[ind] += 1

ans_max = 0
ans_min = 0
for i in range(0, 8):
  if l[i] > 0:
    ans_max += 1
    ans_min += 1
if l[-1] > 0:
  ans_max = ans_max + l[-1]
  ans_min = max(ans_min, 1)
print(ans_min, ans_max)

Solution (Python):
N = int(input())
lst = [0] * 9

for x in [int(x) for x in input().split()]:
    if x <= 399:
        lst[0] = 1
    elif x <= 799:
        lst[1] = 1
    elif x <= 1199:
        lst[2] = 1
    elif x <= 1599:
        lst[3] = 1
    elif x <= 1999:
        lst[4] = 1
    elif x <= 2399:
        lst[5] = 1
    elif x <= 2799:
        lst[6] = 1
    elif x <= 3199:
        lst[7] = 1
    else:
        lst[8] += 1

a = sum(lst[:-1])
b = lst[8]
if a == 0 and b > 0:
    print("1 {0}".format(b))
else:
    print("{0} {1}".format(a, a + b))

Solution (Python):

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
n = int(input())
a = list(map(int,input().split()))
color = [0]*8
over_3200 = 0
for i in range(n):
    if a[i] < 3200:
        color[a[i] // 400] = 1
    else: over_3200 += 1
if sum(color) == 0:
    print(1,over_3200)
else:
    print(sum(color),sum(color)+over_3200)

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

count = 0
colors = [0]*8
cList = list(map(int,input().split()))

for i in cList:
  if i >= 3200:
    count += 1
  else:
    colors[(i//400)] = 1

if sum(colors) != 0: 
  print(sum(colors),sum(colors)+count)
else:
  print(1,sum(colors)+count)

Solution (Python):

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

colors = { "gray": 0, "brown": 0, "green": 0, "water": 0, "blue": 0, "yellow": 0, "orange": 0, "red": 0 }

other = 0

for a in A:
  if 1 <= a <= 399:
    colors["gray"] += 1
  elif 400 <= a <= 799:
    colors["brown"] += 1
  elif 800 <= a <= 1199:
    colors["green"] += 1
  elif 1200 <= a <= 1599:
    colors["water"] += 1
  elif 1600 <= a <= 1999:
    colors["blue"] += 1
  elif 2000 <= a <= 2399:
    colors["yellow"] += 1
  elif 2400 <= a <= 2799:
    colors["orange"] += 1
  elif 2800 <= a <= 3199:
    colors["red"] += 1
  else:
    other += 1

num = len(list(filter(lambda x: x > 0, colors.values())))

if num == 0:
  print(1, other)
else:
  print(num, num + other)

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
color = [0 for i in range(9)]
a.sort()
for i in a:
    number = i//400
    if number >=8:
        color[8] += 1
    else:
        color[number] += 1
left = 8 - color[:8].count(0) 
right = color[8]              
if left == 0:
    print('{} {}'.format(1,right))
else:
    sum_color = left + right
    print('{} {}'.format(left,sum_color))

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

s = 0
for i in range(8):
    if rank[i] > 0:
        s += 1
if s > 0:
    s1 = s
else:
    s1 = 1
s2 = s + rank[8]
print(s1, s2)

Solution (Python):
n=int(input())
A=list(map(int,input().split()))
B=[0,0,0,0,0,0,0,0]
red=int(0)
for i in range(n):
    now=int(A[i]/400)
    if now<8:
        B[now]=1
    else:
        red+=1

ans=B.count(1)
if ans==0:
    ans=1
    red-=1
print("{} {}".format(ans,ans+red))

Solution (Python):
if __name__ == '__main__':

	
	N = int(input())
	score_lst = [int(a) for a in input().split()]
	grade_lst = []
	for i in score_lst:
		grade = int(i / 400)
		if grade > 7:
			grade = 8
		grade_lst.append(grade)

	count = 0

	for i in range(0,8):
		if grade_lst.count(i) > 0:
			count += 1

	if count != 0:
		min_count = count
	else:
		min_count = 1
	max_count = count + grade_lst.count(8)

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

Solution (Python):
import sys
import numpy as np


n = int(input())


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


people = np.zeros(8)

free = 0

for r in rate:
    
    if r < 400:
        people[0] += 1
    elif r < 800:
        people[1] += 1
    elif r < 1200:
        people[2] += 1
    elif r < 1600:
        people[3] += 1
    elif r < 2000:
        people[4] += 1
    elif r < 2400:
        people[5] += 1
    elif r < 2800:
        people[6] += 1
    elif r < 3200:
        people[7] += 1
    else:
        free += 1

if people[people > 0].size > 0:
    
    min_color = people[people > 0].size
    
    max_col = min_color + free
else:
    
    min_color = 1
    
    max_col = free

print(min_color, max_col)

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

Solution (Python):
N = int(input())
a = [min(int(i) // 400, 8) for i in input().split()]

n, c = 0, 0
ranks = set()
for a_i in a:
    if a_i == 8:
        n += 1
    else:
        ranks.add(a_i)

min_v = len(ranks)
max_v = len(ranks)
if n > 0:
    min_v = max(1, len(ranks))
    max_v = max_v + n

print(min_v, max_v)

Solution (Python):
from collections import Counter
input()
A = list(map(int, input().split()))
C = Counter([sum(a >= r for r in [400,800,1200,1600,2000,2400,2800,3200]) for a in A])
c8 = C[8] if 8 in C else 0
a1 = len(C) - (1 if c8 else 0)
a2 = a1+c8
if a1 == 0:
    a1 += 1
print(a1, a2)

Solution (Python):
import sys

input = sys.stdin.readline


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

    color = [0] * 9
    ans = 0
    for a in A:
        if a >= 3200:
            color[8] += 1
        else:
            color[a // 400] += 1

    mi = 0
    for c in color[:8]:
        if c > 0:
            mi += 1
    if mi == 0:
        print(1, color[8])
    else:
        print(mi, mi + color[8])



    

if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
cnt = []
cnt_r = 0
for i in range(n):
    for j in range(1, 9):
        if a[i] < 400*j:
            if j not in cnt:
                cnt.append(j)
            break
    else:
        cnt_r += 1
if len(cnt) == 0:
    print(1, cnt_r)
else:
    print(len(cnt), len(cnt)+cnt_r)

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

c = [0] * 9

for rate in a:
    i = rate // 400
    if i < 8:
        c[i] = 1
    else:
        c[8] += 1

c_sum = sum(c[:8])
c_min = max(c_sum, min(c[8],1))
c_max = c_sum + c[8]

print(c_min, c_max)

Solution (Python):
import sys
n = int(input())
l = [int(i)//400 if int(i)//400 <= 7 else 8 for i in input().split()]
multi = l.count(8)
if multi == 0:
    num_cols = len(set(l))
    print(num_cols, num_cols)
    sys.exit()
    
num_cols = len(set(l)) - 1
min_cols = max(1,num_cols)
max_cols = num_cols+multi
print(min_cols, max_cols)

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

c = [0] * 9

for rate in a:
    i = rate // 400
    if i < 8:
        c[i] = 1
    else:
        c[8] += 1

c_sum = sum(c[:8])
c_min = max(c_sum, 1)
c_max = c_sum + c[8]

print(c_min, c_max)

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

c = [0] * 9

for rate in a:
    i = rate // 400
    if i < 8:
        c[i] = 1
    else:
        c[8] += 1

c_sum = sum(c[:8])
c_min = max(c_sum, 1)
c_max = c_sum + c[8]

print(c_min, c_max)

Solution (Python):
def main():
    n = int(input())
    A = list(map(int,input().split()))
    m = {}
    for x in A:
        i = min(3200 // 400,x // 400)
        m[i] = m.get(i,0) + 1
    mi = 0
    ma = 0
    for x in range(3200 // 400):
        if m.get(x,0) > 0:
            mi = mi + 1
    if mi == 0:
        mi = 1
        ma = -1
    ma += mi
    ma += m.get(3200 // 400,0)

    print("{} {}".format(mi,ma))
if __name__ == '__main__':
    main()

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

c = sum([1 for i in r[:-1] if i != 0])
t = r[-1]

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

Solution (Python):

 
import math
import itertools
import sys
import copy
 






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

C = [0 for _ in range(9)]

for i in range(N) :
  if a[i] < 3200 :
    C[a[i]//400] += 1
  else :
    C[8] += 1

minN = 0
maxN = 0
for j in range(8) :
  if C[j] > 0 :
    minN += 1
  

maxN = minN + C[8]

if minN == 0 :
  minN = 1
  
print (str(minN) + " " + str(maxN))

Solution (Python):
import sys
import bisect
n = int(input())
a_ls = [int(i) for i in sys.stdin.readline().split()]
ls = [i * 400 - 1 for i in range(1, 9)]
_set = set()
n_max = 0
for a in a_ls:
    ind = bisect.bisect_left(ls ,a)
    if ind == 8:
        n_max += 1
    else:
        _set.add(ind)
_min = max(len(_set), 1)
print(_min, len(_set) + n_max)

Solution (Python):
import sys
import bisect
n = int(input())
a_ls = [int(i) for i in sys.stdin.readline().split()]
ls = [i * 400 - 1 for i in range(1, 9)]
_set = set()
n_max = 0
for a in a_ls:
    ind = bisect.bisect_left(ls ,a)
    if ind == 8:
        n_max += 1
    else:
        _set.add(ind)
_min = len(_set) if len(_set) > 0 else len(_set) + (n_max > 0)
print(_min, len(_set) + n_max)

Solution (Python):
n = int(input())
a = [int(int(x)/400) for x in input().split()]
b = [x if x <= 7 else 8 for x in a]

ans = len(set(b))
if (8 in b):
   ans -= 1
   ans2 = b.count(8) + ans
   if (ans == 0):
      print(1, ans2)
   else:
      print(ans, ans2)
else:
   print(ans, ans)

Solution (Python):
color_list = [0]*9

x = input()

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

for i in score_lists:
    if i < 400:
        color_list[0] = 1
    elif i < 800:
        color_list[1] = 1
    elif i < 1200:
        color_list[2] = 1
    elif i < 1600:
        color_list[3] = 1
    elif i < 2000:
        color_list[4] = 1
    elif i < 2400:
        color_list[5] = 1
    elif i < 2800:
        color_list[6] = 1
    elif i < 3200:
        color_list[7] = 1
    else:
        color_list[8] = color_list[8] + 1

ans_min = color_list[0] + color_list[1] + color_list[2] + color_list[3] + color_list[4]\
     + color_list[5] + color_list[6] + color_list[7]

if ans_min == 0 and color_list[8] != 0:
    ans_min = 1

ans_max = color_list[0] + color_list[1] + color_list[2] + color_list[3] + color_list[4]\
     + color_list[5] + color_list[6] + color_list[7] + color_list[8]

print(ans_min, ans_max)

Solution (Python):

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

color = set()
mx = 0

for i in a:
    if 1 <= i <= 399:
        color.add('a')
    elif 400 <= i <= 799:
        color.add('b')
    elif 800 <= i <= 1199:
        color.add('c')
    elif 1200 <= i <= 1599:
        color.add('d')
    elif 1600 <= i <= 1999:
        color.add('e')
    elif 2000 <= i <= 2399:
        color.add('f')
    elif 2400 <= i <= 2799:
        color.add('g')
    elif 2800 <= i <= 3199:
        color.add('h')
    elif 3200 <= i:
        mx += 1

if len(color) == 0 and mx == 1:
    print(1, 1)
    exit()
if len(color) == 0 and mx >= 1:
    print(1, mx)
    exit()
if len(color):
    cn = len(color)

cx = cn + mx

print(cn, cx)

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

Solution (Python):
import sys
input = sys.stdin.readline
N = int(input())
a = [int(i) for i in input().split()]
li = [False] * 8
count_over = 0
for i in range(N) :
    if 1 <= a[i] <= 399 :
        if li[0] == False :
            li[0] = True
    if 400 <= a[i] <= 799 :
        if li[1] == False :
            li[1] = True
    if 800 <= a[i] <= 1199 :
        if li[2] == False :
            li[2] = True
    if 1200 <= a[i] <= 1599 :
        if li[3] == False :
            li[3] = True
    if 1600 <= a[i] <= 1999 :
        if li[4] == False :
            li[4] = True
    if 2000 <= a[i] <= 2399 :
        if li[5] == False :
            li[5] = True
    if 2400 <= a[i] <= 2799 :
        if li[6] == False :
            li[6] = True
    if 2800 <= a[i] <= 3199 :
        if li[7] == False :
            li[7] = True
    if 3200 <= a[i] :
        count_over += 1
sum = 0
for i in range(8) :
    if li[i] :
        sum+=1
maxx = sum+count_over
minn = 0
if sum == 0 :
    minn = 1
else :
    minn = sum
print(minn,maxx)

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

if sum(colors[0:8]) == 0 and colors[8] >= 1:
    MIN = 1
else:
    MIN = sum(colors[0:8])
MAX = sum(colors)

print(MIN, MAX)

Solution (Python):
from collections import defaultdict
N = int(input())
rates = [int(i) for i in input().split()]



color_nums = defaultdict(int)

for rate in rates:
    if rate <= 399:
        color_nums['灰'] += 1
    elif rate <= 799:
        color_nums['茶'] += 1
    elif rate <= 1199:
        color_nums['緑'] += 1
    elif rate <= 1599:
        color_nums['水'] += 1
    elif rate <= 1999:
        color_nums['青'] += 1
    elif rate <= 2399:
        color_nums['黄'] += 1
    elif rate <= 2799:
        color_nums['橙'] += 1
    elif rate <= 3199:
        color_nums['赤'] += 1
    else:
        color_nums['自由'] += 1

free_num = color_nums['自由']
if free_num == 0:
    
    
    print(len(color_nums)-1, len(color_nums)-1)
elif free_num == N:
    
    print(1, free_num)
elif free_num != N:
    
    tmp = dict(color_nums)  
    tmp.pop('自由')
    l_tmp = len(tmp)
    min_num = l_tmp
    max_num = l_tmp + free_num
    print(min_num, max_num)

Solution (Python):
n = int(input())
a = [int(i)//400 for i in input().split() if int(i)<3200]
x = len(set(a)) 
y = n-len(a) 

if x == 0:
    print(1,y)
else:
    print(x,x+y)

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

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

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect
from heapq import heappush, heappop

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
a = LIST()

dic = defaultdict(int)

for x in a:
    if 1 <= x <= 399:
        dic["灰"] += 1
    if 400 <= x <= 799:
        dic["茶"] += 1
    if 800 <= x <= 1199:
        dic["緑"] += 1
    if 1200 <= x <= 1599:
        dic["水"] += 1
    if 1600 <= x <= 1999:
        dic["青"] += 1
    if 2000 <= x <= 2399:
        dic["黃"] += 1
    if 2400 <= x <= 2799:
        dic["橙"] += 1
    if 2800 <= x <= 3199:
        dic["赤"] += 1
    if 3200 <= x:
        dic["強い"] += 1
kind = len(dic.keys())
if kind == 1 and bool(dic["強い"]):
    print(1, dic["強い"])
else:
    print(kind - bool(dic["強い"]), kind - bool(dic["強い"]) + dic["強い"])

Solution (Python):
r = list()
r.append((1, 399))
r.append((400, 799))
r.append((800, 1199))
r.append((1200, 1599))
r.append((1600, 1999))
r.append((2000, 2399))
r.append((2400, 2799))
r.append((2800, 3199))

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

count = [0 for i in range(0, len(r) + 1)]
for ai in a:
    add = False
    for i in range(0, len(r)):
        if r[i][0] <= ai <= r[i][1]:
            count[i] += 1
            add = True
    if not add:
        count[len(count) - 1] += 1

ans_min = 0
for c in range(0, len(count) - 1):
    if count[c] > 0:
        ans_min += 1

if ans_min > 0:
    ans_max = ans_min + count[len(count) - 1]
elif count[len(count) - 1] > 0:
    ans_min = 1
    ans_max = count[len(count) - 1]
else:
    ans_max = 0

print("%d %d" % (ans_min, ans_max))

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

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

n=int(input())
a=list(map(int,input().split()))
b={}
cnt=0
for i in a:
    if i<3200:
        b[i//400]=1
    else:
        cnt+=1
if sum(b.values())==0:
    print(1,cnt)
    exit()
print(sum(b.values()),sum(b.values())+cnt)

Solution (Python):


import numpy as np
import fractions as fra


input()
s=set()
c=0
for y in input().split():
    x=int(y)//400
    if(x>=8):
        c+=1
    else:
        s.add(x)


ls=len(s)
print(max(1,ls),end=" ")
print(ls+c)

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

scr = [400,800,1200,1600,2000,2400,2800,3200,5000]
li = [0,0,0,0,0,0,0,0,0]

for i in range(n):
    for j in range(len(scr)):
        if a[i] < scr[j]:
            li[j] += 1
            break

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

if li[8]:
    ans_M = min(ans+li[8],10**9)
    ans_m = max(ans,1)
else:
    ans_M = ans
    ans_m = ans

print(ans_m,ans_M)

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
A = [e//400 for e in A]
from collections import Counter
D = Counter(A)
ans = 0
add = 0
for key,value in D.items():
    if key >= 8:
        add += value
    else:
        if value > 0:
            ans += 1
print(max(ans,1),ans+add)

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
division = {str(i):0 for i in range(9)}
for i in a:
    x = i // 400
    if x > 8:
        x = 8
    division[str(x)] += 1
ans = 0
check = 1
for i in range(8):
    if division[str(i)] != 0:
        ans += 1
        check = 0
min_ans = ans + check
max_ans = ans + division['8']
print(min_ans,max_ans)

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
r=set()
free=0
for x in a:
    y=x//400
    if y>=8:
        free+=1
        y=8
    r.add(y)
len_r=len(r)
if len_r==1 and free>0:
    print(1,free)
elif len_r>1 and free>0:
    print(len_r-1,len_r-1+free)
else:
    print(len_r,len_r)

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

Solution (Python):


N=int(input())
A=list(map(int,input().split()))
C=[0]*8
num_god=0
for a in A:
    if a//400<8:
        C[a//400]+=1
    else:
        num_god+=1
ans=0
for a in C:
    if a!=0:
        ans+=1
cnt=0
for a in C:
    if a==0:
        cnt+=1
if cnt==8:
    Min=1
else:
    Min=ans
Max=ans+num_god
print(Min,Max)

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
b={}
f=0
for i in range(n):
    if a[i]<3200:
        b[a[i]//400]=a[i]
    else:
        f+=1
print(max(len(b),1),len(b)+f)

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


over = 0
under = [False]*8 
for a in A:
  if a < 3200:
    under[a//400] = True
  else:
    over += 1

min_ = max(sum(under), 1)
max_ = sum(under)+over

print(min_, max_)

Solution (Python):
x=[0]*9
n=int(input())
a=[int(i) for i in input().split()]
for i in range(n):
    for j in range(8):
        if a[i]<400*(j+1):
            x[j]=1
            break
    else:
        x[8]+=1

if x[:-1].count(1)!=0:
    print(x[:-1].count(1),end=" ")
else:
    print(1,end=" ")
print(x[:-1].count(1)+x[-1])

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

ans = [False] * 8
tmp = 0
for i in a:
    if i > 3199:
        tmp += 1
    else:
        ans[i // 400] = True
print(max(sum(ans),1), sum(ans) + tmp)

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

ans = [0] * 9

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

cnt = 0

for j in range(8):
	if ans[j] != 0:
		cnt += 1
		
print(max(cnt, 1), cnt + ans[8])

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

rate = []
anycol = 0
for i in As : 
  if i >= 3200 : 
    anycol += 1 
  else : 
     rate.append( i // 400 )
 
count = len( set(rate) )
 
print( max(count, 1), count+anycol )

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(a//400)
        
cnt=len(set(rate))
print(max(1,cnt),cnt+red)

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

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

for i in range(N):
    if a[i] <= 399:
        color[0] = 1
    elif a[i] <= 799:
        color[1] = 1
    elif a[i] <= 1199:
        color[2] = 1
    elif a[i] <= 1599:
        color[3] = 1
    elif a[i] <= 1999:
        color[4] = 1
    elif a[i] <= 2399:
        color[5] = 1
    elif a[i] <= 2799:
        color[6] = 1
    elif a[i] <= 3199:
        color[7] = 1
    else:
        rainbow += 1
        
ans = 0
for i in range(len(color)):
    if color[i] == 1:
        ans += 1

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

Solution (Python):
N=int(input())
a=list(map(int,input().split()))
res=set()
free=0
for i in range(len(a)):
  if a[i]<400:
    res.add("gray")
  elif a[i]<800:
    res.add("brown")
  elif a[i]<1200:
    res.add("green")
  elif a[i]<1600:
    res.add("water")
  elif a[i]<2000:
    res.add("blue")
  elif a[i]<2400:
    res.add("yellow")
  elif a[i]<2800:
    res.add("orange")
  elif a[i]<3200:
    res.add("red")
  else:
    free+=1

col=len(res)
print(col if col>0 else 1,col+free)

Solution (Python):
N=int(input())
a=list(map(int, input().split()))
c=[0]*9
for i in range(N):
  c[min(a[i]//400, 8)]+=1
  
temp=[1 for i in range(8) if c[i]>0]
x=len(temp)
y=x+c[8]
 
print(max(x, 1), y)

Solution (Python):


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

rate_count_list = [0] * 8   
count_over_red = 0          

for a in a_list:

    
    
    if a >= 3200:
        count_over_red += 1

    
    else:
        for i in range(8):
            if i == 0:
                min_in_rate = 1
            else:
                min_in_rate = 400 * i

            max_in_rate = 400 * (i + 1)

            if min_in_rate <= a < max_in_rate:
                rate_count_list[i] = 1
                break

ans_min = sum(rate_count_list)

ans_max = ans_min + count_over_red

print(str(max(ans_min, 1)) + ' ' + str(ans_max))

Solution (Python):


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

rate_count_list = [0] * 8   
count_over_red = 0          

for a in a_list:

    
    
    if a >= 3200:
        count_over_red += 1

    
    else:
        for i in range(8):
            if i == 0:
                min_in_rate = 1
            else:
                min_in_rate = 400 * i

            max_in_rate = 400 * (i + 1)

            if min_in_rate <= a < max_in_rate:
                rate_count_list[i] = 1
                break

ans_min = sum(rate_count_list)

ans_max = ans_min + count_over_red

print(str(max(ans_min, 1)) + ' ' + str(ans_max))