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


from sys import *
from math import *

N = int(input())
l = list(map(int, input().split()))
gray = 0
brown = 0
green = 0
cyan = 0
blue = 0
yellow = 0
orange = 0
red = 0
counter = 0
min = 0
max = 0

for i in range(N):
   if l[i] >= 1 and l[i] <= 399:
   	   gray = 1
   elif l[i] >= 400 and l[i] <= 799:
   	   brown= 1
   elif l[i] >= 800 and l[i] <= 1199:
   	   green = 1
   elif l[i] >= 1200 and l[i] <= 1599:
   	   cyan = 1
   elif l[i] >= 1600 and l[i] <= 1999:
   	   blue = 1
   elif l[i] >= 2000 and l[i] <= 2399:
   	   yellow = 1   	   
   elif l[i] >= 2400 and l[i] <= 2799:
   	   orange = 1   	   
   elif l[i] >= 2800 and l[i] <= 3199:
   	   red = 1
   elif l[i] >= 3200:
   	   counter += 1

flag_sum = gray + brown + green + cyan + blue + yellow + orange + red

max = counter + flag_sum

if flag_sum >= 1:
   min = flag_sum
if flag_sum == 0:
   min = 1

print(min, max)

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

  rate = [3199, 2799, 2399, 1999, 1599, 1199, 799, 399, 1]

  c = [0] * len(rate)

  for v in a:
    for i, r in enumerate(rate):
      if(v > r):
        c[i] += 1
        break

  count = 0
  ans = [0,0]

  for v in c[1:]:
    if(v > 0):
      count += 1

  ans[0] = ans[1] = count

  if(c[0] > 0):
    if(count == 0):
      ans[0] = 1
      ans[1] = c[0]
    else:
      ans[1] += c[0]


  print(" ".join(map(str, ans)))


if __name__ == "__main__":
  main()

Solution (Python):
import collections

def myindex(l, x, default=-1):
    if x in l:
        return l.index(x)
    else:
        return default

def main():
    N = int(input())
    a = list(map(int, input().split()))
    
    A = [x//400 for x in a]
    A.sort()
    Aitems = list(zip(*collections.Counter(A).items()))
    cntmin = len([x for x in Aitems[0] if x < 8])
    cntmax = cntmin + len([x for x in A if x >= 8])
    if cntmin == 0:
        cntmin = 1
    print(cntmin, cntmax)

if __name__ == "__main__":
    main()

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy, copy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
 
N = INT()
a = LIST()
 
anss = [False]*8
cnt = 0
 
for i in range(N):
	if a[i] >= 3200:
		cnt += 1
	else:
		anss[a[i]//400] = True
 
MIN = max(sum(anss), 1)
MAX = sum(anss)+cnt
print(MIN, MAX)

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

Solution (Python):
from collections import defaultdict
n = int(input())
a = list(map(int, input().split()))

d = defaultdict(int)
for i in range(n):
    if a[i] >= 3200:
        d["free"] += 1
    elif a[i] >= 2800:
        d["red"] += 1
    elif a[i] >= 2400:
        d["ora"] += 1
    elif a[i] >= 2000:
        d["yellow"] += 1
    elif a[i] >= 1600:
        d["blue"] += 1
    elif a[i] >= 1200:
        d["rblue"] += 1
    elif a[i] >= 800:
        d["green"] += 1
    elif a[i] >= 400:
        d["brown"] += 1
    else:
        d["gray"] += 1

ans = 0
fr = 0
for i in d:
    if i == "free":
        fr += d[i]
    else:
        ans += 1

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

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
l = []
rate = ['gray', 'brown', 'green', 'cyan', 'blue', 'yellow', 'orange', 'red']
count = 0

for i in range(n):
    q, r = divmod(a[i], 400)
    if q >= 8:
        count += 1
    else: l.append(rate[q])

print(max(len(set(l)), 1), len(set(l))+count)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
l = []
rate = ['gray', 'brown', 'green', 'water', 'blue', 'yellow', 'orange', 'red']
count = 0

for i in range(n):
    q, r = divmod(a[i], 400)
    if q >= 8:
        count += 1
    else: l.append(rate[q])

print(max(len(set(l)), 1), len(set(l))+count)

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):
n = int(input())
a_input=list(map(int,input().split()))

rate_li=[0]*9
top_coder=0
for a in a_input:
    rate_li[min(a//400,8)]+=1

min_ = sum(i!=0 for i in rate_li[:8])
print(max(min_,1),min_+rate_li[-1])

Solution (Python):
N = int(input())
*a, = map(int, input().split())
colors = [0]*8
top = 0
for i in range(N):
    if a[i] < 3200:
        colors[a[i]//400] += 1
    else:
        top += 1

m = 0
for c in colors:
    if c > 0:
        m += 1
print(max(1, m), m+top)

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

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

count=[0]*8
cnt = 0
for i in a:
    if i >=3200:
        cnt +=1
    else:
        count[i//400]+=1
cnt2= 0
for i in count:
    if i>0:
        cnt2+=1
if cnt2 == 0:
    print(1, cnt)
else:
    print(cnt2, cnt2+cnt)

Solution (Python):
N=int(input())
l=[int(x) for x in input().rstrip().split()]
rate=[False]*8
cnt=0
for i in l:
    if 8<=i//400:
        cnt+=1
        continue

    rate[i//400]=True


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

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     

def main():
    N = I()
    A = LI()
    colors = [0] * 10
    free = 0
    for a in A:
        i = a // 400
        if i < 8:
            colors[i] += 1
        else:
            free += 1
    cnt = 0
    for c in colors:
        if c > 0:
            cnt += 1
    m = cnt
    if m == 0:
        m += 1
    M = cnt + free
    print(m, M)

def _main():
    N = I()
    A = LI()
    taken = set()
    free = 0
    for a in A:
        if a < 400:
            taken.add('gray')
        elif a < 800:
            taken.add('br')
        elif a < 1200:
            taken.add('green')
        elif a < 1600:
            taken.add('wat')
        elif a < 2000:
            taken.add('blue')
        elif a < 2400:
            taken.add('yellow')
        elif a < 2800:
            taken.add('orange')
        elif a < 3200:
            taken.add('red')
        else:
            free += 1
    minval = len(taken)
    maxval = minval + free
    print(minval, maxval)

main()

Solution (Python):
input()
super_coders_cnt = 0
coders = set()
for r in map(int, input().split()):
    if r >= 3200:
        super_coders_cnt += 1
    else:
        coders.add(r // 400)
print(max(1, len(coders)), len(coders) + super_coders_cnt)

Solution (Python):
from collections import Counter


def get_color(rating):
    if rating >= 3200:
        return 8
    else:
        return rating // 400


input()
a = Counter(map(lambda x: get_color(int(x)), input().split()))
min_color_cnt = len([i for i in a if i < 8])
print(max(1, min_color_cnt), min_color_cnt + a[8])

Solution (Python):
from collections import Counter


def get_color(rating):
    for i, (l_l, l_u) in enumerate(zip(limits, limits[1:])):
        if l_l <= rating < l_u:
            return i
    else:
        return SUPER_CODER


limits = [1, 400, 800, 1200, 1600, 2000, 2400, 2800, 3200]
SUPER_CODER = len(limits) - 1

input()
a = Counter(map(lambda x: get_color(int(x)), input().split()))
min_color_cnt = len([i for i in a if i < SUPER_CODER])
print(max(1, min_color_cnt), min_color_cnt + a[SUPER_CODER])

Solution (Python):
from collections import Counter
n=int(input())
a=list(map(int,input().split()))
l=[x//400 for x in a if x<3200]
free=len([x for x in a if x>=3200])
c=Counter(l)
print(max(len(c),1),len(c)+free)

Solution (Python):
n=int(input())
A=list(map(int,input().split()))
B=[]
C=[]
for i in range(n):
    for j in range(8):
        if (j*400)<=A[i]<((j+1)*400):
            B.append(j)
    if 3200<=A[i]:
        C.append(i)
print(max(len(set(B)),1),len(set(B))+len(C))

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

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

rates = [0 for _ in range(8)]
gold = 0
for a in A:
    rate = a // 400
    if rate < 8:
        rates[rate] += 1
    elif rate >= 8:
        gold += 1

ansMin = 8 - rates.count(0)
if ansMin == 0:
    ansMin = 1
ansMax = min(ansMin + gold, N)
print(str(ansMin) + ' ' + str(ansMax))

Solution (Python):
n=int(input())
A=list(map(int,input().split()))
B=[]
C=[]
for i in range(n):
    for j in range(8):
        if (j*400)<=A[i]<((j+1)*400):
            B.append(j)
    if 3200<=A[i]:
        C.append(i)
print(max(len(set(B)),1),len(set(B))+len(C))

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

over_3200 = 0
colors = {}
for x in a:
    if 1 <= x and x <= 399:
        colors.setdefault("grey", 0)
        colors["grey"] += 1
    elif 400 <= x and x <= 799:
        colors.setdefault("brown", 0)
        colors["brown"] += 1
    elif 800 <= x and x <= 1199:
        colors.setdefault("green", 0)
        colors["green"] += 1
    elif 1200 <= x and x <= 1599:
        colors.setdefault("sky", 0)
        colors["sky"] += 1
    elif 1600 <= x and x <= 1999:
        colors.setdefault("blue", 0)
        colors["blue"] += 1
    elif 2000 <= x and x <= 2399:
        colors.setdefault("yellow", 0)
        colors["yellow"] += 1
    elif 2400 <= x and x <= 2799:
        colors.setdefault("orange", 0)
        colors["orange"] += 1
    elif 2800 <= x and x <= 3199:
        colors.setdefault("red", 0)
        colors["red"] += 1
    else:
        over_3200 += 1

print(max(1, len(colors)), len(colors) + over_3200)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
l = [0] * 9
for i in a:
    if i >= 3200:
        l[8] += 1
    else:
        l[i // 400] += 1
mi = 0
ma = 0
for i in l[:8]:
    if i > 0:
        mi += 1
        ma += 1
if l[8] > 0:
    ma += l[8] 
if sum(l[:8]) == 0:
    print(1, l[8])
    exit()
print(mi, ma)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
l = [0] * 9
for i in a:
    if i >= 3200:
        l[8] += 1
    else:
        l[i // 400] += 1
mi = 0
ma = 0
for i in l[:8]:
    if i > 0:
        mi += 1
        ma += 1
if l[8] > 0:
    ma += l[8] 
if sum(l[:8]) == 0:
    print(1, l[8])
    exit()
print(mi, ma)

Solution (Python):
import sys

N = int(sys.stdin.readline().rstrip())
A = map(int, sys.stdin.readline().rstrip().split())

colors = set()
free = 0
for a_i in A:
    color = a_i // 400
    if color >= 8:
        free += 1
    else:
        colors.add(color)

n = len(colors)
print(max(n, 1), n + free)

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

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

clr = list(map(color, a))
n = len(set(clr))
if 8 not in clr:
    print('{} {}'.format(n, n))
else:
    free_cnt = clr.count(8)
    min_n = max(n-1, 1)
    
    max_n = n+free_cnt-1
    print('{} {}'.format(min_n, max_n))

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

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

    return N,A

def kans(N,A):
    
    min_cnt = 0
    max_cnt = 0
    flg_hai = 0
    flg_tya = 0
    flg_mido = 0
    flg_mizu = 0

    flg_ao = 0
    flg_ki = 0
    flg_dai = 0
    flg_red = 0


    for a in range(len(A)):
        if A[a] < 400 and flg_hai == 0:
            flg_hai = 1
            min_cnt += 1
            max_cnt += 1
        elif 400<= A[a] < 800 and flg_tya  == 0:
            flg_tya  = 1
            min_cnt += 1
            max_cnt += 1
        elif 800<= A[a] < 1200 and flg_mido  == 0:
            flg_mido  = 1
            min_cnt += 1
            max_cnt += 1
        elif 1200<= A[a] < 1600 and  flg_ao   == 0:
            flg_ao   = 1
            min_cnt += 1
            max_cnt += 1
        elif 1600<= A[a] < 2000 and flg_mizu   == 0:
            flg_mizu   = 1
            min_cnt += 1
            max_cnt += 1           
        elif 2000<= A[a] < 2400 and flg_ki   == 0:
            flg_ki   = 1
            min_cnt += 1
            max_cnt += 1            
        elif 2400<= A[a] < 2800 and flg_dai   == 0:
            flg_dai   = 1
            min_cnt += 1
            max_cnt += 1
        elif 2800<= A[a] < 3200 and flg_red   == 0:
            flg_red   = 1
            min_cnt += 1
            max_cnt += 1 
        elif 3200<= A[a]:
            if min_cnt == 0:
                min_cnt = 1
                max_cnt += 1
            else:
                max_cnt += 1
    print(min_cnt,max_cnt)



N,A = nyu()
kans(N,A)

Solution (Python):
n=int(input())
a=list(map(int, input().split()))
l=[x // 400 for x in a if x < 3200]
free=len([x for x in a if x >= 3200])
from collections import Counter
c=Counter(l)
print(max(len(c), 1), len(c) + free)

Solution (Python):
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
MOD = 10**9 + 7

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

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

cset=set()
free=0
for a in alist:
  if a>=3200:
    free+=1
  else:
    cset.add(a//400)


occupy=len(cset)
if occupy==0:
  print(1,occupy+free)
else:
  print(occupy,occupy+free)

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
free=[i for i in a if i>=3200]
rate=[399,799,1199,1599,1999,2399,2799,3199]
ans=0
before=0
for r in rate:
    for i in a:
        if before<i <=r:
            ans+=1
            before=r
            break
if len(a) == len(free):
    ans+=1
    print(ans,ans+len(free)-1)
else:
    print(ans,ans+len(free))

Solution (Python):
from sys import stdin


def main():
    n = int(stdin.readline())
    a = map(int, stdin.readline().split())
    r = [0] * 13
    for ai in a:
        r[int(ai / 400)] += 1
    min = 0
    for i in range(8):
        if r[i] > 0:
            min += 1
    max = min
    for i in range(8, 13):
        max += r[i]
    if min == 0:
        min = 1
    print(min, max)


if __name__ == "__main__":
    main()

Solution (Python):
import sys
readline = sys.stdin.readline

from collections import Counter


def main():
    N = int(readline())
    A = list(map(lambda x: int(x) // 400, readline().split()))
    B = [b for b in A if b > 7]
    A = set([a for a in A if a <= 7])
    n_min = len(A)
    n_max = n_min + len(B)
    print(max(1, n_min), n_max)


if __name__ == '__main__':
    main()

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

MX = 8
R = [0] * 9

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

cnt = 0
for i in range(8):
  if R[i]:
    cnt += 1

el = R[8]
print(max(cnt,1),cnt+el)

Solution (Python):
import sys

def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))
def MIIZ(): return list(map(lambda x: x-1, MII()))

def DD2(d1,d2,init=0): return [[init]*d2 for _ in range(d1)]
def DD3(d1,d2,d3,init=0): return [DD2(d2,d3,init) for _ in range(d1)]

def to_bin(x: int) -> str: return format(x, 'b') 
def to_oct(x: int) -> str: return format(x, 'o') 
def to_hex(x: int) -> str: return format(x, 'x') 
MOD=10**9+7
def divc(x,y) -> int: return -(-x//y)
def divf(x,y) -> int: return x//y
def gcd(x,y):
    while y: x,y = y,x%y
    return x
def lcm(x,y): return x*y//gcd(x,y)
def enumerate_divs(n):
    """Return a tuple list of divisor of n"""
    return [(i,n//i) for i in range(1,int(n**0.5)+1) if n%i==0]
def get_primes(MAX_NUM=10**3):
    """Return a list of prime numbers n or less"""
    is_prime = [True]*(MAX_NUM+1)
    is_prime[0] = is_prime[1] = False
    for i in range(2, int(MAX_NUM**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i*2, MAX_NUM+1, i):
            is_prime[j] = False
    return [i for i in range(MAX_NUM+1) if is_prime[i]]

from itertools import accumulate as acc, combinations as combi, product, combinations_with_replacement as combi_dup
from collections import deque, Counter
from heapq import heapify, heappop, heappush
from bisect import bisect_left

def color(r):
    if 1 <= r < 400:
        return 'gray'
    elif r < 800:
        return 'brown'
    elif r < 1200:
        return 'green'
    elif r < 1600:
        return 'lightblue'
    elif r < 2000:
        return 'blue'
    elif r < 2400:
        return 'yellow'
    elif r < 2800:
        return 'orange'
    elif r < 3200:
        return 'red'

def main():
    n = II()
    aa = MII()
    aa_u = [a for a in aa if a < 3200]
    aa_o = [a for a in aa if a >= 3200]
    u_type_num = len(set(map(color, aa_u)))
    o_type_num = len(aa_o)
    if u_type_num == 0:
        print('1 {}'.format(o_type_num))
    else:
        print('{} {}'.format(u_type_num, u_type_num+o_type_num))

if __name__ == '__main__':
    main()

Solution (Python):
def main():
    input()
    rate = [399, 799, 1199, 1599, 1999, 2399, 2799, 3199, 4800]
    t = list(map(int, input().split()))
    ret = {399: 0, 799: 0, 1199: 0, 1599: 0, 1999: 0, 2399: 0, 2799: 0, 3199: 0, 4800: 0}
    for v in t:
        for r in rate:
            if v <= r:
                ret[r] += 1
                break
    count = 0
    for k in ret:
        if ret[k] >= 1 and k != 4800:
            count += 1
    if count == 0:
        print(1, count + ret[4800])
    else:
        print(count, count + ret[4800])
    



if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
colors = [0]*9
for i in a:
    colors[min(i//400, 8)] += 1

mi = 0
for i in range(8):
    if colors[i]>0:
        mi += 1
if mi==0:
    mi = 1
    ma = colors[-1]
else:
    ma = mi+colors[-1]
print(mi, ma)

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
b = []
v = 0
for i in range(n):
    if a[i] < 3200:
        b.append(int(a[i]/400))
    else:
        v += 1
c = set(b)
mi = max(1,len(c))
ma = len(c)+v
print(mi,ma)

Solution (Python):
import sys
input = sys.stdin.readline


def read():
    N = int(input().strip())
    A = map(int, input().strip().split())
    return N, A

def solve(N, A):
    ranks = [0 for i in range(9)]
    for a in A:
        if a >= 3200:
            ranks[-1] += 1
        else:
            r = a // 400
            ranks[r] += 1
    n_colors = sum([r > 0 for r in ranks[:-1]])
    n_colors_max = n_colors + ranks[-1]
    n_colors_min = max(n_colors, 1)
    return " ".join(map(str, [n_colors_min, n_colors_max]))

if __name__ == '__main__':
    inputs = read()
    print(solve(*inputs))

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
rate=[0]*13
for i in a:
    rate[i//400]+=1
min = 0
for i in range(8):
    if rate[i]>0:
        min+=1

max = min + rate[8] + rate[9] + rate[10] + rate[11] + rate[12]
if min ==0:
    min=1
print(min,max)

Solution (Python):
col = [0, 399, 799, 1199, 1599, 1999, 2399, 2799, 3199]
flag = [False for _ in range(len(col))]
n = int(input())
a = list(map(int, input().split()))
cnt = 0
for i in range(n):
    for j in range(1, len(col)):
        if col[j-1] < a[i] <= col[j]:
            flag[j] = True
        if a[i] >= 3200:
            cnt += 1
            break
bs = flag.count(True)
mn = max(1, bs)
mx = bs+cnt
print(mn, mx)

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

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


ans = [0] * 8
hi_rate = 0

for i in range(n):
    buf = int(a[i]/400)
    if buf <= 7:
        ans[buf] += 1
    else:
        hi_rate += 1

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

if low_rate == 0:
    minm = 1
    maxm = hi_rate
else:
    minm = low_rate
    maxm = low_rate + hi_rate




print(str(minm) + ' ' + str(maxm))

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

L = []
for i, v in enumerate(A):
    if (1 <= v and v <= 399):
        L.append('灰色')
    elif(400 <= v and v <= 799):
        L.append('茶色')
    elif(800 <= v and v <= 1199):
        L.append('緑色')
    elif(1200 <= v and v <= 1599):
        L.append('水色')
    elif(1600 <= v and v <= 1999):
        L.append('青色')
    elif(2000 <= v and v <= 2399):
        L.append('黄色')
    elif(2400 <= v and v <= 2799):
        L.append('橙色')
    elif(2800 <= v and v <= 3199):
        L.append('赤色')
    else:
        L.append('自由')

J = [i for i in L if i == '自由']
L = list(set(L))
if ('自由' in L):
    L.remove('自由')
if (len(L) == 0 and len(J) != 0):
    L.append('自由')
    J.pop(0)
print(len(L), len(L) + len(J))

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
b=[]
cnt = 0
for i in range(n):
    if a[i]>=3200:
        cnt+=1
    else:
        for j in range(1,9):
            if a[i]<400*j:
                b.append(j)
                break
if len(set(b))==0:
    print(1,cnt)
else:
    print(len(set(b)),len(set(b))+cnt)

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
colors = set()
kami = 0
for i in range(n):
    if 1 <= a[i] <= 399:
        colors.add('hai')
    elif 400 <= a[i] <= 799:
        colors.add('cha')
    elif 800 <= a[i] <= 1199:
        colors.add('midori')
    elif 1200 <= a[i] <= 1599:
        colors.add('mizu')
    elif 1600 <= a[i] <= 1999:
        colors.add('ao')
    elif 2000 <= a[i] <= 2399:
        colors.add('kiiro')
    elif 2400 <= a[i] <= 2799:
        colors.add('daidai')
    elif 2800 <= a[i] <= 3199:
        colors.add('aka')
    else:
        kami += 1
if kami == 0:
    print(len(colors),len(colors))
else:
    print(max(len(colors), 1), len(colors)+kami)

Solution (Python):
def color(num: int) -> int:
    if 1 <= num <= 399:
        return 0
    if 400 <= num <= 799:
        return 1
    if 800 <= num <= 1199:
        return 2
    if 1200 <= num <= 1599:
        return 3
    if 1600 <= num <= 1999:
        return 4
    if 2000 <= num <= 2399:
        return 5
    if 2400 <= num <= 2799:
        return 6
    if 2800 <= num <= 3199:
        return 7
    if 3200 <= num:
        return 8


n = int(input())
a = list(map(int, input().split()))
arr = []
certain = 0
for num in a:
    col = color(num)
    if col == 8:
        certain += 1
    else:
        arr.append(col)

color_count = len(set(arr))
if color_count == 0:
    print(1, certain)
else:
    print(color_count, color_count + certain)

Solution (Python):
import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    N = int(readline())
    A = list(map(int, readline().split()))
    d = defaultdict(int)
    free = 0
    for i in range(N):
        if 1<=A[i]<400:
            d['gray'] += 1
        elif 400<=A[i]<800:
            d['brown'] += 1
        elif 800<=A[i]<1200:
            d['green'] += 1
        elif 1200<=A[i]<1600:
            d['light_blue'] += 1
        elif 1600<=A[i]<2000:
            d['blue'] += 1
        elif 2000<=A[i]<2400:
            d['yellow'] += 1
        elif 2400<=A[i]<2800:
            d['orange'] += 1
        elif 2800<=A[i] < 3200:
            d['red'] += 1
        else:
            free += 1
    ans_min = max(len(d.keys()), 1)
    ans_max = len(d.keys())+free
    print(ans_min, ans_max)


if __name__ == '__main__':
    main()

Solution (Python):
N = int(input())
a = list(map(int, input().split()))
L = [False]*8
cnt = 0
for i in range(N):
    for j in range(8):
        if j*400 <= a[i] <= j*400+399:
            L[j] = True
    if a[i] >= 3200:
        cnt += 1
if L.count(1):
    minnum = L.count(1)
else:
    minnum = 1
maxnum = min(N, minnum+cnt)
print(minnum, maxnum)

Solution (Python):
n = int(input())
l = list(map(int,input().split()))
color = [0]*9
def col(x):
  if 1<=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
  elif x>=3200:
    return 8
  
for i in l:
  a = col(i)
  color[a] += 1
color2 = [1 for i in color if i!=0]
if color[8]==0:
  print(len(color2),len(color2))
else:
  print(max(len(color2)-1,1),len(color2)-1+color[8])

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

Solution (Python):
N = int(input())
a = list(map(int, input().split()))
ans = [0] * 8
free = 0

for r in a:
    if r > 3199:
        free += 1
    else:
        ans[r // 400] = 1

min_ = max(sum(ans), 1)

max_ = sum(ans) + free
print(min_, max_)

Solution (Python):
A = int(input())
colors = [0] * 8
l_n = list(map(int,input().split()))
if [i for i in l_n if 1 <= i <= 399] != []:
        colors[0] = 1
for j in range(1,8):
    if [i for i in l_n if 0+(j*400) <= i <= 399+(j*400)] != []:
        colors[j] = 1
ans_m = colors.count(1)
all_colors = len([i for i in l_n if 3200 <= i])
if all_colors == A:
    print(1,all_colors)
else:
    print(ans_m,ans_m+all_colors)

Solution (Python):
colors=[0]*8
n=int(input())
a=list(map(int,input().split()))
wild=0
for i in range(n):
  index=a[i]//400
  if a[i]>=3200:
    wild+=1
  else:
    colors[index]=1
ans1=sum(colors)
ans2=sum(colors)
ans1+=wild
if ans2==0 and wild>0:
  ans2=1
print(ans2,' ',ans1)