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):



def main():
    _ = int(input())
    A = list(map(int, input().split()))
    B = [0] * 9
    mn, mx = 0, 0

    for a in A:
        a //= 400
        if a > 7: a = 8
        B[a] += 1
    
    for i in range(8):
        if B[i] > 0: mn += 1
    
    mx = mn + B[8]
    if mn == 0: mn += 1

    print(mn, mx)

if __name__ == "__main__":
    main()

Solution (Python):
n=int(input())
A=list(map(int,input().split()))
ans = [0]*8
r = 0
for i in range(n):
  if A[i] < 3200:
    ans[A[i]//400] = 1
  else:
    r += 1
print(*[max(sum(ans),1),sum(ans)+r])

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

Solution (Python):
n = int(input())
A = list(map(int, input().split()))
d = {}

A.sort()
irregular_cnt=0
reg_cnt = 0
for i in range(n):
    a = A[i]
    a //= 400
    if a>7:
        irregular_cnt += 1
    else:
        d[a] = d.get(a, 0)+1

maxi, mini = 0, 0
for i in d:
    if d[i]>0:
        maxi += 1
        mini += 1
if irregular_cnt:
    maxi += irregular_cnt
    if not mini:
        mini += 1
print(mini, maxi)

Solution (Python):
N,*A=map(int,open(0).read().split())

colors = [0 for i in range(8)]
tyty = 0

for a in A:
  c = a//400
  if c>=8:
    tyty+=1
  else:
    colors[c]+=1

cNum = 8-colors.count(0)
    
minC = max(cNum,1)
maxC = cNum+tyty

print(minC,maxC)

Solution (Python):




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


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

ratings = [
    '1-399', '400-799', '800-1199', '1200-1599', '1600-1999',
    '2000-2399', '2400-2799', '2800-3199', '3200-']
d = {r: 0 for r in ratings}

for a in A:
    d[ratings[check(a)]] += 1

ans = 0
for k, v in d.items():
    if k != '3200-' and v != 0:
        ans += 1

top = d['3200-']
if top == 0:
    print(ans, ans)
elif ans == 0:
    print(1, top)
else:
    print(ans, ans+top)

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

arr = [0] * 9
ans = [0] * 2

for i in a:
    if i//400 < 8:
        arr[i//400] = 1
    else:
        arr[8] += 1

left = sum(arr[:8])
right = arr[8]

ans[0] = left

if left == 0:
    ans[0] = 1

ans[1] = left + right

print(*ans)

Solution (Python):
def cordtest(AAA):
  jisyo ={'H':0,'C':0,'G':0,'M':0,'B':0,'Y':0,'O':0,'R':0,'A':0}
  for i in AAA:
    
    if i <= 399:
      jisyo['H'] +=1
    elif 400 <= i <=799:
      jisyo['C'] +=1
    elif 800 <= i <=1199:
      jisyo['G'] +=1
    elif 1200 <= i <=1599:
      jisyo['M'] +=1
    elif 1600 <= i <=1999:
      jisyo['B'] +=1
    elif 2000 <= i <=2399:
      jisyo['Y'] +=1
    elif 2400 <= i <= 2799:
      jisyo['O'] +=1
    elif 2800 <= i <= 3199:
      jisyo['R'] +=1
    else:
      jisyo['A'] +=1
  maxi = 0
  mini = 0
  for i,j in jisyo.items():
    
    if i != 'A':
      if j >0:
        mini +=	1
    else:
      maxi += j
  ans = maxi + mini
  if mini ==0:
    mini =1
  
  return print(mini,ans)
N = int(input())
AA = list(map(int,input().split()))
cordtest(AA)

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

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

c = [0]*9
for i in a:
  t = i // 400
  if t < 8:
    c[t] = 1
  else:
    c[8] += 1
cmin = max(sum(c[:-1]), min(c[8], 1))
cmax = sum(c)
print(cmin, cmax)

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

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


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

if n == 1 and a[0] >= 3200:
  print(1,1)
  exit()
  
for i in range(len(l)-1):
  if l[i] > 0:
    ans += 1

if ans >= 1:
  print(ans,ans + l[8])
elif ans == 0:
  print(1,l[8])

Solution (Python):
N = int(input())
N_List = list(map(int,input().split()))
NR_List = [i // 400 for i in N_List]
Number_NRD = len(set([i for i in NR_List if i < 8]))
Number_NRU = len([i for i in NR_List if i >= 8])
max_p= Number_NRD + Number_NRU
min_p= (Number_NRD,1)[Number_NRD == 0]
print(str(min_p) + " " + str(max_p))

Solution (Python):

"""
Created on Tue Sep 22 04:19:50 2020

@author: liang
"""

N = int(input())
A = [int(x) for x in input().split()]
d = [False]*8
count = 0
ans = 0
for a in A:
    if a//400 >= 8:
        count += 1
    else:
        if d[a//400] == False:
            ans += 1
            d[a//400] = True

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

Solution (Python):
n = int(input())
al = list(map(int, input().split()))
ratel = [0,0,0,0,0,0,0,0,0]

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

for a in al:
    i = check(a)
    ratel[i] += 1


zeroc = 0
ratec = 0
for i in range(8):
    if ratel[i] == 0:
        zeroc += 1
    else:
        ratec += 1

if ratel[8] == 0:
    print(ratec,ratec)
elif 1 <= ratel[8] <= 8:
    if ratec == 0:
        print(1,ratel[8])
    elif ratel[8] < zeroc:
        print(ratec, ratec+ratel[8])
    elif ratel[8] >= zeroc:
        print(ratec,ratec+ratel[8])
else:
    if ratec == 0:
        print(1,ratel[8])
    else:
        print(ratec,ratec+ratel[8])

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
B = [i // 400 for i in A if i < 3200]
if B == []:
  print(1, N)
elif len(B) == N:
  C = len(set(B))
  print(C, C)
else:
  C = len(set(B))
  D = C + N - len(B)
  print(C, D)

Solution (Python):
import math
from math import gcd,pi,sqrt
INF = float("inf")
MOD = 10**9 + 7

import sys
sys.setrecursionlimit(10**6)
import itertools
import bisect
from collections import Counter,deque
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]


def main():
    n = i_input()
    a = i_list()
    dic = {399:0, 799:0, 1199:0, 1599:0, 1999:0, 2399:0, 2799:0, 3199:0}
    cnt = 0
    for i in a:
        if i < 400:
            dic[399] = 1
        elif i < 800:
            dic[799] = 1
        elif i < 1200:
            dic[1199] = 1
        elif i < 1600:
            dic[1599] = 1
        elif i < 2000:
            dic[1999] = 1
        elif i < 2400:
            dic[2399] = 1
        elif i < 2800:
            dic[2799] = 1
        elif i < 3200:
            dic[3199] = 1
        else:
            cnt += 1
    c = sum(list(dic.values()))
    if c == 0:
        print(1, cnt)
    else:
        print(c, c+cnt)





if __name__=="__main__":
    main()

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
rate = [0] * 9
for i in range(n):
    for j in range(8):
        if 400 * j <= a[i] < 400 * (j + 1):
            rate[j] += 1
            break
    else:
        rate[8] += 1

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

print(max(1, counter), counter + rate[8])

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

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


print(max(1, counter), counter + rate[8])

Solution (Python):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

n = int(input())
rate = [0] * 9
for v in map(int, input().split()):
    if v // 400 < 8:
        rate[v // 400] = 1
    else:
        rate[8] += 1

ans = sum(rate[:8])
if ans == 0:
    print('1 {}'.format(rate[8]))
elif rate[8] == 0:
    print('{} {}'.format(ans, ans))
else:
    print('{} {}'.format(ans, ans + rate[8]))

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

color = []
rainbow = 0

for i in range(N):
    if 1 <= a[i] <= 399:
        color.append('gray')
    elif 400 <= a[i] <= 799:
        color.append('brown')
    elif 800 <= a[i] <= 1199:
        color.append('green')
    elif 1200 <= a[i] <= 1599:
        color.append('sky')
    elif 1600 <= a[i] <= 1999:
        color.append('blue')
    elif 2000 <= a[i] <= 2399:
        color.append('yellow')
    elif 2400 <= a[i] <= 2799:
        color.append('orange')
    elif 2800 <= a[i] <= 3199:
        color.append('red')
    else:
        rainbow += 1
        color.append('all')

if len(set(color)) == 1 and rainbow > 0:
    mini = 1
elif rainbow == 0:
    mini = len(set(color))
else:
    mini = max(1, len(set(color))-1)

if rainbow > 1:
    maxi = len(set(color)) + rainbow - 1
else:
    maxi = len(set(color))

print(mini, maxi)

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

Sum = 0
for i in range(8):
    if data[i] != 0:
        Sum += 1
m = max(1, Sum)
M = Sum + data[8]

print(m,M)

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
L = []
H = []

for i in range(N):
  a = A[i]//400
  if a > 7:
    H.append(a)
  else:
    L.append(a)

if len(L) != 0:
  print(str(len(set(L)))+" "+str(len(set(L))+len(H)))
else:
  print("1 "+str(len(H)))

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
colors = [0] * 8
other = 0
for a in A:
  index = a // 400
  if index > 7:
    other += 1
  else:
    colors[index] += 1
min_color = 0
max_color = 0

if other == N:
  min_color = 1
  max_color = other
else:
  for c in colors:
    if c != 0:
      min_color += 1
  max_color = min_color + other 

print(min_color,max_color)

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

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

color = sum(rate[0:8])


dai = color + rate[8]

if rate[8]==0:
    syo=color
else:
    if color==0:
        syo=1

    else:
        syo=color

print(syo,dai)

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
out = [0]*9
for i in range(N):
    if A[i]>=3200:
        out[8] += 1
    else:
        out[A[i]//400]=1
MIN = sum(out[0:8])
MAX = MIN + out[8]
if MIN>=1:
    print(MIN, MAX)
else:
    print(1,MAX)

Solution (Python):

def main():
    _ = int(input())
    a = list(map(int, input().split()))
    cnt = 0
    ans = []

    for i in a:
        if i // 400 >= 8:
            cnt += 1
        else:
            ans.append(i//400)
    else:
        ans = set(ans)
        print(max(len(ans), 1), len(ans)+cnt)



if __name__ ==  "__main__":
    main()

Solution (Python):
from collections import Counter

n = int(input())
A = list(map(int, input().split()))
A = [min(8, a // 400) for a in A]
CA = Counter(A)
num = 0
for i in range(8):
    if CA[i]:
        num += 1

num_8 = CA[8]
saidai = num + num_8

saisho = max(1, num)
print(saisho, saidai)

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

color = [0] * 9

for a in A:
  if a <= 399:
    color[0] = 1
  elif a <= 799:
    color[1] = 1
  elif a <= 1199:
    color[2] = 1
  elif a <= 1599:
    color[3] = 1
  elif a <= 1999:
    color[4] = 1
  elif a <= 2399:
    color[5] = 1
  elif a <= 2799:
    color[6] = 1
  elif a <= 3199:
    color[7] = 1
  else:
    color[8] += 1
    
max_num = sum(color)
min_num = max(1, sum(color[:-1]))
 
print(min_num, max_num)

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

cnt = [0]*8
c = 0
for a in A:
    if a <= 399:
        cnt[0] += 1
    elif a >= 400 and a <= 799:
        cnt[1] += 1
    elif a >= 800 and a <= 1199:
        cnt[2] += 1
    elif a >= 1200 and a <= 1599:
        cnt[3] += 1
    elif a >= 1600 and a <= 1999:
        cnt[4] += 1
    elif a >= 2000 and a <= 2399:
        cnt[5] += 1
    elif a >= 2400 and a <= 2799:
        cnt[6] += 1
    elif a >= 2800 and a <= 3199:
        cnt[7] += 1
    else:
        c += 1
        
Min = len([i for i in cnt if i != 0])
if c == 0:
    print(Min, Min)
else:
    Max = Min+c
    if Min == 0:
        print(1, Max)
    else:
        print(Min, Max)

Solution (Python):
N = int(input())
a = [int(c) for c in input().split()]
c = [0]*8
over = 0
for i in range(N):
    if a[i]>=3200:
        over+=1
    else:
        c[a[i]//400]+=1
 
mi = 8-c.count(0)
ma = mi+over
if mi == 0:
    mi+=1
print(mi,ma)

Solution (Python):
def main():
    N = int(input())
    any = 0
    A = map(int, input().split())
    colors = set([])
    for a in A:
        if 1 <= a <= 399:
            colors.add('gray')
        elif 400 <= a <= 799:
            colors.add('brown')
        elif 800 <= a <= 1199:
            colors.add('green')
        elif 1200 <= a <= 1599:
            colors.add('light blue')
        elif 1600 <= a <= 1999:
            colors.add('blue')
        elif 2000 <= a <= 2399:
            colors.add('yellow')
        elif 2400 <= a <= 2799:
            colors.add('orange')
        elif 2800 <= a <= 3199:
            colors.add('red')
        else:
            any += 1

    if any == 0:
        print(len(colors), len(colors))
    elif len(colors) == 0:
        print(1, any)
    else:
        print(len(colors), len(colors) + any)


if __name__ == '__main__':
    main()

Solution (Python):
N=int(input())
a=list(map(int,input().split()))
for i in range(N):
    a[i]//=400

ans=0
for i in range(8):
    if i in a:
        ans+=1
y=0
for x in a:
    if x>=8:
        y+=1
print(max(ans,1),ans+y)

Solution (Python):
N = int(input())
R = list(map(int, input().split()))
X = [0]*8
p = 0
for r in R:
  if r >= 3200:
    p += 1
  else:
    X[r//400] = 1

s = sum(X)
if s == 0:
  print(str(1) + " " + str(p))
else:
  print(str(s) + " " + str(s + p))

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
X = [0 for i in range(8)]
cnt = 0
for a in A:
  if a >= 3200:
    cnt += 1
  else:
    X[a // 400] = 1
s = sum(X)
if s == 0:
  print(str(1) + " " + str(cnt))
else:
  print(str(s) + " " + str(s + cnt))

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

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

Solution (Python):
from collections import defaultdict
N = int(input())
a = list(map(int,input().split()))
d = defaultdict(int)
for x in a:
    d[min(x//400, 8)] += 1
mi = len(d.keys())
if d[8] > 0 and mi >= 2:
    mi -= 1
mx = d[8]+len([i for i in range(8) if i in d])
print(mi, mx)

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

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
a1=0
b=0
c=0
d=0
e=0
f=0
g=0
h=0
ans=0
for i in range(n):
  if 1<=a[i]<=399:
    a1=1
  elif 400<=a[i]<=799:
    b=1
  elif 800<=a[i]<=1199:
    c=1
  elif 1200<=a[i]<=1599:
    d=1
  elif 1600<=a[i]<=1999:
    e=1
  elif 2000<=a[i]<=2399:
    f=1
  elif 2400<=a[i]<=2799:
    g=1
  elif 2800<=a[i]<=3199:
    h=1
  else:
    ans+=1

x=a1+b+c+d+e+f+g+h
if a1==b==c==d==e==f==g==h==0:
  print(1,ans)
else:
  print(x,x+ans)

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

sp = [400,800,1200,1600,2000,2400,2800,3200]
rank = ["gray","brown","green","cyan","blue","yellow","orange","red","highest"]
cnt = [0]*len(rank)

import bisect as b

for score in S:
  cnt[b.bisect(sp,score)] += 1
  
mid = sum([1 for n in cnt[:-1] if n > 0])
t = cnt[-1]
max_amt = mid + t
min_amt = mid
if t > 0:
  min_amt = max(mid,1)
print(min_amt,max_amt)

Solution (Python):
N = int(input())
a = [ int(v) for v in input().split(" ") ]
 
l = [0] * 9
 
for i in range(N):
  rate = a[i]
  
  if rate < 400:
    l[0] += 1
  elif rate < 800:
    l[1] += 1
  elif rate < 1200:
    l[2] += 1
  elif rate < 1600:
    l[3] += 1
  elif rate < 2000:
    l[4] += 1
  elif rate < 2400:
    l[5] += 1
  elif rate < 2800:
    l[6] += 1
  elif rate < 3200:
    l[7] += 1
  else:
    l[8] += 1
 
uniq_n = 0
for i in range(8):
  if l[i] != 0:
    uniq_n += 1
 
min_v = 1 if uniq_n == 0 else uniq_n
max_v = uniq_n + l[8]
print(min_v, max_v)

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

upper = [399, 799, 1199, 1599, 1999, 2399, 2799,3199, 4800]
lower = [1, 400, 800, 1200, 1600, 2000, 2400, 2800, 3200]

cnt = 0
tops = 0
for color in range(9)[::-1]:
    for i in range(n):
        if color == 8:
            if lower[color] <= a[i] <= upper[color]:
                tops += 1
        else:
            if lower[color] <= a[i] <= upper[color]:
                cnt += 1
                break

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

Solution (Python):
import sys

from collections import defaultdict


def input():
    return sys.stdin.readline().strip()


def input_int():
    return int(input())


def input_int_list():
    return [int(i) for i in input().split()]


def main():

    n = input_int()
    A = input_int_list()
    cnt = defaultdict(int)
    for a in A:
        rank = a // 400
        if rank >= 8:
            rank = 8
        cnt[rank] += 1
    ans_min = 0
    ans_max = 0
    for k, v in sorted(cnt.items(), key=lambda x: x[0]):
        if k != 8:
            ans_min += 1
            ans_max += 1
        elif k == 8:
            if ans_min == 0:
                ans_min = 1
                ans_max = v
            else:
                ans_max += v
    print(ans_min, ans_max)

    return


if __name__ == "__main__":
    main()

Solution (Python):
import math

N = int(input())
A = [math.floor(a/400) if a < 3200 else 3200 for a in list(map(int, input().split()))]

set_A = set([a for a in A if a != 3200])
print(*[max(1, len(set_A)), len(set_A) + A.count(3200)], sep=" ")

Solution (Python):
with open(0) as f:
    N, *a = map(int, f.read().split())
Set = set()
free = 0
for x in a:
    x //= 400
    if x < 8:
        Set.add(x)
    else:
        free += 1

Ans = [max(1, len(Set)), len(Set)+free]
print(*Ans)

Solution (Python):
def main():
    n = int(input())
    a_list = list(map(int, input().split()))
    rate_list = [0] * 9

    for a in a_list:
        rate = a // 400
        if rate < 8:
            rate_list[rate] += 1
        else:
            rate_list[-1] += 1

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

    print(max(min_cnt, 1), min_cnt + rate_list[-1])


if __name__ == "__main__":
    main()

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

for i in range(n):
  if a[i] < 3200:
    rates[a[i] // 400] += 1
  else:
    cnt += 1
    
cn = len(rates) - rates.count(0) 
if sum(rates) == 0:
  cmin = 1
else:
  cmin = cn 

if all([x < 3200 for x in a]):
  cmax = cn 
else:
  cmax = cn + cnt
  
print(cmin,cmax)

Solution (Python):
N=int(input())
p=list(map(int,input().split()))
s=set()
z=0
for i in range(N):
  p[i]//=400
  if p[i]<8:
    s.add(p[i])
  else:
    z+=1
print(max(1,len(s)),end=' ')
print(len(s)+z)

Solution (Python):
import sys
from collections import deque
from bisect import bisect_left, bisect_right, insort_left, insort_right 
from heapq import heapify, heappop, heappush

sys.setrecursionlimit(10**6)
INF = 10**20

def mint():
    return map(int,input().split())
def lint():
    return map(int,input().split())
def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1])

N = int(input())
A = lint()
S = set()
pro = 0
for a in A:
    if a//400<8:
        S.add(a//400)
    else:
        pro += 1
print(max(1,len(S)),len(S)+pro)

Solution (Python):
import sys
mod=10**9+7 ; inf=float("inf")
from math import sqrt, ceil
from collections import deque, Counter, defaultdict 
input=lambda: sys.stdin.readline().strip()
sys.setrecursionlimit(11451419)
from decimal import ROUND_HALF_UP,Decimal  
  
from functools import lru_cache
from bisect import bisect_left as bileft, bisect_right as biright






C=[1,400,800,1200,1600,2000,2400,2800,3200]
n=int(input())
A=list(map(int,input().split()))
cnt=[0]*9
for i in range(n):
    q=biright(C,A[i])-1
    cnt[q]+=1

print(max(1,8-cnt[:-1].count(0)) , 8-cnt[:-1].count(0)+cnt[-1])

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

for n in range(N):
  if 1 <= a[n] < 400:
    color.add("gray")
  elif 400 <= a[n] < 800:
    color.add("brown")
  elif 800 <= a[n] < 1200:
    color.add("green")
  elif 1200<= a[n] < 1600:
    color.add("water")
  elif 1600 <= a[n] < 2000:
    color.add("blue")
  elif 2000 <= a[n] < 2400:
    color.add('yellow')
  elif 2400 <= a[n] < 2800:
    color.add('orange')
  elif 2800 <= a[n] < 3200:
    color.add('red')
  else:
    rainbow += 1

if len(color) == 0:
	color_min = 1 
	color_max = rainbow
else:
  color_min = len(color)
  color_max = color_min + rainbow

    
print(f'{color_min} {color_max}')

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

ans=[0 for i in range(8)]
rate_3200=0

for i in l:
  if 1<=i<=399:
    ans[0]+=1
  elif 400<=i<=799:
    ans[1]+=1
  elif 800<=i<=1199:
    ans[2]+=1
  elif 1200<=i<=1599:
    ans[3]+=1
  elif 1600<=i<=1999:
    ans[4]+=1
  elif 2000<=i<=2399:
    ans[5]+=1
  elif 2400<=i<=2799:
    ans[6]+=1
  elif 2800<=i<=3199:
    ans[7]+=1
  elif 3200<=i:
    rate_3200+=1
    
if rate_3200==0:
  num=8-ans.count(0)
  print("{} {}".format(num,num))
else:
  count_0=ans.count(0)
  if count_0==8:
    min_num=1
    max_num=rate_3200
  else:
    min_num=8-count_0
    max_num=8-count_0+rate_3200
  print("{} {}".format(min_num,max_num))

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

rate = [0] * 8
s = 0

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



    
ans1 = 8-rate.count(0)
ans2 = ans1+s
if ans1 == 0 and s != 0:
    ans1 = 1


print(ans1, ans2)

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

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

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



def color(rate):
    c = rate//400
    return min(8, c)


dic = {i: 0 for i in range(9)}

for a in al:
    dic[color(a)] = dic[color(a)]+1

count = 0
for i in range(8):
    if dic[i] != 0:
        count += 1

mn = count
mx = count
if dic[8] != 0:
    if count>=1:
        mx = mn+dic[8]
    else:
        mn=1
        mx=dic[8]

print(mn, mx)

Solution (Python):
N=int(input())
List = list(map(int, input().split()))
sumList = [0]*8
mid = 0
for i in range(N):
  if 1<=List[i]<=399:
    sumList[0] += 1
  elif 400<= List[i] <=799:
    sumList[1] += 1
  elif 800 <= List[i] <= 1199:
    sumList[2] += 1
  elif 1200<= List[i] <=1599:
    sumList[3] += 1
  elif 1600<= List[i] <=1999:
    sumList[4] += 1
  elif 2000 <= List[i] <= 2399:
    sumList[5] += 1
  elif 2400 <= List[i] <= 2799:
    sumList[6] += 1
  elif 2800 <= List[i] <= 3199:
    sumList[7] += 1
  elif 3200 <= List[i]:
    mid += 1
res1 = 8 - sumList.count(0)
res2 = res1 + mid
if res1 == 0 and mid > 0:
  res1 = 1
print(res1,res2)

Solution (Python):
N=int(input())
List = list(map(int, input().split()))
sumList = [0]*8
mid = 0
for i in range(N):
  if 1<=List[i]<=399:
    sumList[0] += 1
  elif 400<= List[i] <=799:
    sumList[1] += 1
  elif 800 <= List[i] <= 1199:
    sumList[2] += 1
  elif 1200<= List[i] <=1599:
    sumList[3] += 1
  elif 1600<= List[i] <=1999:
    sumList[4] += 1
  elif 2000 <= List[i] <= 2399:
    sumList[5] += 1
  elif 2400 <= List[i] <= 2799:
    sumList[6] += 1
  elif 2800 <= List[i] <= 3199:
    sumList[7] += 1
  elif 3200 <= List[i]:
    mid += 1
res1 = 8 - sumList.count(0)
res2 = res1 + mid
if res1 == 0 and mid > 0:
  res1 = 1
print(res1,res2)

Solution (Python):
N = int(input())
As = list(map(int,input().split()))
mi=0
ma=0
r = []
for i in range(N):
 rate = As[i]//400
 if rate < 8:
     if not rate in r:
         r.append(rate)
         mi += 1
         ma += 1
 else:
     ma+=1
if mi == 0:
    mi =1
print(mi,ma)

Solution (Python):

import sys
def input():
    return sys.stdin.readline()[:-1]

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

    l = [0] * 9
    for i in range(N):
        n = a[i] // 400
        if n > 8:
            n = 8
        l[n] += 1

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



    gold = l[8]

    ans_max = ans_min
    ans_max += gold

    if ans_min == 0:
        ans_min = 1

    print(ans_min, ans_max)


if __name__ == '__main__':
    main()

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

rate = [0] * 8
s = 0

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



    
ans1 = 8-rate.count(0)
ans2 = ans1+s
if ans1 == 0 and s != 0:
    ans1 = 1


print(ans1, ans2)