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):
import math
n = int(input())
lis = []
cou = 0
li = list(map(int,input().split()))
for i in range(n):
    if li[i] >= 3200:
        cou += 1
    else:
        if math.floor(li[i] // 400) not in lis:
            lis.append(li[i] // 400)
if len(lis) == 0:
    print(1,min(len(lis) + cou,8))
else:
    print(len(lis),min(n,len(lis) + cou))

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
s=set()
fr=0
for i in a:
  x=i//400
  if(x<8):s.add(x)
  else:fr+=1
ki=len(s)
ma=ki+fr
mi=max(ki,1)
print(mi,ma)

Solution (Python):
N=int(input())
a=[int(i)//400 for i in input().split()]
s=set()
r=0
for i in range(N):
    if a[i]>=8:
        r+=1
    else:
        s.add(a[i])
print("{0} {1}".format(max([1,len(s)]),len(s)+r))

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
ash=0
brown=0
green=0
lightblue=0
blue=0
yellow=0
orange=0
red=0
ans=0
for i in a:
    if i<=399:
        if ash==0:
            ash+=1
    elif 400<=i<=799:
        if brown==0:
            brown+=1
    elif 800<=i<=1199:
        if green==0:
            green+=1
    elif 1200<=i<=1599:
        if lightblue==0:
            lightblue+=1
    elif 1600<=i<=1999:
        if blue==0:
            blue+=1
    elif 2000<=i<=2399:
        if yellow==0:
            yellow+=1
    elif 2400<=i<=2799:
        if orange==0:
            orange+=1
    elif 2800<=i<=3199:
        if red==0:
            red+=1
    else:
        ans+=1
v=ash+brown+green+lightblue+blue+yellow+orange+red
if v==0:
    print(1,ans)
else:
    print(v,v+ans)

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

dic = {'gray':0,'brown':0,'green':0,'light blue':0,'blue':0,'yellow':0,'orange':0,'red':0}
more = 0
for a in A:
    if 399 >= a >= 1 :
        dic['gray'] += 1
    elif 799 >= a >= 400:
        dic['brown'] += 1
    elif 1199 >= a >= 800:
        dic['green'] += 1
    elif 1599 >= a >= 1200:
        dic['light blue'] += 1
    elif 1999 >= a >= 1600:
        dic['blue'] += 1
    elif 2399 >= a >= 2000:
        dic['yellow'] += 1
    elif 2799 >= a >= 2400:
        dic['orange'] += 1
    elif 3199 >= a >= 2800:
        dic['red'] += 1
    else:
        more += 1
        
cnt = 0        
for i in dic.keys():
    if dic[i] != 0:
        cnt += 1
if cnt != 0:
    c_max = cnt + more
    c_min = cnt
else:
    c_max = more
    c_min = min(1,more)
print(c_min,c_max)

Solution (Python):
import math
n=input()
a= [min(math.floor(int(i)//400),8) for i in input().split()]
a7= len(set([i for i in a if i<=7]))
a8= len([i for i in a if i==8])
print(max(a7,1),a7+a8)

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

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
ans=[]
anything=0
for i in range(n):
    if 1<=a[i]<=399:
        ans.append(1)
    elif 400<=a[i]<=799:
        ans.append(2)
    elif 800<=a[i]<=1199:
        ans.append(3)
    elif 1200<=a[i]<=1599:
        ans.append(4)
    elif 1600<=a[i]<=1999:
        ans.append(5)
    elif 2000<=a[i]<=2399:
        ans.append(6)
    elif 2400<=a[i]<=2799:
        ans.append(7)
    elif 2800<=a[i]<=3199:
        ans.append(8)
    elif 3200<=a[i]:
        anything+=1
ans_i=list(set(ans))
min_i=len(ans_i)
max_i=len(ans_i)+anything
if len(ans_i)==0 and 1<=anything:
    print(1,max_i)
else:
    print(min_i,max_i)

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
color=[]
count=int(0)
for i in range(9):
    color.append(0)
for i in range(n):
    if 1<=a[i]<400:
        color[0]+=1
    elif 400<=a[i]<800:
        color[1]+=1
    elif 800<=a[i]<1200:
        color[2]+=1
    elif 1200<=a[i]<1600:
        color[3]+=1
    elif 1600<=a[i]<2000:
        color[4]+=1
    elif 2000<=a[i]<2400:
        color[5]+=1
    elif 2400<=a[i]<2800:
        color[6]+=1
    elif 2800<=a[i]<3200:
        color[7]+=1
    elif 3200<=a[i]:
        color[8]+=1
for i in range(8):
    if color[i]!=0:
        count+=1
high=int(0)
low=int(0)
high=max(count,count+color[8])
if count>=1:
    low=count
elif count==0:
    low=1
print(low,high)

Solution (Python):
def solve():
    n = int(input())
    A = list(map(int, input().split(" ")))
    colors = [False] * 8
    meta = 0
    for a in A:
        if 1 <= a <= 399:
            colors[0] = True
        elif 400 <= a <= 799:
            colors[1] = True
        elif 800 <= a <= 1199:
            colors[2] = True
        elif 1200 <= a <= 1599:
            colors[3] = True
        elif 1600 <= a <= 1999:
            colors[4] = True
        elif 2000 <= a <= 2399:
            colors[5] = True
        elif 2400 <= a <= 2799:
            colors[6] = True
        elif 2800 <= a <= 3199:
            colors[7] = True
        else:
            meta += 1

    cnt = 0
    for c in colors:
        if c == True:
            cnt += 1

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


solve()

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

free = 0
arr = [0] * 8

for i in a:
	limit = 400
	while (limit <= 3200):
		if i < limit:
			arr[(limit // 400)-1] +=  1
			break
		else:
			limit += 400

	if limit== 3600:
		free += 1

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


print(str(max(1,color)) + " " + str(color + free))

Solution (Python):
def c_ColorfulLeaderboard(N, A):
    from collections import defaultdict
    color = defaultdict(int)
    other = 0  
    for a in A:
        if 1 <= a <= 399:
            color['gray'] += 1
        elif 400 <= a <= 799:
            color['brown'] += 1
        elif 800 <= a <= 1199:
            color['green'] += 1
        elif 1200 <= a <= 1599:
            color['skyblue'] += 1
        elif 1600 <= a <= 1999:
            color['blue'] += 1
        elif 2000 <= a <= 2399:
            color['yellow'] += 1
        elif 2400 <= a <= 2799:
            color['orange'] += 1
        elif 2800 <= a <= 3199:
            color['red'] += 1
        elif 3200 <= a:
            other += 1
    
    return '{} {}'.format(max(1, len(color)), len(color) + other)

N=int(input())
A=[int(i) for i in input().split()]
print(c_ColorfulLeaderboard(N, A))

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

min_cnt = set()
max_cnt = set()

rename = -1
for x in xs:
    if x >= 3200:
        max_cnt.add(rename)
        rename -= 1
    else:
        max_cnt.add(x//400)
        min_cnt.add(x//400)

print(max(1, len(min_cnt)), len(max_cnt))

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

for i in range(N):
    if P[i] >= 3200:
        color[8] += 1
    elif 3200 > P[i] >= 2800:
        color[7] += 1
    elif 2800 > P[i] >= 2400:
        color[6] += 1
    elif 2400 > P[i] >= 2000:
        color[5] += 1
    elif 2000 > P[i] >= 1600:
        color[4] += 1
    elif 1600 > P[i] >= 1200:
        color[3] += 1
    elif 1200 > P[i] >= 800:
        color[2] += 1
    elif 800 > P[i] >= 400:
        color[1] += 1
    elif 400 > P[i]:
        color[0] += 1

if color[8] != 0 and color.count(0) == 8:
    ans1 = 1
    ans2 = color[8]
elif color[8] == 0:
    ans1 = 9 - color.count(0)
    ans2 = ans1 + color[8]
else:
    ans1 = 9 - color.count(0) - 1
    ans2 = ans1 + color[8]

print(ans1, ans2)

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

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

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

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

if K>0:
    print(K,K+T[8])
else:
    print(1,T[8])

Solution (Python):
n = int(input())
l = list(map(int, input().split()))
found = set()
f = 0
for i in l:
  if i <= 399:
    found.add("灰色")
  elif i <= 799:
    found.add("茶色")
  elif i <= 1199:
    found.add("緑色")
  elif i <= 1599:
    found.add("水色")
  elif i <= 1999:
    found.add("青色")
  elif i <= 2399:
    found.add("黄色")
  elif i <= 2799:
    found.add("橙色")
  elif i <= 3199:
    found.add("赤色")
  else:
    f += 1
if len(found) == 0:
  print(1, min(f, 8))
else:
  print(len(found), len(found) + f)

Solution (Python):
ignore = input()
l = map(int, raw_input().split())
temp = []
counter = 0
if ignore == 1:
    print 1, 1
    exit()
for i in range(len(l)):
    if (1 <= l[i] <= 399) and ("Grey" not in temp):
        temp.append("Grey")
    elif (400 <= l[i] <= 799) and ("Brown" not in temp):
        temp.append("Brown")
    elif (800 <= l[i] <= 1199) and ("Green" not in temp):
        temp.append("Green")
    elif (1200 <= l[i] <= 1599) and ("Water" not in temp):
        temp.append("Water")
    elif (1600 <= l[i] <= 1999) and ("Blue" not in temp):
        temp.append("Blue")
    elif (2000 <= l[i] <= 2399) and ("Yellow" not in temp):
        temp.append("Yellow")
    elif (2400 <= l[i] <= 2799) and ("Turq" not in temp):
        temp.append("Turq")
    elif (2800 <= l[i] <= 3199) and ("Red" not in temp):
        temp.append("Red")
    elif (l[i] >= 3200):
        counter+=1
if counter == 0:
    print len(temp), len(temp)
elif len(temp) == 0:
    print 1 , (len(temp) + counter)
else:
    print len(temp), (len(temp) + counter)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
con = 0
var = 0
count = [1, 1, 1, 1, 1, 1, 1, 1]

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

if(con > 0):
    print(con, con+var)
else:
    print(1, var)

Solution (Python):
N = int(input())
a = list(map(int,input().split()))
ans = set()
other = 0
 
for i in a:
    if i <400:
        ans.add("gray")
    elif i <800:
        ans.add("green")
    elif i < 1200:
        ans.add("brown")
    elif i <1600:
        ans.add("light_blue")
    elif i<2000:
        ans.add("blue")
    elif i<2400:
        ans.add("yellow")
    elif i <2800:
        ans.add("orange")
    elif i <3200:
        ans.add("red")
    else:
        other += 1
 
color = len(ans)
if other == N:
    print(1," ",min(other,8))
else:
    print(color, " " ,min(N,color +other))

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

color=[0]*9

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

label=0
for i in range(8):
	label += color[i]

minres = max(label,1)
maxres = label + color[8]

print(minres, maxres)

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

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

    return label

label = labeling(A)
label_number = 0

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

print(max(label_number, 1), min(100000000000, (label_number+label[-1])))

Solution (Python):
from sys import stdin, stdout


def readLine_int_list(): return list(map(int, stdin.readline().split()))


def main():
    n = input()
    a = readLine_int_list()

    c = []
    _c = []

    for i in a:
        rank = i // 400
        if rank > 7:
            _c.append(rank)
        else:
            c.append(rank)

    p = len(set(c))
    print(max(1, p), p + len(_c))


if __name__ == "__main__":
    main()

Solution (Python):
from collections import Counter
N = int(input())
a = Counter([min(int(ai) // 400, 8) for ai in input().split()])
tmp = sum(bool(a[i]) for i in range(8))
print(max(1, tmp), tmp + a[8])

Solution (Python):



from collections import defaultdict
from math import factorial as f
from fractions import gcd as g

N = int (raw_input ())
l = [int (i) for i in raw_input ().split ()]

d = defaultdict (int)
c = 0
for i in l:
    if i < 400: d ["gray"] += 1
    elif i < 800: d ["brown"] += 1
    elif i < 1200: d ["green"] += 1
    elif i < 1600: d ["cyan"] += 1
    elif i < 2000: d ["blue"] += 1
    elif i < 2400: d ["yellow"] += 1
    elif i < 2800: d ["orange"] += 1
    elif i < 3200: d ["red"] += 1
    else: c += 1

print max (1, len (d.keys ())), len (d.keys ()) + c

Solution (Python):
n = int(input())
aa = [min(8, int(a) // 400) for a in input().split()]
over3200 = aa.count(8)
colors = len(set(aa))
_min = colors - 1 if over3200 and n > over3200 else colors
_max = colors + over3200 - 1 if over3200 else colors
print(_min, _max)

Solution (Python):
from sys import stdin, stdout
def readLine_int_list():return list(map(int, stdin.readline().split()))


def main():
    n = input()
    a = readLine_int_list()

    c = []
    _c = [] 

    for i in a:
        rank = i//400
        if rank > 7:
           _c.append(rank) 
        else:    
            c.append(rank)
    
    
    p = len(set(c))
    print(max(1,p), p+len(_c))

        
if __name__ == "__main__":
    main()

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

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

ret = 0
for i in range(len(border) - 1):
    if len(list(filter(lambda n: border[i] <= n < border[i + 1], A))) > 0:
        ret += 1
print(max(1, ret), ret + len(list(filter(lambda n: 3200 <= n, A))))

Solution (Python):
N = int(input())
a = list(map(int,input().split()))
ans = set()
other = 0

for i in a:
    if i <400:
        ans.add("gray")
    elif i <800:
        ans.add("green")
    elif i < 1200:
        ans.add("brown")
    elif i <1600:
        ans.add("light_blue")
    elif i<2000:
        ans.add("blue")
    elif i<2400:
        ans.add("yellow")
    elif i <2800:
        ans.add("orange")
    elif i <3200:
        ans.add("red")
    else:
        other += 1

color = len(ans)
if other == N:
    print(1," ",min(other,8))
else:
    print(color, " " ,min(N,color +other))

Solution (Python):
n = input()
a = map(int, raw_input().split())
color = [0 for _ in range(9)]
for item in a:
    i = item / 400
    i = min(i, 8)
    color[i] += 1

ans = 0
for num in color[0:8]:
    if num != 0:
        ans += 1

min_ans = max(ans, 1)
max_ans = ans + color[8]


print min_ans, max_ans

Solution (Python):

"""
http://abc064.contest.atcoder.jp/tasks/abc064_c

"""
import sys
from sys import stdin
from collections import defaultdict
input = stdin.readline


def get_color(s):
    ans = 'any'
    if s < 400:
        ans = 'gray'
    elif s < 800:
        ans = 'brown'
    elif s < 1200:
        ans = 'green'
    elif s < 1600:
        ans = 'light blue'
    elif s < 2000:
        ans = 'blue'
    elif s < 2400:
        ans = 'yellow'
    elif s < 2800:
        ans = 'orange'
    elif s < 3200:
        ans = 'red'
    return ans


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

    colors = defaultdict(int)
    for s in scores:
        res = get_color(s)
        colors[res] += 1

    normal_color = 0
    for k, v in colors.items():
        if k != 'any':
            normal_color += 1
    any_color = colors['any']

    print(max(1, normal_color), normal_color + any_color)


if __name__ == '__main__':
    main(sys.argv[1:])

Solution (Python):
b = {}
b['gray'] = 0
b['brown'] = 0
b['green'] = 0
b['cyan'] = 0
b['blue'] = 0
b['yellow'] = 0
b['orange'] = 0
b['red'] = 0
b['other'] = 0

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

for ai in a:
    if ai < 400:
        b['gray'] += 1
    elif ai < 800:
        b['brown'] += 1
    elif ai < 1200:
        b['green'] += 1
    elif ai < 1600:
        b['cyan'] += 1
    elif ai < 2000:
        b['blue'] += 1
    elif ai < 2400:
        b['yellow'] += 1
    elif ai < 2800:
        b['orange'] += 1
    elif ai < 3200:
        b['red'] += 1
    else:
        b['other'] += 1

ans = 0
for k, v in b.items():
    if k != 'other' and v > 0:
        ans += 1

if ans == 0:
    print(1, b['other'])
else:
    print(ans, ans + b['other'])

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

rating = [0 for i in range(9)]
for aa in a:
    if aa <= 3199:
        rating[aa // 400] += 1
    else:
        rating[8] += 1

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

ans_max = ans_min + rating[8]

ans_min = max(ans_min, 1)

print(ans_min, ans_max)

Solution (Python):
N = int(input())
a = [int(i) for i in input().split()]
rank = [0]*9
ans = [0]*2
for i in range(len(a)):
    if a[i] < 400:
        rank[0] = 1
    elif a[i] < 800:
        rank[1] = 1
    elif a[i] < 1200:
        rank[2] = 1
    elif a[i] < 1600:
        rank[3] = 1
    elif a[i] < 2000:
        rank[4] = 1
    elif a[i] < 2400:
        rank[5] = 1
    elif a[i] < 2800:
        rank[6] = 1
    elif a[i] < 3200:
        rank[7] = 1
    else:
        rank[8] += 1
ans[0] = sum(rank)

if sum(rank[:8]) == 0:
    ans[1] = 1
else:
    ans[1] = sum(rank[:8])

[print(ans[i], end=' ') for i in reversed(range(len(ans)))]

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

l = [0] * 9
for i in a:
    if i <= 399:
        l[0]=1
    elif i<=799:
        l[1]=1
    elif i<=1199:
        l[2]=1
    elif i<=1599:
        l[3]=1
    elif i<=1999:
        l[4]=1
    elif i<=2399:
        l[5]=1
    elif i<=2799:
        l[6]=1
    elif i<=3199:
        l[7]=1
    else:
        l[8] += 1
if sum(l[:8])==0:
    print(1, l[8])
else:
    print(sum(l[:8]), sum(l))

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

b = 0
c = set()
for i in range(n):
    if a[i] > 7:
        b += 1
    else:
        c.add(a[i])

print(max(1, len(c)), len(c)+b)

Solution (Python):
n=int(input())
pr=list(map(int,input().split()))
rate_color=[]
suge=0
for i in range(n):
    if pr[i]>=3200:
        suge+=1
pr=[x for x in pr if x<=3199]

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

for i in range(len(pr)):
    x=pr[i]
    rate_color+=cl(x)
color=list(set(rate_color))
color_num=len(color)


max_num=color_num+suge
if color_num==0:
    mini_num=1
else:
    mini_num=color_num
print(mini_num,max_num)

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

sep = 400
flag = [False]*8
c = 0
for a in A:
    s = a//sep
    if s >= 8:
        c += 1
    else:
        flag[s] = True

min = flag.count(True)
max = min + c
if min == 0:
    min = 1
print("{0} {1}".format(min,max))

Solution (Python):
def main():
    n = input()
    a_list = [int(i) for i in input().split()]

    rate_list = [0 for i in range(9)]

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

    if 1 in rate_list[:-1]: minv = sum(rate_list[:-1])
    else: minv = 1

    print("{} {}".format(minv, sum(rate_list)))
    

if __name__ == "__main__":
    main()

Solution (Python):
N=int(input())
a_n=[int(x) for x in input().split()]
import sys

r=[]
r.append([i for i in a_n if 1<=i<=399])
r.append([i for i in a_n if 400<=i<=799])
r.append([i for i in a_n if 800<=i<=1199])
r.append([i for i in a_n if 1200<=i<=1599])
r.append([i for i in a_n if 1600<=i<=1999])
r.append([i for i in a_n if 2000<=i<=2399])
r.append([i for i in a_n if 2400<=i<=2799])
r.append([i for i in a_n if 2800<=i<=3199])
R=[i for i in a_n if 3200<=i]

count=0
for i in range(len(r)):
    if r[i]:
        count+=1
if count==0:
    count+=1
    print(str(count), str((count-1) + len(R)))
    sys.exit()

print(str(count), str(count+len(R)))

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

color_list = []
anycolor = 0
for rate in a:
    if(rate >= 3200):
        anycolor+=1
        continue
    color = rate // 400
    if(color not in color_list):
        color_list.append(color)

minc = max(1, len(color_list))
maxc = len(color_list) + anycolor

print(minc, maxc)

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

if num[8] == 0:
    maximum = sum(num[0:8])
    minimum = sum(num[0:8])
else:
    if num[8] == N:
        maximum = N
        minimum = 1
    else:
        maximum = sum(num[0:8]) + num[8]
        minimum = sum(num[0:8])

print(minimum, maximum)

Solution (Python):
n = int(input())
lst0 = list(map(int, input().split()))
lst1 = [0, 0, 0, 0, 0, 0, 0, 0]
god = 0
Mx, Mn = (0, 0)
for i in range(n):
    if 1 <= lst0[i] <= 399:
        lst1[0] += 1
    elif 400 <= lst0[i] <= 799:
        lst1[1] += 1
    elif 800 <= lst0[i] <= 1199:
        lst1[2] += 1
    elif 1200 <= lst0[i] <= 1599:
        lst1[3] += 1
    elif 1600 <= lst0[i] <= 1999:
        lst1[4] += 1
    elif 2000 <= lst0[i] <= 2399:
        lst1[5] += 1
    elif 2400 <= lst0[i] <= 2799:
        lst1[6] += 1
    elif 2800 <= lst0[i] <= 3199:
        lst1[7] += 1
    else:
        god += 1

Mn = 8 - lst1.count(0)
Mx = Mn + god
if Mn==0:
    Mn = 1
print(str(Mn) + " " + str(Mx))

Solution (Python):
import collections

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

cnt = collections.defaultdict(lambda: 0)
for i in range(N):
    if a[i] <= 399:
        cnt['gray'] += 1
    elif a[i] <= 799:
        cnt['brown'] += 1
    elif a[i] <= 1199:
        cnt['green'] += 1
    elif a[i] <= 1599:
        cnt['sky'] += 1
    elif a[i] <= 1999:
        cnt['blue'] +=1
    elif a[i] <= 2399:
        cnt['yellow'] += 1
    elif a[i] <= 2799:
        cnt['orange'] +=1
    elif a[i] <= 3199:
        cnt['red'] += 1
    else:
        cnt['any'] += 1

key = cnt.keys()
if 'any' in key:
    color_type = len(key) - 1
else:
    color_type = len(key)
    
color_sum = 0

for each in key:
    if each != 'any':
        color_sum += cnt[each]
        
any_sum = N - color_sum

max_type = any_sum + color_type

if color_type == 0:
    min_type = 1
else:
    min_type = color_type

print(min_type, max_type)

Solution (Python):



import sys
from collections import deque

n = int(sys.stdin.readline())
ai = list(map(int, sys.stdin.readline().split()))

o = [0] * 9

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

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

min = on
if min == 0:
	min = 1

on += o[8]

max = on

print(str(min) + ' ' + str(max))

Solution (Python):
z = input()
cs = [ int(x) for x in input().split() ]
ar = [ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
up = 0
mn = 0
mx = 0

for x in cs :
  if x < 400 :
    ar[0] = 1
  elif x < 800 :
    ar[1] = 1
  elif x < 1200 :
    ar[2] = 1
  elif x < 1600 :
    ar[3] = 1
  elif x < 2000 :
    ar[4] = 1
  elif x < 2400 :
    ar[5] = 1
  elif x < 2800 :
    ar[6] = 1
  elif x < 3200 :
    ar[7] = 1
  else :
    up = up + 1

if sum(ar) == 0 :
  mn = 1
  mx = up
else :
  mn = sum(ar)
  mx = sum(ar) + up

print(str(mn) + " " + str(mx))

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

Solution (Python):
N=int(input())
a=[int(i) for i in input().split()]
b,c,d,e,f,g,h,j,k=0,0,0,0,0,0,0,0,0
for i in range(N):
 if (a[i]<400):
  b=1
 elif (400<=a[i]<800):
  c=1
 elif (800<=a[i]<1200):
  d=1
 elif (1200<=a[i]<1600):
  e=1
 elif (1600<=a[i]<2000):
  f=1
 elif (2000<=a[i]<2400):
  g=1
 elif (2400<=a[i]<2800):
  h=1
 elif (2800<=a[i]<3200):
  j=1
 else:
  k += 1
min=b+c+d+e+f+g+h+j
max=min+k
if min==0:
 min=1
print (min,max)

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

c=[0 for i in xrange(8)]
ext=0
for x in a:
 if 1<=x<=399:
  c[0]=1
 elif 400<=x<=799:
  c[1]=1
 elif 800<=x<=1199:
  c[2]=1
 elif 1200<=x<=1599:
  c[3]+=1
 elif 1600<=x<=1999:
  c[4]=1
 elif 2000<=x<=2399:
  c[5]=1
 elif 2400<=x<=2799:
  c[6]=1
 elif 2800<=x<=3199:
  c[7]=1
 else:
  ext+=1
res1=8-c.count(0)+ext
res2=res1-ext
if res2==0:
 res2=1
print res2,res1

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

colors=[]
if list(filter(lambda x:x<3200, a)):
    f=lambda x:x<400
    colors.append(1 if list(filter(f, a)) else 0)
    f=lambda x:400<=x<800
    colors.append(1 if list(filter(f, a)) else 0)
    f=lambda x:800<=x<1200
    colors.append(1 if list(filter(f, a)) else 0)
    f=lambda x:1200<=x<1600
    colors.append(1 if list(filter(f, a)) else 0)
    f=lambda x:1600<=x<2000
    colors.append(1 if list(filter(f, a)) else 0)
    f=lambda x:2000<=x<2400
    colors.append(1 if list(filter(f, a)) else 0)
    f=lambda x:2400<=x<2800
    colors.append(1 if list(filter(f, a)) else 0)
    f=lambda x:2800<=x<3200
    colors.append(1 if list(filter(f, a)) else 0)

    print(sum(colors), sum(colors)+len(list(filter(lambda x:3200<=x, a))))

else:
    print(1, n)

Solution (Python):
from collections import defaultdict


def main():
    N = int(input())
    a_list = list(map(int, input().split()))
    color_set = set()
    free = 0
    for a in a_list:
        for i, (s, e) in enumerate([(1, 399), (400, 799), (800, 1199), (1200, 1599), (1600, 1999), (2000, 2399), (2400, 2799), (2800, 3199)]):
            if s <= a <= e:
                color_set.add(i)
                break
        else:
            free += 1
    print(max(1, len(color_set)), len(color_set) + free)


if __name__ == '__main__':
    main()

Solution (Python):
N = int(input())
a = [int(i) for i in input().split()]
hai,cha,mid,miz,ao,ki,dai,aka,zen = 0,0,0,0,0,0,0,0,0
for i in range(N):
    if a[i] < 400:
        hai = 1
    elif a[i] < 800:
        cha = 1
    elif a[i] < 1200:
        mid = 1
    elif a[i] < 1600:
        miz = 1
    elif a[i] < 2000:
        ao = 1
    elif a[i] < 2400:
        ki = 1
    elif a[i] < 2800:
        dai = 1
    elif a[i] < 3200:
        aka = 1
    else:
        zen += 1
Min = hai+cha+mid+miz+ao+ki+dai+aka
Max = Min+zen
if Min == 0:
    Min = 1
print(Min,Max)

Solution (Python):
input_line_1 = raw_input()
input_line_2 = raw_input()

array = []
count_2 = 0
for i in input_line_2.split(" "):
	point = int(i)/400
	if point < 8:
		if point not in array:
			array.append(point)
	else:
		count_2 += 1

max_point = len(array) + count_2
min_pount = max(len(array), 1)

print min_pount, " ", max_point

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

c = [0, 0, 0, 0, 0, 0, 0, 0, 0]

for rate in a:
    if (rate >= 1) and (400 > rate):
        c[0] += 1
    elif (rate >= 400) and (800 > rate):
        c[1] += 1
    elif (rate >= 800) and (1200 > rate):
        c[2] += 1
    elif (rate >= 1200) and (1600 > rate):
        c[3] += 1
    elif (rate >= 1600) and (2000 > rate):
        c[4] += 1
    elif (rate >= 2000) and (2400 > rate):
        c[5] += 1
    elif (rate >= 2400) and (2800 > rate):
        c[6] += 1
    elif (rate >= 2800) and (3200 > rate):
        c[7] += 1
    else:
        c[8] += 1
        
color_rigid = len([i for i, e in enumerate(c[:8]) if e != 0])

print ("%d %d"%(max(1, color_rigid), color_rigid + c[8]))

Solution (Python):
n = int(input())
a = map(int, input().split())
l = [0 for i in range(9)]

for i in a:
    if i // 400 >= 8:
        l[8] += 1
    else:
        l[i // 400] = 1
print(max(1, sum(l[:8])), sum(l))