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 collections

def color(r):
    for i, (p, q) in enumerate([
            (1, 399),
            (400, 799),
            (800, 1199),
            (1200, 1599),
            (1600, 1999),
            (2000, 2399),
            (2400, 2799),
            (2800, 3199),
            (3200, 4800)
    ]):
        if p <= r <= q:
            return i

input()
a = collections.Counter([color(int(x)) for x in input().split()])
m = len(a) - (1 if 8 in a and len(a) > 1 else 0)
print(m, m + a[8] - (1 if 8 in a and len(a) == 1 else 0))

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

Solution (Python):
'''
    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
'''
b = [0, 400, 800, 1200, 1600, 2000, 2400, 2800, 3200]
u = [0] * 8
import sys
n = map(int, sys.stdin.readline().split())
a = map(int, sys.stdin.readline().split())
res = 1
target = 0
for c in a:
  for i in range (len(b) - 1):
    if b[i] <= c < b[i+1]:
      u[i] = 1
  if c >= 3200:
    target += 1
print max(1, sum(u)), sum(u) + target

Solution (Python):
input()
a = map(int, raw_input().split())
S = set()
c = 0
for t in a:
    if t>=3200:
        c += 1
    else:
        S.add(t/400)
print max(1, len(S)), len(S)+c

Solution (Python):
rates = [400, 800, 1200, 1600, 2000, 2400, 2800, 3200]
n = input()
A = map(int, raw_input().split())
cnts = [0]*9
for a in A:
    for i, r in enumerate(rates):
        if a < r:
            cnts[i] = 1
            break
    else:
        cnts[-1] += 1
mi = max(sum(cnts[:-1]), 1)
ma = sum(cnts)
print mi, ma

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
a.sort()
cnt = [0 for i in range(100)]
for i in range(n):
    cnt[a[i]//400] += 1
mi = max(1, sum([1 if cnt[i]>0 else 0 for i in range(8)]))
ma = sum([1 if cnt[i]>0 else 0 for i in range(8)]) + sum(cnt[8:])
print(mi, ma)

Solution (Python):
from collections import defaultdict

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

s=defaultdict(int)
wild=0
for x in a:
    if x>=3200:
        wild+=1
    else:
        s[x//400]+=1

mn=len(s)+(len(s)==0)
mx=len(s)+wild

print(mn,mx)

Solution (Python):
pts = [
    399,
    799,
    1199,
    1599,
    1999,
    2399,
    2799,
    3199,
]
n = int(raw_input())

a = [int(_) for _ in raw_input().split()]
m = 0
d = {}
for ai in a:
    for p in pts:
        if ai <= p:
            d[p] = True
            break
    else:
        m += 1

l = len(d)
print max(l, 1), l + m

Solution (Python):
N = input()
A = map(int, raw_input().split())
A.sort()
cnt = [0 for _ in xrange(9)]
for a in A:
    cnt[min(a/400, 8)] += 1

m = 0
for c in cnt[:-1]:
    if c > 0:
        m += 1
if m == 0 and cnt[:-1] > 0:
    print 1, cnt[-1]
else:
    print m, m + cnt[-1]

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

def color(a):
    if a < 400:
        return 1
    elif a < 800:
        return 2
    elif a < 1200:
        return 3
    elif a < 1600:
        return 4
    elif a < 2000:
        return 5
    elif a < 2400:
        return 6
    elif a < 2800:
        return 7
    elif a < 3200:
        return 8
    else:
        return 0

freq = [0] * 9
for a in As:
    freq[color(a)] += 1

cum = 0
for c in freq[1:]:
    if c: cum += 1
an = freq[0]

if cum == 0:
    print(1, an)
else:
    print(cum, cum + an)

Solution (Python):
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

n = ni()
a = na()
f = [0]*8
sp = 0
for v in a:
    if v >= 3200:
        sp += 1
    else:
        f[v//400] = 1
if sum(f) > 0:
    print("{} {}".format(sum(f), sum(f)+sp))
else:
    print("{} {}".format(sum(f)+min(sp,1), sum(f)+sp))