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 = input().split()
b = []
for ii in range(9):
    b.append(0)
for ii in range(N):
    if int(a[ii]) < 400:
        b[0] = b[0] + 1
    elif int(a[ii]) < 800:
        b[1] = b[1] + 1
    elif int(a[ii]) < 1200:
        b[2] = b[2] + 1
    elif int(a[ii]) < 1600:
        b[3] = b[3] + 1
    elif int(a[ii]) < 2000:
        b[4] = b[4] + 1
    elif int(a[ii]) < 2400:
        b[5] = b[5] + 1
    elif int(a[ii]) < 2800:
        b[6] = b[6] + 1
    elif int(a[ii]) < 3200:
        b[7] = b[7] + 1
    else:
        b[8] = b[8] + 1
min = 0
max = 0
for ii in range(8):
    if b[ii] > 0:
        min = min + 1
        max = max + 1
max = max + b[8]
if min == 0 and b[8] >0:
    min = 1
print(str(min) + ' ' + str(max))

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

def get_cols(rates):
    col_flags = [False for _ in range(8)]
    wild_colors = 0
    for rate in rates:
        if rate >= 3200:
            wild_colors += 1
        else:
            col_flags[rate // 400] = True

    decided_cols = col_flags.count(True)
    max_cols = decided_cols + wild_colors
    
    if decided_cols > 0:
        min_cols = decided_cols
    else:
        min_cols = 1
    return (min_cols, max_cols)

print("{} {}".format(*get_cols(rates)))

Solution (Python):

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

def colors(score):
    if score < 400:
        return 1
    elif score < 800:
        return 2
    elif score < 1200:
        return 3
    elif score < 1600:
        return 4
    elif score < 2000:
        return 5
    elif score < 2400:
        return 6
    elif score < 2800:
        return 7
    elif score < 3200:
        return 8
    elif score >= 3200:
        return 0

ary = [colors(s) for s in a]
ary_n = set(ary)

if not 0 in ary_n:
    n_min = len(ary_n)
    n_max = len(ary_n)
else:
    n_zero = sum([e == 0 for e in ary])
    n_min = len(ary_n) - 1 if len(ary_n) > 1 else 1
    n_max = len(ary_n) + n_zero - 1

print(n_min, n_max)

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

exist = [False for i in range(8)]
colorful = 0
min = 0

rates = list(map(int, input().split(" ")))

for rate in rates:
    if rate >= 3200:
        colorful += 1
        continue
    if not exist[int(rate/400)]:
        exist[int(rate / 400)] = True
        min += 1

max_color = colorful + min
if min == 0:
    min = 1

result = str(min) + " " + str(max_color)
print(result)

Solution (Python):
import math

ranks = [False for i in range(8)]
highs = 0
n = int(input())
inps = [int(i) for i in input().split()]
highs = len([i for i in inps if i > 3199])
inps = [i for i in inps if i <= 3199]
for i in inps:
    if i >= 1 and i <= 399:
        ranks[0] = True
    elif i >= 400 and i <= 799:
        ranks[1] = True
    elif i >= 800 and i <= 1199:
        ranks[2] = True
    elif i >= 1200 and i <= 1599:
        ranks[3] = True
    elif i >= 1600 and i <= 1999:
        ranks[4] = True
    elif i >= 2000 and i <= 2399:
        ranks[5] = True
    elif i >= 2400 and i <= 2799:
        ranks[6] = True
    elif i >= 2800 and i <= 3199:
        ranks[7] = True
lows = len([i for i in ranks if i == True])

minimum = max(lows, 1)
maximum = lows + highs

print(minimum, maximum)

Solution (Python):

N = int(input())
a = list(map(int, input().split()))
rate = [ 0 for tmp in range(9) ]
factor = 0
empty = 0
for tmp in range(N):
    if 1 <= a[tmp] and  a[tmp] <= 399:
        rate[0] += 1
    elif 400 <= a[tmp] and a[tmp] <= 799:
        rate[1] += 1
    elif 800 <= a[tmp] and a[tmp] <= 1199:
        rate[2] += 1
    elif 1200 <= a[tmp] and a[tmp] <= 1599:
        rate[3] += 1
    elif 1600 <= a[tmp] and a[tmp] <= 1999:
        rate[4] += 1
    elif 2000 <= a[tmp] and a[tmp]<= 2399:
        rate[5] += 1
    elif 2400 <= a[tmp] and a[tmp] <= 2799:
        rate[6] += 1
    elif 2800 <= a[tmp] and a[tmp] <= 3199:
        rate[7] += 1
    else:
        rate[8] += 1
for tmp in range(len(rate)-1):
    if rate[tmp] > 0:
        factor += 1
    else:
        empty += 1
if rate[8] > 0:
    if factor == 0:
        print("1 "+str(rate[8]))
    else:
        print(str(factor)+' '+str(factor+rate[8]))
else:
    print(str(factor)+' '+str(factor))

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

field = [0 for x in range(len(r))]

ok = 3200
oknum = 0

n = int(input())

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

for x in a:
    if x >= ok:
        oknum += 1
        continue
    for i, v in enumerate(r):
        if v[0] <= x <= v[1]:
            field[i] = 1


sumf = sum(field)

print(sumf if sumf != 0 else 1, min(sumf + oknum, sumf + oknum))

Solution (Python):



import array
from bisect import *
from collections import *
import fractions
import heapq 
from itertools import *
import math
import re
import string

_ = input()
As = list(map(int, input().split()))
bins = [0] * 9
table = [400, 800, 1200, 1600, 2000, 2400, 2800, 3200, 10000]
for a in As:
    for i, t in enumerate(table):
        if a < t:
            bins[i] += 1
            break
mn = sum(1 for x in bins[:-1] if x > 0)
if mn == 0:
    mn = 1
    mx = bins[-1]
else:
    mx = mn + bins[-1]
print(mn, mx)

Solution (Python):
n=int(raw_input())
a=map(int,raw_input().split())
b=[0]*9
for i in a:
	c=i//400
	if c>=8:
		b[8]+=1
	else:
		b[c]=b[c] or 1

if sum(b[:-1])==0 and b[-1]!=0:
	d=1
else:
	d=sum(b[:-1])

print d,sum(b)

Solution (Python):
import numpy as np
 
n = int(input())
a = list(int(i) for i in input().split()) 
a.sort()
minCount = 0
maxCount = 0
count = np.zeros(9)

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

for i in range(8) :
    if count[i] > 0 :
        minCount = minCount + 1
        maxCount = maxCount + 1

maxCount = maxCount + count[8]
if minCount == 0 :
    minCount = 1


print (minCount, end =' ')
print (int(maxCount))

Solution (Python):


n = input()
a = map(int, raw_input().split())
rate = [0] * 9

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

if 1 in rate[:8]:
    print sum(rate[:8]), sum(rate)
else:
    print 1, sum(rate)

Solution (Python):
colors = {"hai": False,
          "cha": False,
          "midori": False,
          "mizu": False,
          "ao": False,
          "ki": False,
          "daidai": False,
          "aka": False}
i2c = [None]*3200
for i in range(3200):
    if i < 400:
        i2c[i] = "hai"
    elif i < 800:
        i2c[i] = "cha"
    elif i < 1200:
        i2c[i] = "midori"
    elif i < 1600:
        i2c[i] = "mizu"
    elif i < 2000:
        i2c[i] = "ao"
    elif i < 2400:
        i2c[i] = "ki"
    elif i < 2800:
        i2c[i] = "daidai"
    else:
        i2c[i] = "aka"
n = int(input())
rates = [int(i) for i in input().split()]
jiyu = 0
for x in rates:
    if x >= 3200:
        jiyu += 1
    else:
        colors[i2c[x]] = True
saisho = 0

for x in colors:
    if(colors[x]):
        saisho += 1
if(saisho < 1):
    saisho = 1
    jiyu -= 1
print(saisho, saisho+jiyu)

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

X = [0 for _ in range(13)]
for a in A:
    X[a / 400] += 1
cnt = 0
for x in X[:8]:
    if x != 0:
        cnt += 1
cnt2 = sum(X[8:])

print max(1, cnt), cnt + cnt2

Solution (Python):

N = int(raw_input())
a = map(int, raw_input().split()) 

over = 0
color = set()
for ai in a:
    if ai/400 >= 8:
        over += 1
    else:
        color.add(ai/400)

print max(1, len(color)), len(color) + over

Solution (Python):
N = int(input())
data = list(map(int,input().split()))
box = [0]*8
num = 0
for i in range(len(data)):
        x = int(data[i] / 400)
        if x < 8:
            box[x] += 1
        else:
            num += 1
answer = len(box)   - box.count(0)
if answer == 0:
    print(1,num)
else:
    print(answer,(answer+num))

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

color=[0]*8
free=0

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

c=len(color)-color.count(0)

m=c+free

if c==0:
    c=1

print c,m

Solution (Python):


n = int(input())
a = list(map(int, input().split()))
s = set()
for i in a:
    if 1 <= i <= 399 : s.add(1)
    if 400 <= i <= 799 : s.add(2)
    if 800 <= i <= 1199 : s.add(3)
    if 1200 <= i <= 1599 : s.add(4)
    if 1600 <= i <= 1999 : s.add(5)
    if 2000 <= i <= 2399 : s.add(6)
    if 2400 <= i <= 2799 : s.add(7)
    if 2800 <= i : s.add(8)
r = len([1 for x in a if 2800 <= x <= 3199]) < 1
print(len(s), len(s) + max((len([1 for x in a if x > 3199]) - r, 0)))

Solution (Python):
N = int(input())
A = input().split()
b = [0]*8
c = 0

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

if c == 0:
    print(8-b.count(0), end=" ")
else:
    print(max(8-b.count(0),1), end=" ")

print(8-b.count(0)+c)

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


def color(n):
    if 1 <= n <= 399:
        return 0
    elif 400 <= n <= 799:
        return 1
    elif 800 <= n <= 1199:
        return 2
    elif 1200 <= n <= 1599:
        return 3
    elif 1600 <= n <= 1999:
        return 4
    elif 2000 <= n <= 2399:
        return 5
    elif 2400 <= n <= 2799:
        return 6
    elif 2800 <= n <= 3199:
        return 7
    else:
        return 8


x = [color(a) for a in A]
dora = x.count(8)
unique = len(set(x)) if dora == 0 else len(set(x)) - 1
min_ = max(1, unique)
max_ = unique + dora
print(min_, max_)

Solution (Python):
N = input()
rates = [int(x) for x in input().split()]
colors = [0,0,0,0,0,0,0,0]
target = 0

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

non_target = sum(colors)
MAX = non_target + target

if non_target == 0:
	MIN = 1
else:
	MIN = non_target

print(MIN,MAX)

Solution (Python):
def c():
    n = int(input())
    a = list(map(int, input().split()))
    x = []
    def set_col(rate):
        if rate <= 399:
            return '灰色'
        elif rate <= 799:
            return '茶色'
        elif rate <= 1199:
            return '緑色'
        elif rate <= 1599:
            return '水色'
        elif rate <= 1999:
            return '青色'
        elif rate <= 2399:
            return '黄色'
        elif rate <= 2799:
            return '橙色'
        elif rate <= 3199:
            return '赤色'
        else:
            x.append(1)
            return

    res = set(map(set_col, a))
    if None in res: res.remove(None)
    mi = max(1, len(res))
    ma = len(res) + len(x)
    print(mi, ma)

c()

Solution (Python):

import array, bisect, collections, copy, heapq, itertools, math, random, re, string, sys, time

sys.setrecursionlimit(10 ** 7)
INF = 10 ** 20
MOD = 10 ** 9 + 7


def II(): return int(input())
def ILI(): return list(map(int, input().split()))
def IAI(LINE): return [ILI() for __ in range(LINE)]
def IDI(): return {key: value for key, value in ILI()}


def read():
    N = II()
    a = ILI()
    return (N, a)


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

    num_else = sum(count[0: 8])
    ans_max = sum(count)
    if num_else == 0:
        ans_min = 1
    else:
        ans_min = num_else
    
    ans = (ans_min, ans_max)
    return ans


def main():
    params = read()
    ans = solve(*params)
    print("{} {}".format(ans[0], ans[1]))


if __name__ == "__main__":
    main()

Solution (Python):
def get_color_index(rate):
    if 1 <= rate and rate <= 399:
        return 0
    elif 400 <= rate and rate <= 799:
        return 1
    elif 800 <= rate and rate <= 1199:
        return 2
    elif 1200 <= rate and rate <= 1599:
        return 3
    elif 1600 <= rate and rate <= 1999:
        return 4
    elif 2000 <= rate and rate <= 2399:
        return 5
    elif 2400 <= rate and rate <= 2799:
        return 6
    elif 2800 <= rate and rate <= 3199:
        return 7
    else:
        return -1

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

colors = []
wildcard_count = 0

for i in range(N):
    c = get_color_index(a[i])
    if c == -1:
        wildcard_count += 1
    elif c not in colors:
        colors.append(c)

c_min = max(len(colors), 1)
c_max = len(colors) + wildcard_count

print(str(c_min) + ' ' + str(c_max))

Solution (Python):
n = int(input())
A = list(map(int, input().split()))
B = set()
C = []
for i in A:
    if 1<= i <= 399:
        B.add("grey")
    elif 400 <= i <= 799:
        B.add("brown")
    elif 800 <= i <= 1199:
        B.add("green")
    elif 1200 <= i <= 1599:
        B.add("sky")
    elif 1600 <= i <= 1999:
        B.add("blue")
    elif 2000 <= i <= 2399:
        B.add("yellow")
    elif 2400 <= i <= 2799:
        B.add("orange")
    elif 2800 <= i <= 3199:
        B.add("red")
    else:
        C.append("X")

if C:
    S = len(B)
    T = len(B) + len (C)
    if S == 0:
        S = 1
    print(str(S) + " " + str(T))
else:
    print(str(len(B)) + " " + str(len(B)))

Solution (Python):
N = int(input())
a = list(map(int, input().split()))
s = []
k = 0
l = 0

for i in range(N):
	if a[i] <= 399:
		s.append('a')
	elif a[i] <= 799:
		s.append('b')
	elif a[i] <= 1199:
		s.append('c')
	elif a[i] <= 1599:
		s.append('d')
	elif a[i] <= 1999:
		s.append('e')
	elif a[i] <= 2399:
		s.append('f')
	elif a[i] <= 2799:
		s.append('g')
	elif a[i] <= 3199:
		s.append('h')
	else:
		k += 1

if s.count("a") != 0:
	l += 1

if s.count("b") != 0:
	l += 1
	
if s.count("c") != 0:
	l += 1

if s.count("d") != 0:
	l += 1

if s.count("e") != 0:
	l += 1
	
if s.count("f") != 0:
	l += 1

if s.count("g") != 0:
	l += 1

if s.count("h") != 0:
	l += 1
	
m = k + l

if l == 0:
	print(1,m)
else:
	print(l,m)

Solution (Python):
if __name__ == '__main__':
    N = int(input())
    a = list(map(int, input().split()))

    
    colors_count = [0 for i in range(8)]
    super_count = 0
    for score in a:
        if int(score / 400) == 0:
            colors_count[0] += 1
        elif int(score / 400) == 1:
            colors_count[1] += 1
        elif int(score / 400) == 2:
            colors_count[2] += 1
        elif int(score / 400) == 3:
            colors_count[3] += 1
        elif int(score / 400) == 4:
            colors_count[4] += 1
        elif int(score / 400) == 5:
            colors_count[5] += 1
        elif int(score / 400) == 6:
            colors_count[6] += 1
        elif int(score / 400) == 7:
            colors_count[7] += 1
        else:
            super_count += 1

    

    
    not_zero_count = 0
    for num in colors_count:
        if num != 0:
            not_zero_count += 1

    if not_zero_count == 0:
        ans_min = 1
        
        ans_max = super_count
    else:
        ans_min = not_zero_count
        
        ans_max = not_zero_count + super_count

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

Solution (Python):
n = int(input())
a_list = list(map(int,input().split()))
color_vari = set()
over3200 = 0
for x in a_list:
	if x >= 3200:
		over3200 += 1

	else:
		color_vari.add(x // 400)
if len(color_vari) == 0:
	print(1,over3200)
else:
	print(len(color_vari),len(color_vari)+over3200)

Solution (Python):
N = int(input())
data = input().split()
data = data[:N]

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

for i in data:
	i = int(i)
	if(i< 400):				
		if(color[0] == 0):
			color[0] = 1
	elif(i < 800):			
		if(color[1] == 0):
			color[1] = 1
	elif(i < 1200):			
		if(color[2] == 0):
			color[2] = 1
	elif(i < 1600):			
		if(color[3] == 0):
			color[3] = 1
	elif(i < 2000):			
		if(color[4] == 0):
			color[4] = 1
	elif(i < 2400):			
		if(color[5] == 0):
			color[5] = 1
	elif(i < 2800):			
		if(color[6] == 0):
			color[6] = 1
	elif(i < 3200):			
		if(color[7] == 0):
			color[7] = 1
	else:					
		count += 1

flag = sum(color)
if(flag == 0):
	min = 1
	max = count
else:
	min = flag
	max = min + count

print(min, max)

Solution (Python):

n = input()
a = map(int, raw_input().split())
a = sorted(a)

check = [0]*8
ex = 0
for i in range(n):
    if(a[i]<3200):
        check[a[i]/400] = 1
    else:
        ex += 1
l = max(sum(check),1)
h = sum(check)+ex
print(str(l)+' '+str(h))

Solution (Python):
import numpy as np

n = int(input())
a_str = input().split()
a_num = [int(a) for a in a_str]
a_array = np.array(a_num)

rate_list = [1,400,800,1200,1600,2000,2400,2800,3200]

count = 0

for i in range(8):
    if len(a_array[np.where((a_array>=rate_list[i])&(a_array<rate_list[i+1]))]):
        count += 1

if count == 0:
    min_count = 1
else:
    min_count = count

count += len(a_array[a_array>=rate_list[8]])
max_count = count

print(str(min_count)+" "+str(max_count))

Solution (Python):
n=int(raw_input())
a=map(int,raw_input().split())
c=[0]*8
mx=0
for i in xrange(n):
    if 1<=a[i]<400:
        c[0]=1
    elif 400<=a[i]<800:
        c[1]=1
    elif 800<=a[i]<1200:
        c[2]=1
    elif 1200<=a[i]<1600:
        c[3]=1
    elif 1600<=a[i]<2000:
        c[4]=1
    elif 2000<=a[i]<2400:
        c[5]=1
    elif 2400<=a[i]<2800:
        c[6]=1
    elif 2800<=a[i]<3200:
        c[7]=1
    else:
        mx+=1
print max(1,sum(c)),sum(c)+mx

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

rank = [False] * 8

count = 0
for i in range(N):
  if 3200 <= a[i]:
    count += 1
  else:
    rank[int(a[i]/400)] = True

minimum = rank.count(True)
maximum = minimum + count
if minimum == 0:
  minimum = 1
print minimum, maximum

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

res_min = 0
res_max = 0

g = list(filter(lambda x: x <= 399, a))
br = list(filter(lambda x: 400 <= x <= 799, a))
gr = list(filter(lambda x: 800 <= x <= 1199, a))
s = list(filter(lambda x: 1200 <= x <= 1599, a))
bl = list(filter(lambda x: 1600 <= x <= 1999, a))
y = list(filter(lambda x: 2000 <= x <= 2399, a))
o = list(filter(lambda x: 2400 <= x <= 2799, a))
r = list(filter(lambda x: 2800 <= x <= 3199, a))
t = list(filter(lambda x: 3200 <= x, a))

c_list = [g, br, gr, s, bl, y, o, r]

for c in c_list:
    if len(c) != 0:
        res_min += 1
        res_max += 1

if res_min == 0:
    res_min += 1
res_max += len(t)


print(res_min, res_max)

Solution (Python):

from collections import Counter
N = int(input())
a = [int(n)//400 for n in input().split()]
counter = Counter(a)

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

rainbow_coder = 0
for i in range(8, 13):
    rainbow_coder += counter[i]

print("{} {}".format(max(1, colors), colors+rainbow_coder))

Solution (Python):
N = int(raw_input())
a = map(int, raw_input().split())
b = []
cnt = 0
for i in range(0, N):
    if a[i] / 400 >= 8:
        cnt += 1
    else:
        b.append(a[i]/400)
b = set(b)

flag = 1
for x in a:
    if x >= 3200:
        flag = 0
    else:
        flag = 1
        break
if flag:
    print len(b)
else:
    print 1
print len(b) + cnt

Solution (Python):
N=int(raw_input())
a=map(int,raw_input().split())
c=[0,0,0,0,0,0,0,0]
m=0
for i in range(N):
    b =a[i]/ 400
    if b < 8:
        c[b]+=1
    else:
        m+=1


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

mi=ans
if mi==0:
    mi=1
ma=ans+m
print mi,ma

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

gray, tya, midori, mizu, ao, ki, daidai, aka, joker = 0, 0, 0, 0, 0, 0, 0, 0, 0

for i in a:
    if 1 <= i <= 399:
        gray = 1
    elif 400 <= i <= 799:
        tya = 1
    elif 800 <= i <= 1199:
        midori = 1
    elif 1200 <= i <= 1599:
        mizu = 1
    elif 1600 <= i <= 1999:
        ao = 1
    elif 2000 <= i <= 2399:
        ki = 1
    elif 2400 <= i <= 2799:
        daidai = 1
    elif 2800 <= i <= 3199:
        aka = 1
    elif 3200 <= i:
        joker += 1

mini = gray+tya+midori+mizu+ao+ki+daidai+aka
maxi = mini + joker

if mini == 0 and joker != 0:
    mini = 1

print mini, maxi

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

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

mn = sum(kinds)
if mn == 0:
    mn = 1
    mx = wild
else:
    mx = mn + wild
print mn,mx

Solution (Python):
N = int(input())
R = [1,400,800,1200,1600,2000,2400,2800,3200,4801]
r = [0] * 10
A = list(map(int,input().split()))
for a in A:
	m = 0
	M = 9
	while True:
		n = (m + M) // 2
		if a < R[n]:
			M = n
		elif a >= R[n + 1]:
			m = n
		else:
			break
	r[n] += 1
cnt = 0
for i in r[:-2]:
	if i > 0:
		cnt += 1
if cnt == 0:
	max_cnt = r[8]
	cnt = 1
else:
	max_cnt = cnt + r[8]
print(cnt,max_cnt)

Solution (Python):



conds = (
    [lambda x: x <= 399, False],
    [lambda x: x <= 799, False],
    [lambda x: x <= 1199, False],
    [lambda x: x <= 1599, False],
    [lambda x: x <= 1999, False],
    [lambda x: x <= 2399, False],
    [lambda x: x <= 2799, False],
    [lambda x: x <= 3199, False],
)


def main():
    n = int(raw_input())
    xs = [int(x) for x in raw_input().split()]

    others = 0
    for x in xs:
        for cond in conds:
            if cond[0](x):
                cond[1] = True
                break
        else:
            others += 1

    s = sum(1 for c, t in conds if t)

    print s if s else 1,
    print s + others


main()

Solution (Python):
N = int(input())
a = list(map(int,input().split()))
R = [0]*9
for r in a:
  rr = r//400
  if rr < 8:
    R[rr] = 1
  else:
    R[8] += 1
s2 = sum(R)
s1 = max(1,s2-R[8])
print(s1,s2)

Solution (Python):
def whichcolor(n):
	if n < 3200:
		return n / 400
	else:
		return 8

def countnotzero(lst):
	cnt = 0
	for i in range(0, len(lst)):
		if lst[i] != 0:
			cnt += 1
	return cnt

n = int(raw_input())
inpt = map(int, raw_input().split())

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

for i in range(0, n):
	c = whichcolor(inpt[i])
	if c == 8:
		almighty += 1
	else:
		color[c] += 1

nzro = countnotzero(color)
min = nzro
if min == 0:
	min = 1
max = nzro + almighty
print str(min) + ' ' + str(max)

Solution (Python):
N = int(input())
Rates = list(map(int, input().split()))
Colors = []
Rainbow = 0

for Rate in Rates:
    if Rate < 400:
        Colors.append("灰色")
    elif Rate < 800:
        Colors.append("茶色")
    elif Rate < 1200:
        Colors.append("緑色")
    elif Rate < 1600:
        Colors.append("水色")
    elif Rate < 2000:
        Colors.append("青色")
    elif Rate < 2400:
        Colors.append("黄色")
    elif Rate < 2800:
        Colors.append("橙色")
    elif Rate < 3200:
        Colors.append("赤色")
    else:
        Rainbow += 1

Color = set(Colors)
if len(Color) != 0:
    print(len(Color) , len(Color) + Rainbow)
else:
    print(1 , len(Color) + Rainbow)

Solution (Python):
import sys
from collections import defaultdict

def main():
    n = int(sys.stdin.readline())

    line = sys.stdin.readline()
    lst = line.split()

    cnt_dic = defaultdict(int)

    
    

    for ch in lst:
        rating = int(ch)
        n = rating // 400
        if n <= 7:
            cnt_dic[n] += 1
        else:
            cnt_dic[8] += 1

    ans_max = 0
    ans_min = 0
    for i in range(0,8):
        if cnt_dic[i] > 0:
            ans_max += 1
            ans_min += 1

    if cnt_dic[8] > 0:
        ans_max += cnt_dic[8]
        if ans_min == 0:
            ans_min += 1

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

if __name__ == '__main__':
    sys.exit(main())

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

a.sort()

minc=0
maxc=0

for i in range(1,9):
    if len([x for x in a if x<400*i and x>=400*(i-1)]):
        minc+=1

if minc:
    maxc = minc + len([x for x in a if x>=400*(9-1)])
else:
    maxc = len([x for x in a if x>=400*(9-1)])
    minc = 1

print(str(minc) + ' ' + str(maxc))

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
st = [0] * 10
extra = 0
for x in a:
    if x >= 3200:
        extra += 1
        continue
    for i in range(0, 2801, 400):
        if i <= x <= i + 399:
            st[i // 400] = 1
            break
ans = sum(st)
print(max(ans, 1), ans + extra)

Solution (Python):
n = int(raw_input())
rate = map(int, raw_input().split())
num = [0]*9

cunt = 0
for item in rate:
    if item < 3200:
        if item < 400:
            num[0] = 1
        elif item < 800:
            num[1] = 1
        elif item < 1200:
            num[2] = 1
        elif item < 1600:
            num[3] = 1
        elif item < 2000:
            num[4] = 1
        elif item < 2400:
            num[5] = 1
        elif item < 2800:
            num[6] = 1
        elif item < 3200:
            num[7] = 1
    else:
        num[8] += 1
if sum(num[:-1]) == 0:
    print 1, sum(num)
else:
    print sum(num[:-1]), sum(num)

Solution (Python):
N=int(input())
a=list(map(int,input().split()))
c=[0,0,0,0,0,0,0,0]
r=0
ans=0
for i in a:
    if i <400:
        c[0] += 1
    elif i>=400 and i<800:
        c[1] += 1
    elif i>=800 and i<1200:
        c[2] += 1
    elif i>=1200 and i<1600:
        c[3] += 1
    elif i>=1600 and i<2000:
        c[4] += 1
    elif i>=2000 and i<2400:
        c[5] += 1
    elif i>=2400 and i<2800:
        c[6] += 1
    elif i>=2800 and i<3200:
        c[7] += 1
    else:
        r += 1
for i in c:
    if i>0:
        ans += 1

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

Solution (Python):
dic={}
n=int(input())
data=list(map(int,input().split()))
ans=0
for i in range(n):
    if data[i]>3199:
        ans+=1
    elif data[i]//400 not in dic:
        dic[data[i]//400]=1
if len(dic)==0:
    print(1,ans)
else:
    print(len(dic),ans+len(dic))

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
d = {'gray': 0, 'green': 0, 'cyan': 0, 'red': 0, 'brown': 0, 'blue': 0, 'yellow': 0, 'orange': 0, 'above':0}
for i in a:
    if i <= 399:
        d['gray'] += 1
    elif i <=799:
        d['brown'] += 1
    elif i <= 1199:
        d['green'] += 1
    elif i <= 1599:
        d['cyan'] += 1
    elif i <= 1999:
        d['blue'] += 1
    elif i <= 2399:
        d['yellow'] += 1
    elif i <= 2799:
        d['orange'] += 1
    elif i <= 3199:
        d['red'] += 1
    else:
        d['above'] += 1
res1 = 0
res2 = 0
for i in d.items():
    if i[0] != 'above' and i[1] > 0:
        res1 += 1
        res2 += 1
print(max(1, res1), res2 + d['above'])

Solution (Python):

n = int(input())
a = list(map(int,input().split()))
arr = []
count = 0
for i in range(len(a)):
    if a[i] <= 3199:
        arr.append(a[i] // 400)
    else:
        count += 1
if len(set(arr)) != 0:
    print(len(set(arr)), len(set(arr)) + count,sep = ' ')
else:
    print(1, count,sep = ' ')

Solution (Python):
import math
n = int(input())
a = list(map(int,input().split(" ")))
pts = [0]*10
for p in a:
	ca = int(math.floor(p/400))
	if ca>7:
		ca = 8
	pts[ca] +=1
	
min = 0
for p in pts:
	if p>0:
		min+=1

if pts[8]>0:
	if min>1:
		min -=1
		max = min + pts[8]
	else:
		max = pts[8]
else:
	max = min


print(str(min)+" "+str(max))

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

l = [0] * 9
for i in a :
	l[min(i//400,8)] += 1

mn = 0
mx = 0
for i,j in enumerate(l) :
	if i < 8 :
		mn += min(1,j)
	else :
		mx = mn + j
print(max(mn,1), mx)

Solution (Python):
def color(x):
	if x < 400:
		return "grey"
	
	if x < 800:
		return "brown"

	if x < 1200:
		return "green"

	if x < 1600:
		return "cyan"

	if x < 2000:
		return "blue"

	if x < 2400:
		return "yellow"

	if x < 2800:
		return "orange"

	if x < 3200:
		return "red"

	return "x"

colors = ["grey", "brown", "green", "cyan", "blue", "yellow", "orange", "red"]
C = []

n = int(input())

c = 0

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

for a in A:
	if(color(a) == "x"):
		c += 1
	else:
		C.append(color(a))

C = list(set(C))

m = len(C) + c

if(len(C) == 0):
	C.append("x")

print("{} {}".format(len(C), m))