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=[int(i) for i in input().split()]
CL=[0]*9
for a in A:
  cl=min(8,a//400)
  if cl==8:
    CL[cl]+=1
  elif CL[cl]==0:
    CL[cl]=1
if sum(CL[:-1])==0:
  print(1,CL[-1])  
else:
  print(sum(CL[:-1]),sum(CL))

Solution (Python):
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    n = f()[0]
    a = f()

    b = [0] * 9
    for i in range(n):
        if a[i]<=399:
            b[0] += 1
        elif a[i]<=799:
            b[1] += 1
        elif a[i]<=1199:
            b[2] += 1
        elif a[i]<=1599:
            b[3] += 1
        elif a[i]<=1999:
            b[4] += 1
        elif a[i]<=2399:
            b[5] += 1
        elif a[i]<=2799:
            b[6] += 1
        elif a[i]<=3199:
            b[7] += 1
        else:
            b[8] += 1
    
    cnt = 0
    for i in range(8):
        if b[i] >0:
            cnt+=1

    minc = cnt if cnt>0 else 1

    maxc = cnt + b[8]
    print(minc, maxc)

solve()

Solution (Python):
N = int(input())
a = map(int,input().split())
color = [0,0,0,0,0,0,0,0,0]
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
category = 0
for i in range(8):
    if color[i] != 0:
        category += 1
if category == 0:
    print(1,color[8])
else:
    print(category,category + color[8])

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

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



ans = 0
for i in color:
    if i > 0:
        ans += 1

if ans == 0:
    ans1 = 1
else:
    ans1 = ans
ans2 = ans + free

print(ans1, ans2)

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

s = 1
s = 399
ct = [0 for i in range(8)]
wild = 0

for i in a:
    idx = 0
    if i >= 3200:
        wild += 1
    else:
        for j in range(400, 3201, 400):
            if i < j:
                ct[idx] = 1
                break
            idx += 1

Min = max(1, sum(ct))
Max = wild + sum(ct)

print(Min, Max)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
topcoder = 0
colors = []
for i in a:
    if i > 3199:
        topcoder += 1
    else:
        colors.append(i//400)
minimum = 1 if len(colors) == 0 else len(list(set(colors)))
maximum = len(list(set(colors)))+topcoder
print('{} {}'.format(minimum,maximum))

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

Solution (Python):
from collections import defaultdict

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

counter = defaultdict(int)
for ai in a:
    counter[min(ai // 400, 8)] += 1
ans = 0
for i in range(8):
    if counter[i] > 0:
        ans += 1
if ans == 0:
    print(1, counter[8])
else:
    print(ans, ans + counter[8])

Solution (Python):
n = int(input())
a = [int(i) for i in input().split()]
c = {n:0 for n in range(0, 9)}
for a_ in a:
    a__ = a_ // 400
    if a__ <= 7:
        c[a__] += 1
    else:
        c[8] += 1
count = 0
for k, v in c.items():
    if k <= 7:
        if v > 0:
            count += 1
    elif k == 8:
        cc = v + count
if count == 0:
    count = 1
ans = str(count) + " " + str(cc)
print(ans)

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

rate = {}

def color_check(n):
    if 1 <= n <= 399:
        return 'gray'
    elif 400 <= n <= 799:
        return 'brown'
    elif 800 <= n <= 1199:
        return 'green'
    elif 1200 <= n <= 1599:
        return 'lightblue'
    elif 1600 <= n <= 1999:
        return 'blue'
    elif 2000 <= n <= 2399:
        return 'yellow'
    elif 2400 <= n <= 2799:
        return 'orange'
    elif 2800 <= n <= 3199:
        return 'red'
    elif 3200 <= n:
        return 'top'

for n in a:
    col = color_check(n)
    rate.setdefault(col, 0)
    rate[col] += 1

colors = len(rate)

if not 'top' in rate:
    maxl, minl = colors, colors
else:
    maxl = (colors - 1) + rate['top']
    if colors == 1:
        minl = 1
    else:
        minl = (colors - 1)

print(minl, maxl)

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

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
colors = set()
cnt = 0
for i in range(N):
    for j in range(1, 9):
        if (j - 1) * 400 <= A[i] < j * 400:
            colors.add(j)
            break
    if 3200 <= A[i]:
        cnt += 1

col_len = len(colors)
print(max(col_len, 1), col_len + cnt)

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

l = [0 for _ in range(8)]

b = 0

for i in range(N):
    if a[i] >= 3200:
        b += 1
    else:
        l[a[i] // 400] = 1

ans2 = sum(l) + b

ans1 = sum(l)
if ans1 == 0:
    ans1 = 1

print(ans1, ans2)

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

def mapColor(rate):
    if rate<=399:
        return 'grey'
    if rate<=799:
        return 'tea'
    if rate<=1199:
        return 'green'
    if rate<=1599:
        return 'water'
    if rate<=1999:
        return 'blue'
    if rate<=2399:
        return 'yellow'
    if rate<=2799:
        return 'orange'
    if rate<=3199:
        return 'red'
    return 'any'

s = set()

x = 0

for d in data:
    c = mapColor(d)
    if c=='any':
        x+=1
    else:
        s.add(c)

if len(s)!=0:
    print(len(s),end=" ")
else:
    print("1",end=" ")
print(x+len(s))

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

for i in a:
  if i >= 1 and i <= 399:
    ans[0] += 1
  elif i >= 400 and i <= 799:
    ans[1] += 1
  elif i >= 800 and i <= 1199:
    ans[2] += 1
  elif i >= 1200 and i <= 1599:
    ans[3] += 1
  elif i >= 1600 and i <= 1999:
    ans[4] += 1
  elif i >= 2000 and i <= 2399:
    ans[5] += 1
  elif i >= 2400 and i <= 2799:
    ans[6] += 1
  elif i >= 2800 and i <= 3199:
    ans[7] += 1
  else:
    ans[8] += 1
    
maxv = 0
minv = 0

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

maxv = str(minv + ans[8])
if minv == 0:
  minv = 1
minv = str(minv)



print("".join([minv, " ", maxv]))

Solution (Python):
import sys
sys.setrecursionlimit(10**7)
mo=10**9+7
n=int(input())
a=[0]*9
for s in map(int,input().split()):
    for i in range(8):
        if int(s)>=i*400 and (i+1)*400>int(s):
            a[i]=1
    if int(s)>=3200:
        
        a[8]+=1
    

ans=sum(a[0:8])

ans=[max(1,ans),a[8]+ans]
print(*ans)

Solution (Python):
from functools import reduce
import math

def main():
    
    
    
    

    
    
    
    
    
    
    
    
    
    
    
    
    
    INF = float("inf")
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    

    
    
    
    
    N = int(input().rstrip())
    c_num = 8 
    c = [0]*c_num
    all_color = 0
    a = list(int(_) for _ in input().split())
    for i in range(len(a)):
        index = a[i]//400
        if(index < 8):
            c[index] = 1
        else:
            all_color +=1
    min_color = max(sum(c),1)

    
    
    
    
    max_color = sum(c) + all_color
    print(min_color,max_color)
    
if __name__ == '__main__':
    main()

Solution (Python):
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def _I(): return int(sys.stdin.readline())
def _F(): return float(sys.stdin.readline())
def pf(s): return print(s, flush=True)

N=_I()
A=LI()
l = [0,0,0,0,0,0,0,0]
x=0
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:
		x+=1
	
ans =sum(1 if i>0 else 0 for i in l)
if ans==0:
	print(1, end=" ")
else:
	print(ans,end=" ")

print(ans+x)

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

l = [0] * 9
p = 0
for i in range(0,n):
    q = a[i] // 400
    if q < 8:
        l[q] = 1
    else:
        l[8] = 1
        p = p + 1

s = sum(l[0:8])
m = max(s,l[8])
M = s+p
print(m,M)

Solution (Python):
N=int(input())
a=[int(i) for i in input().split()]
rates=[0]*9
for rate in a:
    rates[min(rate//400,8)]+=1
ans=0
for color in rates[:8]:
    ans+=(color!=0)
ansmax=ans+rates[8]
print(max(ans,1),ansmax)

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

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

ans_min = max(8 - rank_num[:-1].count(0), 1)
ans_max = 8 - rank_num[:-1].count(0) + rank_num[-1]
print(ans_min, ans_max)

Solution (Python):
import sys
import collections
ns = lambda: sys.stdin.readline().rstrip()
ni = lambda: int(ns())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())
nsl = lambda: map(str, sys.stdin.readline().split())

n = ni()
a = nl()
l = [0 for _ in range(9)]
for i in range(n):
    if a[i] <= 399:
        l[0] += 1
    elif 400 <= a[i] <= 799:
        l[1] += 1
    elif 800 <= a[i] <= 1199:
        l[2] += 1
    elif 1200 <= a[i] <= 1599:
        l[3] += 1
    elif 1600 <= a[i] <= 1999:
        l[4] += 1
    elif 2000 <= a[i] <= 2399:
        l[5] += 1
    elif 2400 <= a[i] <= 2799:
        l[6] += 1
    elif 2800 <= a[i] <= 3199:
        l[7] += 1
    elif 3200 <= a[i]:
        l[8] += 1
if l[8] == 0:
    print(9 - l.count(0), 9 - l.count(0))
else:
    if l.count(0) == 8:
        print(1, l[8])
    else:
        print(8 - l.count(0), 8 - l.count(0) + l[8])

Solution (Python):


import math




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

l=[0,0,0,0,0,0,0,0,0]

for i in range(n):
    a=math.floor(lis[i]/400)
    if a<8:
        l[a]=1
    else:
        l[-1]+=1

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

Solution (Python):

N = int(input())
A = list(map(int,input().split()))
ex_red = [0]*8
red_cnt = 0

for i in range(8):
    for j in range(N):
        if 400*i<=A[j] and A[j]<400*(i+1):
            ex_red[i]+=1
n = 0
for i in range(N):
    if 3200 <= A[i]:
        n += 1
not_red_color = 0
c = 0
for i in range(8):
    if ex_red[i] > 0:
        c += 1



max_ans = n + c


if c >= 1:
    min_ans = c
elif c == 0:
    min_ans = 1
print(min_ans, max_ans)

Solution (Python):
from collections import OrderedDict
import numpy as np

N = int(input())
a = np.array([int(i) for i in input().split()])

scores = OrderedDict()
scores[1] = 0
scores[400] = 0
scores[800] = 0
scores[1200] = 0
scores[1600] = 0
scores[2000] = 0
scores[2400] = 0
scores[2800] = 0
scores[3200] = 0

for record in a:
  for s in list(scores.keys())[::-1]:
    if record>=s:
      scores[s] += 1
      break
      
colors = np.sum([
  int(v>0) for k, v in scores.items() if k<3200])

if scores[3200]>0 and colors==0:
  min_colors = 1
else: 
  min_colors = colors
max_colors = colors + scores[3200]

print(min_colors, max_colors)

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

color_set = set()
original_cnt = 0
red_flag = False
for val in a:
    if val >= 3200:
        original_cnt += 1
    else:
        if val >= 2800:
            red_flag = True
        color_set.add(int(val / 400))
if red_flag is True:
    print('{} {}'.format(len(color_set), len(color_set) + original_cnt))
else:
    if original_cnt > 0:
        print('{} {}'.format(len(color_set) + 1, len(color_set) + original_cnt))
    else:
        print('{} {}'.format(len(color_set), len(color_set)))

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

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

c=ans+li[8]

if ans==0:
  print(1,c)
else:
  print(ans,c)

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

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

for i in range(N):
  for j in range(9):
    if(j == 0):
      if(1<=A[i]<400): Color[j] = 1 
    elif(1<=j<=7):
       if(400*j<=A[i]<400*(j+1)):Color[j] = 1
    else:
       if(3200<=A[i]): Color[j] += 1
   

if(N == Color[-1]):
  ans_min = 1
  ans_max = N
else:
  ans_min = sum(Color) - Color[-1]
  ans_max = sum(Color) 
print(ans_min,ans_max)

Solution (Python):
import bisect
from collections import defaultdict
n = int(input())
a = list(map(int, input().split()))
color_list = [1, 400, 800, 1200, 1600, 2000, 2400, 2800, 3200]
color_dict = defaultdict(int)
red_count = 0
for i in a:
  idx = bisect.bisect_right(color_list, i)
  if 1 <= idx <= 8:
    color_dict[idx] += 1
  elif idx == 9:
    red_count += 1
if len(color_dict) >= 1:
  print(len(color_dict), len(color_dict)+red_count)
else:
  print(1, red_count)

Solution (Python):
from sys import stdin

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

rate = [0]*8
f = 0

for i in range(n):
    if 3199 < a[i]:
        f += 1
    else:
        rate[int((a[i]/400))] = 1

s = sum(rate)
min = s if 0 < s else 1
max = s+f

print(min, max)

Solution (Python):
import sys

def main():
    input = sys.stdin.readline
    N = int(input())
    A = list(map(int, input().split()))
    
    wildcard = 0
    color = [0] * 8
    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:
            wildcard += 1

    nc = sum(color)
    print(max(1, nc), nc + wildcard)


if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
x = {}
for i in range(n):
    t = min(a[i] // 400, 8)
    if t in x.keys():
        x[t] += 1
    else:
        x[t] = 1
m = 0
l = len(x.keys())
if 8 in x.keys():
    ans = [max(1, l - 1), l - 1 + x[8]]
else:
    ans = [l, l]
print(*ans)

Solution (Python):
c=[0]*8;n=int(input());a=list(map(int,input().split()))
r=0
for i in a:
  if i>3199:r+=1
  else:c[i//400]=1
b=c.count(1)
print(max(b,1),b+r)

Solution (Python):
N=int(input())
a=list(map(int,input().split()))
color=[0]*9
for i in range(N):
    if a[i]//400>=8:
        color[8]+=1
    else:
        color[a[i]//400]+=1
cnt=0
for i in range(8):
    if color[i]>0:
        cnt+=1
mx=cnt+color[8]
if cnt>0:
    mn=cnt
else:
    mn=1
print(mn,mx)

Solution (Python):
N=int(input())
a=list(map(int,input().split()))
color=[0]*9
for i in range(N):
    if a[i]//400>=8:
        color[8]+=1
    else:
        color[a[i]//400]+=1
cnt=0
for i in range(8):
    if color[i]>0:
        cnt+=1
mx=cnt+color[8]
if cnt>0:
    mn=cnt
else:
    mn=1
print(mn,mx)

Solution (Python):

from collections import Counter

N = int(input())
a = Counter(list(map(lambda x: x//400, map(int, input().split()))))

c = n = 0
for key in [0,1,2,3,4,5,6,7]:
    if a[key]:
        c += 1
        
for key in [8,9,10,11,12]:
    n += a[key]
        
max_n = c+n
if c:
    min_n = c
else:
    min_n = 1
print(min_n, max_n)

Solution (Python):
from collections import OrderedDict
N = int(input())
A = list(map(int, input().split()))
R = {"gray": 0, "brown": 0, "green": 0, "light": 0, "blue": 0, "yellow": 0, "orange": 0, "red": 0}
S = OrderedDict([("gray", 400), ("brown", 800), ("green", 1200), ("light", 1600), ("blue", 2000), ("yellow", 2400), ("orange", 2800), ("red", 3200)])
for a in A:
    for r, s in S.items():
        if a < s:
            R[r] += 1
            break
num = len([r for r, n in R.items() if n != 0])
other = N - sum([n for r, n in R.items() if n != 0])
if num == 0:
    print(1, N)
    exit()
print(num, num + other)

Solution (Python):
from collections import OrderedDict
N = int(input())
A = list(map(int, input().split()))
R = {"gray": 0, "brown": 0, "green": 0, "light": 0, "blue": 0, "yellow": 0, "orange": 0, "red": 0}
S = OrderedDict([("gray", 400), ("brown", 800), ("green", 1200), ("light", 1600), ("blue", 2000), ("yellow", 2400), ("orange", 2800), ("red", 3200)])
for a in A:
    for r, s in S.items():
        if a < s:
            R[r] += 1
            break
num = len([r for r, n in R.items() if n != 0])
other = N - sum([n for r, n in R.items() if n != 0])
if num == 0:
    print(1, N)
    exit()
print(num, num + other)

Solution (Python):
N = int(input())
R = list(map(int,input().split()))
a = [0]*8
b = 0
for i in range(N):
    if R[i] < 400:
        a[0] += 1
    elif R[i] < 800:
        a[1] += 1
    elif R[i] < 1200:
        a[2] += 1
    elif R[i] < 1600:
        a[3] += 1
    elif R[i] < 2000:
        a[4] += 1
    elif R[i] < 2400:
        a[5] += 1
    elif R[i] < 2800:
        a[6] += 1
    elif R[i] < 3200:
        a[7] += 1
    else:
        b += 1
ans = 0
for i in range(8):
    if a[i] != 0:
        ans += 1
ans2 =str(ans+b)
if ans == 0:
    ans = 1
ans1 = str(ans)
print(ans1+" "+ans2)

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

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
color =set()
t = 0
for i in range(n):
    if a[i] <=399:
        a[i] = "gray"
    elif a[i]<= 799:
        a[i] = "brown"
    elif a[i]<=1199:
        a[i] = "green"
    elif a[i] <= 1599:
        a[i] = "water"
    elif a[i] <= 1999:
        a[i] ="blue"
    elif a[i] <=2399:
        a[i] ="yellow"
    elif a[i] <=2799:
        a[i] ="daidai"
    elif a[i] <= 3199:
        a[i] = "red"
    else:
        a[i] = "target"
        t += 1
for i in range(n):
    if a[i] != "target":
       color.add(a[i])
    else:
        continue
if len(list(color)) >=1:
    print(len(list(color)),len(list(color))+t)
else:
    print(1,t)

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
A = sorted(A)
A2 = list(map(lambda a: a // 400, A))

G1 = [a for a in A2 if a < 8]
min = len(set(G1))
max = min + len(A2) - len(G1)

if min == 0:
    min = 1
print(min, max)

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

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

Solution (Python):


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

color = [0,0,0,0,0,0,0,0,0]

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


min_col = color[:]
min_cnt = 0
del min_col[-1]
for i in range(len(min_col)):
    if min_col[i] != 0:
        min_cnt += 1

max_cnt = min_cnt + color[8]
min_cnt = max(1,min_cnt)

print(min_cnt, max_cnt)

Solution (Python):
import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int, input().split()))
dic, c = {}, 0
for i in range(N):
    b = min(a[i] // 400, 8)
    if b not in dic:
        dic[b] = 1
    if b == 8:
        c += 1
m, M = len(dic.keys()), len(dic.keys())
if c > 0:
    m = max(1, m - 1)
    M += c - 1
print(m, M)

Solution (Python):
N = int(input())
alist = list(map(int,input().split()))
gray , brown ,green , sky , blue , yellow , orange  ,red , top = 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0
for a in alist:
    if a < 400:
        gray += 1
    elif a < 800:
        brown += 1
    elif a < 1200:
        green += 1
    elif a < 1600:
        sky += 1
    elif a < 2000:
        blue += 1
    elif a < 2400:    
        yellow += 1
    elif a < 2800:  
        orange += 1
    elif a < 3200:
        red += 1
    else:
        top += 1  
cmin = 0
cmax = 0
if  gray > 0:
    cmin += 1
    cmax += 1
if  brown > 0:
    cmin += 1
    cmax += 1
if  green > 0:
    cmin += 1
    cmax += 1
if  sky > 0:
    cmin += 1
    cmax += 1
if  blue > 0:
    cmin += 1
    cmax += 1
if  yellow > 0:
    cmin += 1
    cmax += 1
if  orange > 0:
    cmin += 1
    cmax += 1
if  red > 0:
    cmin += 1
    cmax += 1
if  top > 0:
    if cmin == 0:
        cmin += 1
    cmax += top
print(cmin ,cmax)

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

for a in A:
  cls=min(a//400, 8)
  
  if cls>=8:
    counter[8]+=1
  else:
    counter[cls]=1



print(max(1, sum(counter[0:8])), (sum(counter[0:8])+counter[8]))

Solution (Python):
N = int(input())
a = [int(i) for i in input().split()]
ls = [0]*9
b = [1,400,800,1200,1600,2000,2400,2800,3200,4810]
for i in range(N):
    for j, (x, y) in enumerate(zip(b, b[1:])):
        if x <= a[i] and a[i] < y:
            ls[j] += 1
l = 8 - ls[:-1].count(0)
if l == 0:
    print(1, ls[-1])
else:
    print(l, l+ls[-1])

Solution (Python):
input()
rates = [int(x) for x in input().split(' ')]

colors = set()

for rate in rates:
    if rate in range(1, 400):
        colors.add('gray')
    elif rate in range(800):
        colors.add('brown')
    elif rate in range(1200):
        colors.add('green')
    elif rate in range(1600):
        colors.add('lightblue')
    elif rate in range(2000):
        colors.add('blue')
    elif rate in range(2400):
        colors.add('yellow')
    elif rate in range(2800):
        colors.add('orange')
    elif rate in range(3200):
        colors.add('red')

print(max(len(colors), 1), len(colors) + len([x for x in rates if x >= 3200]))

Solution (Python):
def colorful_leaderboard(N: int, A: list)->tuple:
    rates = {
        '0001-0399': False,
        '0400-0799': False,
        '0800-1199': False,
        '1200-1599': False,
        '1600-1999': False,
        '2000-2399': False,
        '2400-2799': False,
        '2800-3199': False,
    }
    wildcard = 0

    for a in A:
        if a < 400:
            rates['0001-0399'] = True
        elif a < 800:
            rates['0400-0799'] = True
        elif a < 1200:
            rates['0800-1199'] = True
        elif a < 1600:
            rates['1200-1599'] = True
        elif a < 2000:
            rates['1600-1999'] = True
        elif a < 2400:
            rates['2000-2399'] = True
        elif a < 2800:
            rates['2400-2799'] = True
        elif a < 3200:
            rates['2800-3299'] = True
        else:
            wildcard += 1

    rated_colors = sum(rates.values())
    return rated_colors if rated_colors > 0 else 1, rated_colors + wildcard


if __name__ == "__main__":
    N = int(input())
    A = [int(s) for s in input().split()]
    min_c, max_c = colorful_leaderboard(N, A)
    print(min_c, max_c)

Solution (Python):
import numpy as np
N = int(input())
a_list = list(map(int, input().split()))
class_list = []
free_list = []
for a in a_list:  
  if a < 3200:
    amod = a // 400
    class_list.append(amod)
  
  else:
    free_list.append(a)

set_list = list(set(class_list))
min_list = len(set_list)
max_list = len(set_list) + len(free_list)

if min_list == 0:
  min_list = 1
print(min_list, max_list)

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

array1 = [0] * 8
over3200 = 0

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

ansmax = A + over3200
ansmin = max(A, 1)
    
print(ansmin, ansmax)

Solution (Python):
N = int(input())
a = list(map(int,input().split()))
tourist = 0
human = [0 for i in range(8)]
for i in range(N):
    if a[i] >= 3200:
        tourist += 1
        continue
    else: human[a[i]//400] += 1
color = sum([1 for i in human if i > 0])
print(str(max(1,color))+' '+str(color+tourist))

Solution (Python):
from collections import Counter
input()
a = [x // 400 for x in map(int, input().split())]
c = []
ans = 0
for i in a:
    if i > 7:
        ans += 1
    else:
        c.append(i)
print(max(1,len(Counter(c))), ans + len(Counter(c)))

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

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

C=[0]*9

for i in A:
    x=i//400
    if x<8:
        C[x]=1
    else:
        C[8]+=1
b=sum(C[:8])
print(str(max(b,1))+' '+str(b+C[8]))

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

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

ov=0
res=0
C=[0]*8

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

for j in C:
    if j!=0:
        res+=1
if res!=0:
    print(str(res)+' '+str(res+ov))
else:
    print(str(1)+' '+str(ov))

Solution (Python):
N=int(input())
A=list(map(int,input().split(' ')))
colors=[8 if a>=3200 else a//400 for a in A]
c1=[1 if i in colors else 0 for i in range(8)]
c2=colors.count(8)
print(max(1,c1.count(1)),c1.count(1)+c2)

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

Solution (Python):
n=int(input())
A=list(map(int,input().split()))
A=list(map(lambda x:x//400 if x//400<=7 else 8 ,A))
target=A.count(8)
total=len(set(A))
min=total-1 if 8 in A else total
print(min if min!=0 else 1,min+target)

Solution (Python):
N = int(input())
a = [int(_) for _ in input().split()]
color = [False]*8
overnum = 0

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

print(max(1, color.count(True)), color.count(True)+overnum)

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

num = 0
diff = colors[8]
for i in range(8):
    if colors[i]:
        num += 1
print(max(num,1), num + diff)