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 sys
input = sys.stdin.readline

import math

import bisect
from collections import defaultdict
from collections import deque
from functools import lru_cache






MOD = 10**9+7
INF = float('inf')






def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]


def P(arg): print(arg); return
def Y(): print("Yes"); return
def N(): print("No"); return
def E(): exit()
def PE(arg): print(arg); exit()
def YE(): print("Yes"); exit()
def NE(): print("No"); exit()


def DD(arg): return defaultdict(arg)



def inv(n): return pow(n, MOD-2, MOD)


kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret


def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr


def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors


def lcm(a, b):
    return a * b // gcd (a, b)


def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count


def base_10_to_n(X, n):
  if X//n:
    return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i])*n**i for i in range(len(str(X))))


def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count





N = I()
A = IL()

d = DD(int)
c = 0
for a in A:
  if a<400:
    d["grey"] |= 1
  elif a<800:
    d["gresadfy"] |= 1
  elif a<1200:
    d["greasdfasy"] |= 1
  elif a<1600:
    d["gasdgasegarey"] |= 1
  elif a<2000:
    d["gkusakusabokusa"] |= 1
  elif a<2400:
    d["grasgawefawegaey"] |= 1
  elif a<2800:
    d["grawefasdfasdghaey"] |= 1
  elif a<3200:
    d["greawefawdgawefasdfy"] |= 1
  else:
    c += 1
keys = [k for k in d]
s  = sum(d[k] for k in keys)
print(max(1,s),s+c)

Solution (Python):
import sys

readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

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

from collections import defaultdict
d = defaultdict(int)

s = set()
extra = 0
for a in A:
    if a >= 3200:
        extra += 1
    else:
        div = a // 400
        s.add(div)

min_ans = max(1, len(s))
max_ans = len(s) + extra
print(min_ans, max_ans)

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

color = [0] * 8
ans = 0

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

print(sum(color) if sum(color) > 0 else 1, sum(color) + ans)

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

for i in result:
    if i != 0:
        count += 1

Max = count + overColor

if count == 0:
    count = 1
    Max = overColor

print(count, Max)

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

ald = list(map(lambda x : x // 400,al))

allow = list(filter(lambda x: x<8, ald))
reslow = len(set(allow))

alhigh= list(filter(lambda x: x>=8,ald))
reshigh = len(alhigh)

resl = max(reslow,1)
resh = reslow+reshigh
print(resl,resh)

Solution (Python):
l = int(input())
m = input().split()

x = []
z = 0
c = 0

for i in range(l):
    if int(m[i]) < 3200:
        y = int(int(m[i]) / 400)
        if y not in x:
            x.append(y)
            z += 1
    elif int(m[i]) >= 3200:
        c += 1
        
if c == 0:
    print(str(z) + " " + str(z))
elif c > 0 and z > 0:
    z2 = c + z
    print(str(z) + " " + str(z2))
elif z == 0:
    print("1" + " " + str(c))

Solution (Python):
def judge_color(n):
  if 1 <= n <= 399:
    return "gray"
  elif 400 <= n <= 799:
    return "brown"
  elif 800 <= n <= 1199:
    return "green"
  elif 1200 <= n <= 1599:
    return "sky"
  elif 1600 <= n <= 1999:
    return "blue"
  elif 2000 <= n <= 2399:
    return "yellow"
  elif 2400 <= n <= 2799:
    return "orange"
  elif 2800 <= n <= 3199:
    return "red"
  else:
    return "free"

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

d = {}
for each in a:
  color = judge_color(each)
  d[color] = d.get(color, 0) + 1
  
c = d.get("free",0)
l = len(d)
if c == 0:
  print(l, l)
else:
  print(max(l-1,1), l-1+c)

Solution (Python):
N = int(input())
a = list(map(lambda x: int(x) // 400, input().split()))
s_a = []
over = 0

for i in range(N):
    if a[i] <= 7:
        s_a.append(a[i])
    else:
        over += 1

if len(s_a) == 0:
    min = 1
else:
    min = len(set(s_a))

max = len(set(s_a)) + over

print(min, max)

Solution (Python):
N = int(input())
a = list(map(lambda x: int(x) // 400, input().split()))
s_a = []
b_a = []

for i in range(N):
    if a[i] <= 7:
        s_a.append(a[i])
    else:
        b_a.append(a[i])

if len(s_a) == 0:
    min = 1
else:
    min = len(set(s_a))


max = len(set(s_a)) + len(b_a)


print(min, max)

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

rate=[0]*8
cl_all=0
for cl in a:
  if cl >=3200:
    cl_all+=1
    continue
  
  rate[cl//400]=1

if sum(rate)==0:
  print(1,cl_all)
else:
  print(sum(rate),sum(rate)+cl_all)

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

memo = {1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0}
over = 0

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

default_color = 0
for key in memo:
    default_color += memo[key]

if default_color > 0:
    print(default_color, default_color+over)
else:
    print(1, over)

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

lv = list()
l9 = list()

for i in range(N):
    if 1 <= la[i] <= 399:
        if 1 not in lv:
            lv.append(1)
    if 400 <= la[i] <= 799:
        if 2 not in lv:
            lv.append(2)
    if 800 <= la[i] <= 1199:
        if 3 not in lv:
            lv.append(3)
    if 1200 <= la[i] <= 1599:
        if 4 not in lv:
            lv.append(4)
    if 1600 <= la[i] <= 1999:
        if 5 not in lv:
            lv.append(5)
    if 2000 <= la[i] <= 2399:
        if 6 not in lv:
            lv.append(6)
    if 2400 <= la[i] <= 2799:
        if 7 not in lv:
            lv.append(7)
    if 2800 <= la[i] <= 3199:
        if 8 not in lv:
            lv.append(8)
    if la[i] >= 3200:
        l9.append(9)

print(max(len(lv), 1), len(lv)+len(l9))

Solution (Python):
def inp():
    return(int(input()))


def invr():
    return(map(int, input().split()))


n = inp()

ratings = invr()

flags = [0]*8
c = 0
a = 0
for r in ratings:
    if r >= 1 and r < 400 and flags[0] == 0:
        c += 1
        flags[0] = 1
    if r >= 400 and r < 800 and flags[1] == 0:
        c += 1
        flags[1] = 1
    if r >= 800 and r < 1200 and flags[2] == 0:
        c += 1
        flags[2] = 1
    if r >= 1200 and r < 1600 and flags[3] == 0:
        c += 1
        flags[3] = 1
    if r >= 1600 and r < 2000 and flags[4] == 0:
        c += 1
        flags[4] = 1
    if r >= 2000 and r < 2400 and flags[5] == 0:

        c += 1
        flags[5] = 1
    if r >= 2400 and r < 2800 and flags[6] == 0:
        c += 1
        flags[6] = 1
    if r >= 2800 and r < 3200 and flags[7] == 0:
        c += 1
        flags[7] = 1
    if r >= 3200:
        a += 1
if c == 0:
    print(1, a)
else:
    print(c, c+a)

Solution (Python):

_ = input()
a = list(map(int, input().split()))
rank_set={x//400 for x in a if x < 3200}
cnt_over3200=len(list(filter(lambda x: x>=3200, a)))
ans=len(rank_set)
if ans == 0:
    print('{} {}'.format(1, cnt_over3200))
else:
    print('{} {}'.format(ans, ans+cnt_over3200))

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

Solution (Python):

import sys

def f(r):
    '''
    >>> f(399)
    0
    >>> f(400)
    1
    >>> f(401)
    1
    >>> f(3200)
    8
    >>> f(3201)
    8
    '''
    from bisect import bisect
    R = [400, 800, 1200, 1600, 2000, 2400, 2800, 3200]
    return bisect(R, r)

def solve(N: int, a: "List[int]"):
    '''
    >>> solve(1, [399])
    (1, 1)
    >>> solve(1, [3200])
    (1, 1)
    >>> solve(1, [399, 388])
    (1, 1)
    >>> solve(1, [399, 3200])
    (1, 2)
    >>> solve(1, [399, 3200, 3200, 3400])
    (1, 4)
    >>> solve(1, [399, 400, 3200, 3200, 3400])
    (2, 5)
    >>> solve(1, [399, 400, 800, 1200, 1600, 2000, 2400, 3200, 3200, 3400])
    (7, 10)
    '''
    from collections import Counter
    b = tuple(map(f, a))
    c = Counter(b)
    return max(1, len(c)-(1 if c[8] else 0)), len(c)+(c[8]-1 if c[8] else 0)



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    a = [int(next(tokens)) for _ in range(N)]  
    print(*solve(N, a))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    test()
    main()

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

L = set()
cnt = 0
for a in A:
    c = a//400
    if c >= 8:
        cnt += 1
    else:
        L.add(a//400)
if len(L) == 0:
    print(1,cnt)
else:
    print(len(L),len(L)+cnt)

Solution (Python):
import numpy as np

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

a = np.bincount(a//400)

fixed = np.where(a[:8]>0)[0].shape[0]
colorful = a[8:].sum()

if fixed==0:
    fixed = 1
    colorful -= 1

print(fixed, fixed+colorful)

Solution (Python):




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

color_list = [0]*8
over = 0
for i in range(n):
    _ = a_list[i] // 400
    if _ < 8:
        color_list[_] = 1
    else:
        over += 1

_tmp = sum(color_list)
if _tmp == 0:
    print("1 %d"%over)
else:
    print("%d %d"%(_tmp, _tmp+over))

Solution (Python):



import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

n=I()
lis=LI()
dic=[0 for i in range(9)]
for i in range(n):
    if lis[i]//400>=8:
        dic[8]+=1
    else:
        if dic[lis[i]//400]==0:
            dic[lis[i]//400]=1
        


if sum(dic[0:8])==0:
    mn=1
    mx=dic[-1]
else:
    mn=sum(dic[0:8])
    mx=sum(dic[0:8])+dic[-1]
print(mn,mx)

Solution (Python):

N = int(input())
from collections import Counter
def get_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 999

A = [get_color(int(j)) for j in input().split()]
C_A = Counter(A)

if set(A)=={999}:
    print(1,len(A))
elif C_A[999]>0:
    print(len(set(A))-1,len(set(A))-1+C_A[999])
else:
    print(min(len(set(A)),8),min(len(set(A)),8))

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

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

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

x = [0]*9

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




res = sum(x[:-1])

if res > 0:
    print("{} ".format(res),end="")
else:
    if x[8] == 0:
        print("0 ")
    else:
        print("1 ")

print(res+x[8])

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

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
l = [False]*8
ov = 0

for i in range(n):
    if a[i] < 3200:
        l[a[i]//400] = True
    else:
        ov += 1

ans = l.count(True)

print(max(ans, 1), ans + ov)

Solution (Python):
n = int(input())
a_list = list(map(int,input().split()))
color = [0]*9
for a in a_list:
  t = a//400
  if t < 8:
    color[t] += 1
  else:
    color[8] += 1
mi = 0
pro = color.pop(-1)
for c in color:
  if c > 0:
    mi += 1
print(max(1,mi),mi+pro)

Solution (Python):

"""
Created on Thu May 14 13:29:53 2020

@author: shinba
"""

n = int(input())

data = {}

f = 0

for i in map(int,input().split()):
    if 1 <= i < 400:
        data["gray"] = 1
    elif 400 <= i < 800:
        data["brown"] = 1
    elif 800 <= i < 1200:
        data["green"] = 1
    elif 1200 <= i < 1600:
        data["w"] = 1
    elif 1600 <= i < 2000:
        data["blue"] = 1
    elif 2000 <= i < 2400:
        data["y"] = 1
    elif 2400 <= i < 2800:
        data["o"] = 1
    elif 2800 <= i < 3200:
        data["r"] = 1
    else:
        f += 1

print(max(len(data),1),len(data)+f)

Solution (Python):
n=int(input())
r=list(map(int,input().split()))
rlist=[]
def color(n):
    if n<400:
        return 1
    elif n<800:
        return 2
    elif n<1200:
        return 3
    elif n<1600:
        return 4
    elif n<2000:
        return 5 
    elif n<2400:
        return 6 
    elif n<2800:
        return 7 
    elif n<3200:
        return 8 
    else:
        return 9

for _ in range(n):
    co=color(r[_])
    rlist.append(co)

ans1=len(set(rlist))

if rlist.count(9)==0:
    print(ans1,ans1,sep=" ")

else:    
    if ans1==1:
        print(1,rlist.count(9),sep=" ")

    else:
        print(ans1-1,ans1-1+rlist.count(9),sep=" ")

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
S = set()
sa = 0
for i in A:
    a = i // 400
    if a < 8:
        S.add(a)
    else:
        sa += 1
ans1 = max(len(S), 1)
ans2 = len(S) + sa
print(ans1, ans2)

Solution (Python):
from collections import Counter
from enum import Enum


class Color(Enum):
    GRAY = (1, 399)
    BROWN = (400, 799)
    GREEN = (800, 1199)
    LIGHTBLUE = (1200, 1599)
    BLUE = (1600, 1999)
    YELLOW = (2000, 2399)
    ORANGE = (2400, 2799)
    RED = (2800, 3199)
    RAINBOW = (3200, 4800)

    @classmethod
    def from_rate(cls, rate):
        colors = {cls.GRAY, cls.BROWN, cls.GREEN, cls.LIGHTBLUE, cls.BLUE, cls.YELLOW, cls.ORANGE, cls.RED, cls.RAINBOW}
        for color in colors:
            lower, upper = color.value
            if lower <= rate <= upper:
                return color
        else:
            raise ValueError


N = int(input())
rates = tuple(map(int, input().split(' ')))
colors = [Color.from_rate(rate) for rate in rates]
counter = Counter(colors)
to_red = len([0 for color in counter.keys() if color != Color.RAINBOW])
r_max = counter[Color.RAINBOW]

max_colors = to_red + r_max
min_colors = max(1, to_red)
print(min_colors, max_colors)

Solution (Python):
def main():
    n, *x = map(int, open(0).read().split())

    a = sum([i < 400 for i in x])
    b = sum([i < 800 for i in x])
    c = sum([i < 1200 for i in x])
    d = sum([i < 1600 for i in x])
    e = sum([i < 2000 for i in x])
    f = sum([i < 2400 for i in x])
    g = sum([i < 2800 for i in x])
    h = sum([i < 3200 for i in x])
    xxx = sum([i >= 3200 for i in x])

    i = [a, (b - a), (c - b), (d - c), (e - d), (f - e), (g - f), (h - g)]
    ans = sum([j >= 1 for j in i])
    print(max(ans, 1), ans + xxx)


if __name__ == '__main__':
    main()

Solution (Python):


import sys
input= lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**9)
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))

from fractions import gcd
import math
def resolve():
    N=pin()
    X=[x//400 for x in tupin()]
    s=set()
    free=0
    for x in X:
        if x>=8:
            free+=1
        else: s.add(x)
    t=len(s) if len(s) else 1   
    print(t,len(s)+free)
        
    
        

resolve()

Solution (Python):
def main():
    n = int(input())
    a = [int(i) for i in input().split()]
    ans = solve(n, a)
    print(*ans)


def solve(n, a):
    m = 8
    colors = [0 for i in range(m + 1)]
    for i in range(n):
        for j in range(m):
            if a[i] < 400 * (j + 1):
                colors[j] += 1
                break
        else:
            colors[m] += 1
    usedcolors = sum([1 for i in colors[:m] if i > 0])
    ans = [max(1,usedcolors), usedcolors + colors[m]]

    return ans


if __name__ == '__main__':
    main()

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
S = set()
sa = 0
for i in A:
    a = i // 400
    if a < 8:
        S.add(a)
    else:
        sa += 1
ans1 = max(len(S), 1)
ans2 = len(S) + sa
print(ans1, ans2)

Solution (Python):
n = int(input())
A = list(map(int,input().split()))
c = [0]*10
add = 0
for i in range(n) :
    if A[i]>=3200 :
        add += 1
        continue
    a = A[i]//400
    c[a] = 1

print(max(sum(c),1),sum(c)+add)

Solution (Python):




























n=int(input())
list=list(map(int,input().split()))
ans=set()
temp=0
for i in list:
    if i>=3200:temp+=1
    else:ans.add(i//400)
print(max(1,len(ans)),len(ans)+temp)

Solution (Python):

import re
import math
from collections import defaultdict
from collections import deque
import itertools
from copy import deepcopy
import random
import time
import os
import queue
import sys
import datetime
from functools import lru_cache

readline=sys.stdin.readline
sys.setrecursionlimit(2000000)

alphabet="abcdefghijklmnopqrstuvwxyz"
mod=int(10**9+7)
inf=int(10**20)
def yn(b):
    if b:
        print("yes")
    else:
        print("no")
def Yn(b):
    if b:
        print("Yes")
    else:
        print("No")
def YN(b):
    if b:
        print("YES")
    else:
        print("NO")
class union_find():
    def __init__(self,n):
        self.n=n
        self.P=[a for a in range(N)]
        self.rank=[0]*n
 
    def find(self,x):
        if(x!=self.P[x]):self.P[x]=self.find(self.P[x])
        return self.P[x]
 
    def same(self,x,y):
        return self.find(x)==self.find(y)
 
    def link(self,x,y):
        if self.rank[x]<self.rank[y]:
            self.P[x]=y
        elif self.rank[y]<self.rank[x]:
            self.P[y]=x
        else:
            self.P[x]=y
            self.rank[y]+=1
 
    def unite(self,x,y):
        self.link(self.find(x),self.find(y))
 
    def size(self):
        S=set()
        for a in range(self.n):
            S.add(self.find(a))
        return len(S)
def is_pow(a,b):
    now=b
    while now<a:
        now*=b
    if now==a:return True
    else:return False
def bin_(num,size):
    A=[0]*size
    for a in range(size):
        if (num>>(size-a-1))&1==1:
            A[a]=1
        else:
            A[a]=0
    return A
def get_facs(n,mod_=0):
    A=[1]*(n+1)
    for a in range(2,len(A)):
        A[a]=A[a-1]*a
        if(mod_>0):A[a]%=mod_
    return A
def comb(n,r,mod,fac):
    if(n-r<0):return 0
    return (fac[n]*pow(fac[n-r],mod-2,mod)*pow(fac[r],mod-2,mod))%mod
def next_comb(num,size):
    x=num&(-num)
    y=num+x
    z=num&(~y)
    z//=x
    z=z>>1
    num=(y|z)
    if(num>=(1<<size)):return False
    else:return num
def get_primes(n,type="int"):
    if n==0:
        if type=="int":return []
        else:return [False]
    A=[True]*(n+1)
    A[0]=False
    A[1]=False
    for a in range(2,n+1):
        if A[a]:
            for b in range(a*2,n+1,a):
                A[b]=False
    if(type=="bool"):return A
    B=[]
    for a in range(n+1):
        if(A[a]):B.append(a)
    return B
def is_prime(num):
    if(num<=1):return False
    i=2
    while i*i<=num:
       if(num%i==0):return False
       i+=1
    return True
def ifelse(a,b,c):
    if a:return b
    else:return  c
def join(A,c=""):
    n=len(A)
    A=list(map(str,A))
    s=""
    for a in range(n):
        s+=A[a]
        if(a<n-1):s+=c
    return s
def factorize(n,type_="dict"):
    b = 2
    list_ = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            list_.append(b)
        b+=1
    if n > 1:list_.append(n)
    if type_=="dict":
        dic={}
        for a in list_:
            if a in dic:
                dic[a]+=1
            else:
                dic[a]=1
        return dic
    elif type_=="list":
        return list_
    else:
        return None
def floor_(n,x=1):
    return x*(n//x)
def ceil_(n,x=1):
    return x*((n+x-1)//x)
    return ret
def seifu(x):
    return x//abs(x)

def main():
    n=int(input())
    A=list(map(int,input().split()))
    cnt=[0]*9
    for a in A:
        cnt[a//400 if a//400<=8 else 8]+=1
    mmin=inf
    mmax=-inf
    if sum(cnt[:8])==0:
        if cnt[-1]>0:mmin=1
        else:mmin=0
    else:
        mmin=8-cnt[:8].count(0)
    mmax=8-cnt[:8].count(0)+cnt[-1]
    print(mmin,mmax)
main()

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

color = [0]*8
count = 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:
        count += 1
sum_color = sum(color)

if sum_color == 0:
    print(1,count)
else:
    print(sum_color,sum_color+count)

Solution (Python):
N = int(input())
colors = {}
any_color = 0
for rate in list(map(int, input().split())):
    if rate < 400:
        colors['gray'] = True
    elif rate < 800:
        colors['brawn'] = True
    elif rate < 1200:
        colors['green'] = True
    elif rate < 1600:
        colors['water'] = True
    elif rate < 2000:
        colors['blue'] = True
    elif rate < 2400:
        colors['yellow'] = True
    elif rate < 2800:
        colors['orange'] = True
    elif rate < 3200:
        colors['red'] = True
    else:
        any_color += 1

min_color = max(len(colors.keys()), 1)
max_color = len(colors.keys()) + any_color
print(min_color, max_color)

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

color = [0]*8
free_color = 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:
    free_color += 1
sum_c = sum(color)

if sum_c == 0:
  print(1, free_color)
else:
  print(sum_c, sum_c + free_color)

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

color = [False]*8
top = 0

for i in a:
    if i <= 399:
        color[0] = True
    elif i <= 799:
        color[1] = True
    elif i <= 1199:
        color[2] = True
    elif i <= 1599:
        color[3] = True
    elif i <= 1999:
        color[4] = True
    elif i <= 2399:
        color[5] = True
    elif i <= 2799:
        color[6] = True
    elif i <= 3199:
        color[7] = True
    else:
        top += 1

mx = color.count(True) + top
mi = color.count(True)
if mi == 0 and top > 0:
    mi = 1
print('{} {}'.format(mi, mx))

Solution (Python):
n=int(input())
A=map(int,input().split())
count={}
ziyuu=0
for a in A:
    if 1<=a<=399:
        count['灰色']=1
    elif 400<=a<=799:
        count['茶色']=1   
    elif 800<=a<=1199:
        count['緑色']=1 
    elif 1200<=a<=1599:
        count['水色']=1 
    elif 1600<=a<=1999:
        count['青色']=1 
    elif 2000<=a<=2399:
        count['黄色']=1 
    elif 2400<=a<=2799:
        count['橙色']=1 
    elif 2800<=a<=3199:
        count['赤色']=1 
    elif 3200<=a:
        ziyuu+=1
mi=max(1,len(count))
ma=len(count)+ziyuu
print(mi,ma)

Solution (Python):
import sys

N = int(input())
A = list(map(int, sys.stdin.readline().rsplit()))

dic = dict()
free = 0
for a in A:
    if a <= 399:
        if 1 not in dic:
            dic[1] = 1
    elif a <= 799:
        if 2 not in dic:
            dic[2] = 1
    elif a <= 1199:
        if 3 not in dic:
            dic[3] = 1
    elif a <= 1599:
        if 4 not in dic:
            dic[4] = 1
    elif a <= 1999:
        if 5 not in dic:
            dic[5] = 1
    elif a <= 2399:
        if 6 not in dic:
            dic[6] = 1
    elif a <= 2799:
        if 7 not in dic:
            dic[7] = 1
    elif a <= 3199:
        if 8 not in dic:
            dic[8] = 1
    else:
        free += 1

res = len(dic.items())
print(max(1, res), res + free)

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):
n = int(input())
a = [int(i)//400 for i in input().split()]
s = set()
f = 0
for i in a:
    if i>=8:
        f += 1
    else:
        s.add(i)
mn = len(s)
if len(s)==0: mn += f>0
mx = len(s)+f
print(mn, mx)

Solution (Python):
from collections import defaultdict
n = int(input())
A=[int(i)//400 for i in input().split()]
dd = defaultdict(int)
t=0
for i in A:
    if i>=8:
        t+=1
        continue
    else:
        dd[i]+=1
print(max(len(dd), 1),(len(dd)+t))

Solution (Python):
N=int(input())
a=list(map(int,input().split()))
gray=brown=green=lblue=blue=yellow=orange=red=any=0
mini=0
maxi=0

for i in a:
    if i >= 1 and i <= 399 and gray==0:
        gray+=1 
    elif i >= 400 and i <= 799 and brown==0:
        brown+=1
    elif i >= 800 and i <= 1199 and green==0:
        green+=1
    elif i >= 1200 and i <= 1599 and lblue==0:
        lblue+=1
    elif i >= 1600 and i <= 1999 and blue==0:
        blue+=1    
    elif i >= 2000 and i <= 2399 and yellow==0:
        yellow+=1
    elif i >= 2400 and i <= 2799 and orange==0:
        orange+=1
    elif i >= 2800 and i <= 3199 and red==0:
        red+=1
    elif i >= 3200:
        any+=1
    else:
        pass
if gray+brown+green+lblue+blue+yellow+orange+red==0 and any>=1:
    mini=1
else:
    mini=gray+brown+green+lblue+blue+yellow+orange+red
maxi=gray+brown+green+lblue+blue+yellow+orange+red+any
print(mini,maxi)