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

N = int(input())
A = list(map(int, input().split()))
color = [0,0,0,0,0,0,0,0]
overColor = 0
Min = 0
Max = 0

for i in range(N):
    if 1 <= A[i] <= 399:
        color[0] += 1
    elif 400 <= A[i] <= 799:
        color[1] += 1
    elif 800 <= A[i] <= 1199:
        color[2] += 1
    elif 1200 <= A[i] <= 1599:
        color[3] += 1
    elif 1600 <= A[i] <= 1999:
        color[4] += 1
    elif 2000 <= A[i] <= 2399:
        color[5] += 1
    elif 2400 <= A[i] <= 2799:
        color[6] += 1
    elif 2800 <= A[i] <= 3199:
        color[7] += 1
    else:
        overColor += 1

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

if(overColor == 0):
    print(str(count) + " " + str(count))
else:
    if(count == 0):
        print("1 " + str(overColor))
    else:
        print(str(count) + " " + str(count + overColor))

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

colors = [0]*9
for a in A:
    colors[min(8, a//400)] += 1
ansmin = 0
for c in colors[:-1]:
    if c:
        ansmin += 1
x = 0
if ansmin < colors[-1]:
    x = 1
print("{} {}".format(max(ansmin, x), ansmin+colors[-1]))

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
B = [0]*9
for a in A:
    k = 0
    while a>=400*k:
        k+=1
        if k>8:break
    B[k-1]+=1
a = B[8]
B = [1 for b in B[:8] if b>0]
print(max(1,sum(B)),sum(B)+a)

Solution (Python):
import sys
import heapq
import re
from itertools import permutations
from bisect import bisect_left, bisect_right
from collections import Counter, deque
from fractions import gcd
from math import factorial, sqrt
from functools import lru_cache
INF = 1 << 60
mod = 1000000007
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline


class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


def dijkstra_heap(s, edge, n):
    
    d = [10**20] * n
    used = [True] * n 
    d[s] = 0
    used[s] = False
    edgelist = []
    for a,b in edge[s]:
        heapq.heappush(edgelist,a*(10**6)+b)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        
        if not used[minedge%(10**6)]:
            continue
        v = minedge%(10**6)
        d[v] = minedge//(10**6)
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,(e[0]+d[v])*(10**6)+e[1])
    return d


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



n = int(input())
a = list(map(int, input().split()))
s = [0] * 8
cnt = 0
for i in a:
    if i < 3200:
        s[i // 400] = 1
    else:
        cnt += 1

maximum = sum(s) + cnt
minimum = max(sum(s), 1)
print(minimum, maximum)

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

cnt1 = 0
for i in range(8):
  v1 = i * 400
  v2 = (i + 1) * 400 - 1
  for j in range(N):
    if v1 <= A[j] and A[j] <= v2:
      cnt1 += 1
      break

cnt2 = 0
for i in range(N):
  if A[i] >= 3200:
    cnt2 += 1

if cnt1 == 0:
  print(1, cnt2)
else:
  print(cnt1, cnt1 + cnt2)

Solution (Python):
from collections import Counter
from bisect import bisect_left

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

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

color = Counter()
for a in A:
    i = bisect_left(rate, a)
    color[i] += 1


L = len(list(color.keys()))
if color[8] > 0:
    print(max(L - 1, 1), L - 1 + color[8])
else:
    print(L, L)

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

ans = [0] * 9
for ai in a:
    if ai // 400 > 7:
        ans[8] += 1
    else:
        ans[ai // 400] = 1

print(max(1, sum(ans[:-1])), sum(ans))

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

color = [0]*9

for rate in a:
    if rate >= 3200:
        color[8] += 1
    else:
        color[rate//400] += 1
    
ans = 0

for i in range(8):
        if color[i] > 0:
            ans += 1
print(max(ans,1),ans + color[8])

Solution (Python):
n = int(input())
v = list(map(int, input().split()))
c = [0] * 9
for i in range(0, n):
  if v[i] >= 3200:
    c[8] += 1
  else:
    c[v[i]//400] += 1
a = 0
for i in range(0, 8):
  if c[i] > 0:
    a += 1
print(max(a, 1), a+c[8])

Solution (Python):


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



X=[0 for i in range(8)]
Y=0
for i in A:
    if i<400:
        X[0]=1
    elif i<800:
        X[1]=1
    elif i<1200:
        X[2]=1
    elif i<1600:
        X[3]=1
    elif i<2000:
        X[4]=1
    elif i<2400:
        X[5]=1
    elif i<2800:
        X[6]=1
    elif i<3200:
        X[7]=1
    else:
        Y+=1
if sum(X)==0:
    print(1,Y)
else:
    print(sum(X),sum(X)+Y)

Solution (Python):
N = int(input())
a = list(map(int, input().split()))
li = [0] * 8
ans = 0
cnt = 0
for x in a:
    if x // 400 < 8:
        li[x//400] += 1
    else:
        cnt += 1
for i in range(8):
    if li[i] > 0:
        ans += 1

r = [max(1,ans), ans+cnt]
print(*r)

Solution (Python):
N = int(input())
a = list(map(int,(input().split())))
r = []
c = 0
for i in range(N):
    if a[i] >= 3200:
        c += 1
    else:
        r.append(a[i]//400)

nim = len(set(r))
ansm = max(1,nim)
ansM = nim + c
print(ansm,ansM)

Solution (Python):
import numpy as np
n=int(input())
a=list(map(int,input().split()))
a=np.array(a)
a=a//400
a1=[i for i in a if i<8]
a2=[i for i in a if i>=8]
k=len(set(a1))
m=k+len(a2)

if len(set(a1))!=0:s=len(set(a1))
else:s=1
print(s,m)

Solution (Python):
def solve(a):
 
    colors = [0]*9
 
    for i in a:
        num = 0
        tmp = 400
        flag = True
        for j in range(9):
            if i < 0:
                flag = False
                break
            else:
                i -= 400
                num += 1
        if flag:
            colors[num-1] += 1
        else:
            colors[num-1] = 1
    if sum(colors[:8]) == 0:
        print(1,colors[-1])
    else:
        print(sum(colors[:8]),sum(colors[:8])+colors[-1])
 
def main():
    N = int(input())
    a = list(map(int,input().split()))
    solve(a)
 
if __name__ == "__main__":
    main()

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

scores = [int(i) for i in input().split()]

under_3200_cnt = {}
over_3200_cnt = 0
for score in scores:
    key = score // 400
    if key >= 8:
        over_3200_cnt += 1
    else :
        under_3200_cnt.setdefault(key, 0)
        under_3200_cnt[key] += 1
        
colors = len(under_3200_cnt.keys())

if over_3200_cnt == 0:
    min_color = colors
    max_color = colors
else :
    if colors >= 1:
        min_color = colors
    else :
        min_color = 1
    max_color = colors + over_3200_cnt
    
print(min_color, max_color)

Solution (Python):
import sys
n = int(input())
a = list(map(int, input().split()))
b = []
count = 0
for i in range (len(a)):
    if (a[i] < 3200):
        b.append(a[i]//400)
    else:
        count += 1
if (len(b)==0):
    print(*[1,count])
    sys.exit()
b_set = set(b)
ans = [len(b_set),len(b_set)+count]
print(*ans)

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
A.sort()
flags = [False] * 8
min_ans = 1
high_coder = 0
for i in range(N):
    idx = A[i] // 400
    if idx < 8:
        flags[idx] = True
        min_ans = sum(flags)
    else:
        high_coder = N - i
        break

print(min_ans, sum(flags) + high_coder)

Solution (Python):


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

    cnt = [False] * 8
    tuyo = 0
    for i in range(N):
        if 1 <= A[i] <= 3199:
            cnt[A[i] // 400] = True
        else:
            tuyo += 1

    val = 0
    for i in cnt:
        if i:
            val += 1
    if val==0 and tuyo>0:
        print(1,tuyo)
    else:
        print(val, val + tuyo)


resolve()

Solution (Python):
def main():
    n = int(input())
    a = list(map(int,input().split()))
    ary = [0] * 8
    tmp = 0
    for i, aa in enumerate(a):
        if 0 < aa <= 399 and ary[0] == 0:
            ary[0] = 1
        elif 399 < aa <= 799 and ary[1] == 0:
            ary[1] = 1
        elif 799 < aa <= 1199 and ary[2] == 0:
            ary[2] = 1
        elif 1199 < aa <= 1599 and ary[3] == 0:
            ary[3] = 1
        elif 1599 < aa <= 1999 and ary[4] == 0:
            ary[4] = 1
        elif 1999 < aa <= 2399 and ary[5] == 0:
            ary[5] = 1
        elif 2399 < aa <= 2799 and ary[6] == 0:
            ary[6] = 1
        elif 2799 < aa <= 3199 and ary[7] == 0:
            ary[7] = 1
        elif 3199 < aa:
            tmp += 1
            
    if sum(ary) == 0:
        print(1,tmp)
    else:
        print(sum(ary), sum(ary) + tmp)

if __name__ =='__main__':
    main()

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

def flag(l,r):
    return 1 if [a for a in A if l <= a <= r] else 0

ans = 0
for l in range(0,2801, 400):
    ans += flag(l, l + 399)

ans1 = ans + len([a for a in A if a >= 3200])
if ans == 0:
    print(1,ans1)
else:
    print(ans,ans1)

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

cnt = [0]*8
ziyu = 0
for a in A:
    if 1 <= a <= 399 and cnt[0] == 0:
        cnt[0] = 1
    elif 400 <= a <= 799 and cnt[1] == 0:
        cnt[1] = 1
    elif 800 <= a < 1199 and cnt[2] == 0:
        cnt[2] = 1
    elif 1200 <= a <= 1599 and cnt[3] == 0:
        cnt[3] = 1
    elif 1600 <= a <= 1999 and cnt[4] == 0:
        cnt[4] = 1
    elif 2000 <= a <= 2399 and cnt[5] == 0:
        cnt[5] = 1
    elif 2400 <= a <= 2799 and cnt[6] == 0:
        cnt[6] = 1
    elif 2800 <= a <= 3199 and cnt[7] == 0:
        cnt[7] = 1
    elif a >= 3200:
        ziyu += 1

min_cnt = 0
if ziyu > 0:
    min_cnt = 1

print(max(min_cnt, sum(cnt)), sum(cnt)+ziyu)

Solution (Python):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]
debugmode = False

n = INT()
a = LIST()
arr = []
plus = 0
for i in range(n):
    flag = True
    for j in range(1, 9):
        if (j - 1) * 400 <= a[i] < j * 400:
            if not j in arr:
                arr.append(j)
            flag = False
    if flag:
        plus += 1
debug(len(arr), plus, arr)
ansmx = len(arr) + plus
ansmn = max(1, len(arr))
print(ansmn, ansmx)

Solution (Python):
n = int(input())
col = [399, 799, 1199, 1599, 1999, 2399, 2799, 3199]
a = list(map(int,input().split()))
col_set = set()
cnt = 0
for i in range(n):
    if a[i] >= 3200:
        cnt += 1
    for j in range(len(col)):
        if a[i] <= col[j]:
            col_set.add(j)
            break
print(max(len(col_set), 1), len(col_set)+cnt)

Solution (Python):
N = int(input())
an = list(map(int, input().split()))
over_cnt = 0
colors = []
for a in an:
    rate = a // 400
    if rate >= 8:
        over_cnt += 1
    elif rate not in colors:
        colors.append(rate)
 
print(max(len(colors), 1), len(colors) + over_cnt)

Solution (Python):
def main():
    _ = int(input())
    a = list(map(int,input().split()))
    l = [0] * 9
    for v in a :
        if v//400 >=8:
            l[-1] +=1
        else:
            l[v//400] += 1
    cnt = 0
    for i in range(len(l)-1):
        if l[i] != 0: cnt+=1

    mx = cnt + l[-1]
    mn = cnt if cnt != 0 else 1 if l[-1] != 0 else 0
    print("{} {}".format(str(mn),str(mx)))

if __name__ == '__main__':
    main()

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

color = []
another = 0
for i in range(N):
  if a[i] <= 399: color.append("gray")
  elif a[i] <= 799: color.append("brown")
  elif a[i] <= 1199: color.append("green")
  elif a[i] <= 1599: color.append("wblue")
  elif a[i] <= 1999: color.append("blue")
  elif a[i] <= 2399: color.append("yellow")
  elif a[i] <= 2799: color.append("orange")
  elif a[i] <= 3199: color.append("red")
  else: another +=1
color = list(set(color))
ans = len(color)
if ans == 0 and another > 0:
  ans = 1
print(ans, len(color) + another)

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

print(sum(c[:8])+(1 if c[8] and sum(c[:8])==0 else 0),sum(c[:8])+c[8])

Solution (Python):
N=int(input())
*A,=map(int, input().split())
col = [0]*8
free=0
for a in A:
    for i in range(8):
        if 400*i <= a < 400*(i+1): col[i] = 1
    if a >= 3200: free+=1

print(1 if sum(col) == 0 and free else sum(col), sum(col)+free)

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

if len(B) == 0 and cnt != 0:
    print(1, cnt)
else:
    print(len(set(B)), len(set(B))+cnt)

Solution (Python):
def main():
    N = int(input())
    A = [int(i) for i in input().split()]
    cnt = [0]*9
    for a in A:
        idx = min(a//400, 8)
        cnt[idx] += 1
    ans = sum(int(a > 0) for a in cnt[:-1])
    if ans != 0:
        print(ans, ans+cnt[-1])
    else:
        print(1, cnt[-1])


if __name__ == '__main__':
    main()

Solution (Python):
n=int(input())
A=list(map(int,input().split()))
B=[0,0,0,0,0,0,0,0]
free=int(0)
for i in range(n):
    if A[i]>=3200:
        free+=1
    else:
        now=int(A[i]/400)
        B[now]+=1
s=B.count(0)
s=8-s
if s==0:
    s=1
    free-=1
print("{} {}".format(s,s+free))

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

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

mx = len(ans) + cnt
mi = max(1, len(ans))

print(mi, mx)

Solution (Python):
import sys

def solve():
    input = sys.stdin.readline
    Rate = [0] * 9
    N = int(input())
    A = [int(a) for a in input().split()]
    for a in A: Rate[min(8, a // 400)] += 1
    count = 0
    for i in range(8):
        if Rate[i] > 0: count += 1
    minC, maxC = count, count + Rate[8]
    if count == 0: minC = 1
    print(minC, maxC)

    return 0

if __name__ == "__main__":
    solve()

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
cs = [0]*9
for a in A:
    if a >= 3200:
        cs[8] += 1
    else:
        cs[a//400] += 1

fixed = 0
for i in range(8):
    if cs[i]: fixed += 1

if fixed:
    print(fixed, fixed + cs[8])
else:
    print(1, cs[8])

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
count = 0
color = set()
for i in range(n):
    if a[i]<400:
        color.add("a")
    elif a[i]<800:
        color.add("b")
    elif a[i]<1200:
        color.add("c")
    elif a[i]<1600:
        color.add("d")
    elif a[i]<2000:
        color.add("e")
    elif a[i]<2400:
        color.add("f")
    elif a[i]<2800:
        color.add("g")
    elif a[i]<3200:
        color.add("h")
    else:
        count += 1
if len(color) == 0:
    print(1, count)
else:
    print(len(color), len(color)+count)

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

rt=[0]*8
rt8=0
for i in range(n):
    for j in range(0,8):
        if 400*j<=a[i] and a[i]<=399+400*j:
            rt[j]=1
    if a[i]>=3200:
        rt8=rt8+1
        
rtmin=max(1,sum(rt))

rtmax=sum(rt)+rt8

print(rtmin,rtmax)

Solution (Python):
n = int(input())
lst = list(map(int, input().split()))
count = {"gray":0,"brown":0,"green":0,"lightblue":0,"blue":0,"yellow":0,"orange":0,"red":0}
free = 0

for i in lst:
    if i<400:
        count["gray"]+=1
    elif i<800:
        count["brown"]+=1
    elif i<1200:
        count["green"]+=1
    elif i<1600:
        count["lightblue"]+=1
    elif i<2000:
        count["blue"]+=1
    elif i<2400:
        count["yellow"]+=1
    elif i<2800:
        count["orange"]+=1
    elif i<3200:
        count["red"]+=1
    else:
        free+=1

ans = 0
for i in count.values():
    if i!=0:
        ans+=1

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

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
color = [399, 799, 1199, 1599, 1999, 2399, 2799, 3199, 4800]
num = [0]*9
for i in a:
    for j in range(9):
        if i<=color[j]:
            num[j]+=1
            break
s = [1 for i in num[:8] if i>0]
print(max(sum(s), 1), sum(s)+num[8])

Solution (Python):
n = int(input())
a_list = list(map(int, input().split()))
r_list = [0]*9
for a in a_list:
	if a < 400:
		r_list[0] += 1
	elif a < 800:
		r_list[1] += 1
	elif a < 1200:
		r_list[2] += 1
	elif a < 1600:
		r_list[3] += 1
	elif a < 2000:
		r_list[4] += 1
	elif a < 2400:
		r_list[5] += 1
	elif a < 2800:
		r_list[6] += 1
	elif a < 3200:
		r_list[7] += 1
	else:
		r_list[8] += 1
min_count = 0
super_r = r_list.pop(-1)
for r in r_list:
	if r > 0:
		min_count += 1
max_count = super_r + min_count
if min_count == 0 and super_r > 0:
	min_count = 1
print(min_count, max_count)

Solution (Python):
import math
import string
import collections
from collections import Counter
from collections import deque


def readints():
    return list(map(int, input().split()))


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor



dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]
N = int(input())
a = readints()


def minimum(l):
    c = 0
    for i in range(len(l)):
        if l[i] == 'choose':
            c += 1
    if len(l) == c:
        return 1
    while 'choose' in l:
        l.remove('choose')
        
    x = list(set(l))
    return len(x)


color = []
for i in range(N):
    if 1 <= a[i] and a[i] <= 399:
        color.append('gray')
    elif 400 <= a[i] and a[i] <= 799:
        color.append('brown')
    elif 800 <= a[i] and a[i] <= 1199:
        color.append('green')
    elif 1200 <= a[i] and a[i] <= 1599:
        color.append('light blue')
    elif 1600 <= a[i] and a[i] <= 1999:
        color.append('blue')
    elif 2000 <= a[i] and a[i] <= 2399:
        color.append('yellow')
    elif 2400 <= a[i] and a[i] <= 2799:
        color.append('orange')
    elif 2800 <= a[i] and a[i] <= 3199:
        color.append('red')
    elif 3200 <= a[i]:
        color.append('choose')
cnt = color.count('choose')
while 'choose' in color:
    color.remove('choose')
print(minimum(color), len(set(color))+cnt)

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

Solution (Python):
N = int(input())
a = list(map(int, input().split()))
 
color = ["gray","braun","green","watter","bruee","yellow","orange","red"]
 
lis = []
 
count = 0
 
for i in a:
    if 1 <= i <=399:
        lis.append("gray")
    
    if 400 <= i <= 799:
        lis.append("braun")
    
    if 800 <= i <= 1199:
        lis.append("green")
    
    if 1600 <= i <= 1999:
        lis.append("bruee")
 
    if 1200 <= i <= 1599:
        lis.append("watter")
    
    if 2000 <= i <= 2399:
        lis.append("yellow")
    
    if 2400 <= i <= 2799:
        lis.append("orange")
 
    if 2800 <= i <= 3199:
        lis.append("red")
    if 3200 <= i:
        count = count + 1
 
mincase = len(set(lis))
 
if len(set(lis)) == 0:
    mincase = 1
else:
    mincase = len(set(lis))
 
maxcase = len(set(lis)) + count
 
print(mincase , '', maxcase)

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

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

print(max(sum(counter), 1), end = " ")
print(sum(counter) + colorfulcounter)

Solution (Python):
import collections
n = int(input())
A  = list(map(int,input().split()))
A.sort()
co = collections.Counter()
for a in A:
    tag = a//400
    if tag >=8:
        tag = 8
    co[tag] +=1
ans = 0
q = 0
for tag,num in co.items():
    if tag==8:
        q = num
    else:
        ans+=1
print(max(ans,1),ans+q)

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

b = [val//400 for val in a]

c = set(b)

over=len([val for val in b if val >= 8])
under=[val for val in b if val <8]
if over:
    M=len(set(under))+over
    m=len(set(under))
    if m == 0:
        m=1
else:
    M=len(c)
    m=len(c)
print(m, M)

Solution (Python):
N = int(input())
a_list = list(map(int, input().split()))
color_dic = {"gray":False, "brown":False, "green":False, "thin_blue":False, "blue":False, "yellow":False, "orange":False, "red":False, "legend":0}
for i in a_list:
    if 1<=i and i<=399:
       color_dic["gray"] = True
    elif 400<=i and i<=799:
        color_dic["brown"] = True
    elif 800<=i and i<=1199:
        color_dic["green"] = True
    elif 1200<=i and i<=1599:
        color_dic["thin_blue"] = True
    elif 1600<=i and i<=1999:
        color_dic["blue"] = True
    elif 2000<=i and i<=2399:
        color_dic["yellow"] = True
    elif 2400<=i and i<=2799:
        color_dic["orange"] = True
    elif 2800<=i and i<=3199:
        color_dic["red"] = True
    else:
        color_dic["legend"] += 1
ans = 0
for k, v in color_dic.items():
    if k!="legend":
        if v==True:
            ans += 1
ans_min = ans
ans += color_dic["legend"]
if ans_min == 0:
    if color_dic["legend"]>=1:
        ans_min = 1
print(ans_min, ans)

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

ans = 0
a_1 = 0
a_2 = 0
a_3 = 0
a_4 = 0
a_5 = 0
a_6 = 0
a_7 = 0
a_8 = 0
add = 0
for i in range(n):
    if a[i]  < 400 and a_1 == 0:
        a_1 = 1
        ans +=1
    elif a[i]  < 800 and a[i] >= 400 and a_2 == 0:
        a_2 = 1
        ans +=1
    elif a[i]  < 1200 and a[i] >= 800 and a_3 == 0:
        a_3 = 1
        ans +=1
    elif a[i]  < 1600 and a[i] >= 1200 and a_4 == 0:
        a_4 = 1
        ans +=1
    elif a[i]  < 2000 and a[i] >= 1600 and a_5 == 0:
        a_5 = 1
        ans +=1
    elif a[i]  < 2400 and a[i] >= 2000 and a_6 == 0:
        a_6 = 1
        ans +=1
    elif a[i]  < 2800 and a[i] >= 2400 and a_7 == 0:
        a_7 = 1
        ans +=1
    elif a[i]  < 3200 and a[i] >= 2800 and a_8 == 0:
        a_8 = 1
        ans +=1
    elif a[i] >= 3200:
        add +=1



if ans == 0 and add >=8:
    print('1 8')
elif ans == 0:
    print('1 '+str(add))


else:
    print(str(ans)+' '+str(ans+add))

Solution (Python):
import sys

stdin = sys.stdin
inf = 1 << 60
mod = 1000000007

ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

from collections import defaultdict

n = ni()
a = na()
dic = defaultdict(int)

def color(n):
    if n >= 1 and n <= 399:
        return "a"
    if n >= 400 and n <= 799:
        return "b"
    if n >= 800 and n <= 1199:
        return "c"
    if n >= 1200 and n <= 1599:
        return "d"
    if n >= 1600 and n <= 1999:
        return "e"
    if n >= 2000 and n <= 2399:
        return "f"
    if n >= 2400 and n <= 2799:
        return "g"
    if n >= 2800 and n <= 3199:
        return "h"
    return "z"

for i in range(n):
    c = color(a[i])
    if c != "z" and dic[c] >= 1:
        continue
    dic[color(a[i])] += 1

ansmin = max(1, sum(dic.values()) - dic["z"])
ansmax = sum(dic.values())
print(ansmin, ansmax)

Solution (Python):
def resolve():
    N = int(input())
    A = list(map(int, input().split()))
    ls = [False] * 8
    cnt = 0
    for i in A:

        if i < 3200:
            ls[i // 400] = True
        else:
            cnt += 1

    if ls.count(True) == 0:
        if cnt == 0:
            minval = 0
        else:
            minval = 1
    else:
        minval = ls.count(True)

    if ls.count(False) <= cnt:
        maxval = 8+cnt-ls.count(False)
    else:
        maxval = 8 - (ls.count(False) - cnt)

    print(minval, maxval)


resolve()

Solution (Python):
n = input()
d = [0 for _ in range(9)]
seq = [int(x) for x in input().split()]
for val in seq:
    val = min(val, 3300)
    d[(val // 400)] += 1
a = sum(1 for val in d[:-1] if val > 0)
print(max(1,a), a + d[-1])

Solution (Python):
N= int(input())
a_li = list(map(int,input().split()))
a_conv = []
for i in a_li:
    if 1 <= i <= 399:
        a_conv.append(1)
    elif 400 <= i <= 799:
        a_conv.append(2)
    elif 800 <= i <= 1199:
        a_conv.append(3)
    elif 1200 <= i <= 1599:
        a_conv.append(4)
    elif 1600 <= i <= 1999:
        a_conv.append(5)
    elif 2000 <= i <= 2399:
        a_conv.append(6)
    elif 2400 <= i <= 2799:
        a_conv.append(7)
    elif 2800 <= i <= 3199:
        a_conv.append(8)
    elif 3200 <= i:
        a_conv.append(9)
free = a_conv.count(9)
ans_min = 0
ans_max = 0
if free == len(a_conv):
    ans_min = 1
    ans_max = free
else:
    for i in range(1,9):
        if i in a_conv:
            ans_min += 1
    ans_max = ans_min + free
print(ans_min,ans_max)

Solution (Python):
def main():
    n = int(input())
    a = list(map(int, input().split()))
    color = set()
    free = 0
    for score in a:
        if score < 3200:
            color.add(score//400)
        else:
            free += 1
    print(max(len(color),1), len(color)+free)
if __name__ == "__main__":
    main()

Solution (Python):
def main():
    n = int(input())
    a = list(map(int, input().split()))
    color = [False] * 8
    sub_color = 0
    for score in a:
        for i in range(8):
            if i*400 <= score <= 399+(i*400):
                color[i] = True
        if score >= 3200:
            sub_color += 1
    cnt = len([x for x in color if x])
    if cnt == 0:
        print(1, sub_color, sep=" ")
    else:
        print(cnt, cnt+sub_color, sep=" ")

if __name__ == "__main__":
    main()

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

color = [False] * 8
cnt = 0
for i in range(N):
    if a[i] <= 399:
        color[0] = True
    elif a[i] <= 799:
        color[1] = True
    elif a[i] <= 1199:
        color[2] = True
    elif a[i] <= 1599:
        color[3] = True
    elif a[i] <= 1999:
        color[4] = True
    elif a[i] <= 2399:
        color[5] = True
    elif a[i] <= 2799:
        color[6] = True
    elif a[i] <= 3199:
        color[7] = True
    elif a[i] <= 4800:
        cnt += 1

print(max(1, sum(color)), sum(color) + cnt)

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

ls2 = [i // 400 for i in list(s)]
ls3 = [ 8 if i >8 else i for i in ls2]
ls4 = [i for i in ls3 if i  != 8 ]

import collections
c3 = collections.Counter(ls3)
c4 = collections.Counter(ls4)
print(str(max(len(c4),1)) + " " + str(len(c4)+c3[8]))