Problem:
 Score : 300 points    Problem Statement In AtCoder, a person who has participated in a contest receives a color , which corresponds to the person's rating as follows:   Rating 1 - 399 : gray  Rating 400 - 799 : brown  Rating 800 - 1199 : green  Rating 1200 - 1599 : cyan  Rating 1600 - 1999 : blue  Rating 2000 - 2399 : yellow  Rating 2400 - 2799 : orange  Rating 2800 - 3199 : red   Other than the above, a person whose rating is 3200 or higher can freely pick his/her color, which can be one of the eight colors above or not. Currently, there are N users who have participated in a contest in AtCoder, and the i -th user has a rating of a_i . Find the minimum and maximum possible numbers of different colors of the users.      Constraints  1 ≤ N ≤ 100  1 ≤ a_i ≤ 4800  a_i is an integer.         Input Input is given from Standard Input in the following format:  N  a_1  a_2  ...  a_N       Output Print the minimum possible number of different colors of the users, and the maximum possible number of different colors, with a space in between.        Sample Input 1 4
2100 2500 2700 2700      Sample Output 1 2 2  The user with rating 2100 is "yellow", and the others are "orange". There are two different colors.       Sample Input 2 5
1100 1900 2800 3200 3200      Sample Output 2 3 5  The user with rating 1100 is "green", the user with rating 1900 is blue and the user with rating 2800 is "red". If the fourth user picks "red", and the fifth user picks "blue", there are three different colors. This is one possible scenario for the minimum number of colors. If the fourth user picks "purple", and the fifth user picks "black", there are five different colors. This is one possible scenario for the maximum number of colors.       Sample Input 3 20
800 810 820 830 840 850 860 870 880 890 900 910 920 930 940 950 960 970 980 990      Sample Output 3 1 1  All the users are "green", and thus there is one color.

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

def main():
    N = int(readline())
    A = list(map(int, readline().rstrip().split()))
    cnt = {k: 0 for k in ['gray', 'brown', 'green', 'light_blue', 'blue', 'yellow', 'orange', 'red', 'free']}
    for a in A:
        if a < 400:
            cnt['gray'] += 1
        elif a < 800:
            cnt['brown'] += 1
        elif a < 1200:
            cnt['green'] += 1
        elif a < 1600:
            cnt['light_blue'] += 1
        elif a < 2000:
            cnt['blue'] += 1
        elif a < 2400:
            cnt['yellow'] += 1
        elif a < 2800:
            cnt['orange'] += 1
        elif a < 3200:
            cnt['red'] += 1
        else:
            cnt['free'] += 1

    mi = 0
    for k, v in zip(cnt.keys(), cnt.values()):
        if k == 'free':
            continue
        if v:
            mi += 1
    ma = mi + cnt['free']
    print(max(1, mi), ma)    


if __name__ == '__main__':
    main()

Solution (Python):
n, *a = map(int, open(0).read().split())
l = [i//400 for i in a if i<3200]
k = len(set(l))
print(k or 1, n - len(l) + k)

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

Solution (Python):
N = int(input())
a = list(map(int, input().split()))
c = [0] * 8
s = 0
for i in a:
    if i >= 3200:
        s += 1
    else:
        c[i // 400] = 1
sum_c = sum(c)
if sum_c:
    print('{} {}'.format(sum_c, sum_c + s))
else:
    print('{} {}'.format(min(1, s), s))

Solution (Python):
def resolve():
    '''
    code here
    最小値が0にはならないので1 or 計算結果にするとところが味噌
    上記を忘れていると全ての値が3200を超えていた時にバグる
    '''
    import collections

    N = int(input())
    A_list = [int(item)//400 for item in input().split()]

    cnt_dict = collections.Counter(A_list)

    res_low = 0
    res_high = 0
    for i in range(4800//400 + 1):
        if i <= 7:
            if cnt_dict[i] >= 1:
                res_low += 1
        else:
            res_high += cnt_dict[i]

    print(max(res_low, 1), res_low + res_high)

if __name__ == "__main__":
    resolve()

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

boundary = []
for i in range(8):
    boundary.append(400*(i+1))

colors = set()
free_choice = 0
for i in range(n):
    if a_l[i] < boundary[0]:
        colors.add('gray')
    elif boundary[0] <= a_l[i] < boundary[1]:
        colors.add('brown')
    elif boundary[1] <= a_l[i] < boundary[2]:
        colors.add('green')
    elif boundary[2] <= a_l[i] < boundary[3]:
        colors.add('lblue')
    elif boundary[3] <= a_l[i] < boundary[4]:
        colors.add('blue')
    elif boundary[4] <= a_l[i] < boundary[5]:
        colors.add('yellow')
    elif boundary[5] <= a_l[i] < boundary[6]:
        colors.add('orange')
    elif boundary[6] <= a_l[i] < boundary[7]:
        colors.add('red')
    else:
        free_choice += 1

ans = len(colors)
print(max(1,ans), ans+free_choice)

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

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

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

c = [0 for _ in range(9)]
for ai in a:
  for i in range(8):
    if ai <= i*400+399:
      c[i] += 1
      break
  if ai >= 3200:
    c[8] += 1
mn = 0
for i in range(8):
  if c[i] > 0:
    mn += 1
mx = mn+c[8]
if mn == 0:
  mn = 1
print(mn,mx)

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

for i in range(N):
  if a[i] // 400  >= 8:
    choku += 1
  else:
    normal.add(a[i]//400)
    
if len(normal) == 0:
  print(1, choku)
else:
  print(len(normal), len(normal)+choku)

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
r=set()
r2=0

for i in a:
    if i>=3200:
        r2+=1
    else:
        r.add(i//400)

if len(r)==0:
    mi=1
else:
    mi=len(r)

ma=len(r)+r2

print(mi,ma)

Solution (Python):
import sys
import io

input = sys.stdin.readline
data = int(input())
array = [int(x) for x in input().split()]

color = set()
over = 0
for a in array :
    if a < 3200 :
        color.add(a//400)
    else :
        over += 1

print(max(1,len(color)), len(color)+over)

Solution (Python):
def main():
  N = int(input())
  A = [int(_)//400 for _ in input().split()]
  U = [a for a in A if a < 8]
  O = N - len(U)
  print(max(1, len(set(U))), len(set(U)) + O)
  return

if __name__ == '__main__':
  main()

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

b = [0]*9
ans = 0
count = 0
for i in a:
    if i//400 < 8:
        b[i//400] = 1
    else:
        b[8] += 1
print(max(1, sum(b[:8])), sum(b))

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

dict = {}
ans = 0
count = 0
for i in range(N):
    if not( a[i]//400 in dict.keys() ):
        dict[a[i]//400] = 1
    else:
        dict[a[i]//400] += 1
for key in dict.keys():
    if key < 8:
        ans += 1
    else:
        count += dict[key]
if ans == 0:
    print(1, count)
else:
    print(ans, ans+count)

Solution (Python):
from collections import defaultdict
n = int(input())
nums = [int(i) for i in input().split()]

d = defaultdict(int)
a = 0
for num in nums:
    if 1 <= num <= 399:
        d['ash'] += 1
    elif 400 <= num <= 799:
        d['brown'] += 1
    elif 800 <= num <= 1199:
        d['green'] += 1
    elif 1200 <= num <= 1599:
        d['water'] += 1
    elif 1600 <= num <= 1999:
        d['blue'] += 1
    elif 2000 <= num <= 2399:
        d['yellow'] += 1
    elif 2400 <= num <= 2799:
        d['orange'] += 1
    elif 2800 <= num <= 3199:
        d['red'] += 1
    else:
        a += 1
MIN = len(d)
if MIN == 0 and a > 0:
    MIN = 1
MAX = len(d) + a
print(MIN, MAX)

Solution (Python):

n=int(input())
a=list(map(int,input().split()))
ans=[0 for _ in range(8)]
cnt=0
res=0
for i in a:
    if 0<i<400:
        ans[0]+=1
    elif 400<=i<800:
        ans[1]+=1
    elif 800<=i<1200:
        ans[2]+=1
    elif 1200<=i<1600:
        ans[3]+=1
    elif 1600<=i<2000:
        ans[4]+=1
    elif 2000<=i<2400:
        ans[5]+=1
    elif 2400<=i<2800:
        ans[6]+=1
    elif 2800<=i<3200:
        ans[7]+=1
    elif 3200<=i:
        cnt+=1
for i in ans:
    if i==0:
        res+=1
x=8-res




y=cnt+x
if x==0:
    x=1
print(x,y)

Solution (Python):
from collections import defaultdict
def main():
    N = int(input())
    p = [int(a) for a in input().split()]
    rate = defaultdict(int)
    for i in range(N):
        score = p[i]
        if 1 <= score <= 399:
            rate["GRAY"] += 1
        elif 400  <= score <= 799:
            rate["BROWN"] += 1
        elif 800  <= score <= 1199:
            rate["GREEN"] += 1
        elif 1200 <= score <= 1599:
            rate["LBLUE"] += 1
        elif 1600 <= score <= 1999:
            rate["BLUE"] += 1
        elif 2000 <= score <= 2399:
            rate["YELLOW"] += 1
        elif 2400 <= score <= 2799:
            rate["ORANGE"] += 1
        elif 2800 <= score <= 3199:
            rate["RED"] += 1
        elif 3200 <= score:
            rate["FREE"] += 1
    color = 0
    free  = 0
    for k, v in rate.items():
        if k != "FREE":
            if rate[k] > 0:
                color += 1
        else:
            free += rate[k]
    if color == 0 and free != 0:
        print(1, free)
    else:
        print(color , color + free)
main()

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

print(max(1,len(ans)),len(ans)+cnt)

Solution (Python):


n=int(input())
a=list(map(int, input().split()))
a.sort()
d=[0 for _ in range(8)]

flg=False
minim=-1
for i in range(n):
    if a[i]<400:
        d[0]=1
    elif a[i]<800:
        d[1]=1
    elif a[i]<1200:
        d[2]=1
    elif a[i]<1600:
        d[3]=1
    elif a[i]<2000:
        d[4]=1
    elif a[i]<2400:
        d[5]=1
    elif a[i]<2800:
        d[6]=1
    elif a[i]<3200:
        d[7]=1
    else:
        if flg==False:
            minim=sum(d)
            flg=True
        d[0]+=1

if minim==-1:
    minim=sum(d)
elif minim==0:
    minim=1
print(minim,end=' ')
print(sum(d))

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

ans = [0]*8
free = 0
for a in A:
    for i in range(8):
        if a < (i+1)*400:
            ans[i]=1
            break
    if 3200 <= a:
        free += 1
ans_max = sum(ans)+free
ans_min = max(1, sum(ans))
print(ans_min, ans_max, sep=' ')

Solution (Python):
n, *A = map(int, open(0).read().split())
B = [0] * 9
for a in A:
  if a < 3200:
  	B[a // 400] = 1
  else:
    B[8] += 1
print(max(sum(B[:8]), 1), sum(B))

Solution (Python):
N=int(input())
A=list(map(int,input().split()))
r=[0]*9
for a in A:
  for i in range(8,-1,-1):
    if a >= 400*i:
      r[i]+=1
      break
ans=0
for i in range(8):
  if r[i]>0: ans+=1
if ans==0: print(1, r[8])
else: print(ans, ans+r[8])

Solution (Python):
import collections

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

B = []
cnt = 0
for i in range(N):
    if A[i] >= 3200:
        cnt += 1
    else:
        B.append(A[i]//400)

c = collections.Counter(B)

small = len(c) if len(c) != 0 else 1
big = len(c)+cnt

print(small, big)

Solution (Python):
n = int(input())
A = list(map(int,input().split(' ')))
rate = [0]*9
for a in A:
    c = min(a//400, 8)
    rate[c] += 1
count = 0
i = 0
while i < 8:
    if rate[i] != 0:
        count += 1
    i += 1
cmax = count+rate[8]
cmin = max(1, count)

print(str(cmin)+' '+str(cmax))

Solution (Python):
N = int(input())
a = [int(i) for i in input().split()]
ans = [0]*8
count = 0
for i in a:
    if i < 400:
        ans[0] += 1
    elif i < 800:
        ans[1] += 1
    elif i < 1200:
        ans[2] += 1
    elif i < 1600:
        ans[3] += 1
    elif i < 2000:
        ans[4] += 1
    elif i < 2400:
        ans[5] += 1
    elif i < 2800:
        ans[6] += 1
    elif i < 3200:
        ans[7] += 1
    else:
        count += 1
count1 = 0
for i in ans:
    if i!=0:
        count1 += 1
mn = count1
mx = count1 + count
print(max(1,mn),mx)

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

gray = 0
brown = 0
green = 0
lightblue = 0
blue = 0
yellow = 0
orange = 0
red = 0
other = 0

for rate in a:
    if 1 <= rate <= 399:
        gray += 1
    elif 400 <= rate <= 799:
        brown += 1
    elif 800 <= rate <= 1199:
        green += 1
    elif 1200 <= rate <= 1599:
        lightblue += 1
    elif 1600 <= rate <= 1999:
        blue += 1
    elif 2000 <= rate <= 2399:
        yellow += 1
    elif 2400 <= rate <= 2799:
        orange += 1
    elif 2800 <= rate <= 3199:
        red += 1
    else:
        other += 1

s = [gray, brown, green, lightblue, blue, yellow, orange, red]
s = list(filter(lambda x: x > 0, s))

cnt = len(s)

cnt1 = max(1, cnt)

print('{} {}'.format(cnt1,  cnt+other))

Solution (Python):
N=int(input()); A=list(map(int,input().split()))
L=[[1,399],[400,799],[800,1199],[1200,1599],[1600,1999],[2000,2399],[2400,2799],[2800,3199],[3200,4800]]
S=[0]*9;cnt=0;cnt1=0
for i in range(N):
  for j in range(9):
    if L[j][0]<=A[i]<=L[j][1]:
      S[j]=S[j]+1
for i in range(8):
  if S[i]!=0:
    cnt=cnt+1
cnt1=max(1,cnt)
print(cnt1,cnt+S[-1])

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

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

colors = len([i for i in color if i])
mini = max(1, colors)
maxi = colors + free
print(mini, maxi)

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

colors = set()
other = 0
for num in list_A:
    num //= 400
    if num > 7:
        other += 1
    else:
        colors.add(num)

max_value = len(colors) + other
min_value = len(colors)

if len(colors) == 0:
    min_value = 1

print(min_value, max_value)

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
b=[0 for i in range(15)]
for some in a:
    b[some//400]+=1
ans=0
for i in range(8):
    if b[i]>0:
        ans+=1
mini=ans
for i in range(8,15):
    ans+=b[i]
if mini==0:
    mini=1
print(mini,ans)

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

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
col1 = []
col2 = []
for i in a:
    if i//400<8:
        col1.append(i//400)
    else:
        col2.append(i//400)
min = len(set(col1))
if min == 0:
    min = 1
max = len(set(col1))+len(col2)

print(min, max)

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

cou = 0
for i in range(8):
    if p[i] == 1:
        cou += 1

if cou != 0:
    print(str(cou) + " " + str(cou + p[8]))
elif cou == 0:
    print(str(1) + " " + str(p[8]))

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

c = []
xn = 0
TF = [False for _ in range(8)]
for r in a:
    if r <= 399:
        TF[0] = True
    elif 400 <= r <= 799:
        TF[1] = True
    elif 800 <= r <= 1199:
        TF[2] = True
    elif 1200 <= r <= 1599:
        TF[3] = True
    elif 1600 <= r <= 1999:
        TF[4] = True
    elif 2000 <= r <= 2399:
        TF[5] = True
    elif 2400 <= r <= 2799:
        TF[6] = True
    elif 2800 <= r <= 3199:
        TF[7] = True
    else:
        xn += 1
truenum = sum(1 for i in TF if i)
minv = truenum
if truenum == 0:
    minv = 1
maxv = truenum + xn
print(minv, maxv)

Solution (Python):
n=int(input())
a=list(map(lambda x:min(int(x)//400,8),input().split()))
cat=[0]*8
f=0
for ai in a:
    if ai < 8:
        cat[ai]=1
    if ai == 8:
        f+=1
print(str(max(sum(cat),1))+' '+str(sum(cat)+f))

Solution (Python):
n=int(input())
a=list((map(int,input().split())))
l=[0 for _ in range(8)]
f=0
for i in range(n):
    r=a[i]//400
    if r<8:
        l[r]+=1
    else:
        f+=1
amin=0

for i in range(len(l)):
    if l[i]>=1:
        amin+=1
        
print(max(1,amin),amin+f)

Solution (Python):

L = [0 for _ in range(8)]
N = int(input())
A = list(map(int, input().split()))
v = 0
for i in range(N):
    idx = A[i] // 400
    if idx >= 8:
        v += 1
    else:
        L[idx] += 1
amin, amax = 0, 0
for i in range(len(L)):
    if L[i] > 0:
        amin += 1
    
    
    




print(max(1, amin), amin + v)

Solution (Python):


n=int(input())
a=list(map(int,input().split()))
p=set()
s=0
for i in range(len(a)):
    if a[i]<3200:
        p.add(a[i]//400)
    else:
        s+=1
print(max(len(p),1), len(p)+s)

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

rates = set()
cnt = 0
for a in A:
    if (a < 400):
        rates.add(0)
    elif (400 <= a and a < 800):
        rates.add(1)
    elif (800 <= a and a < 1200):
        rates.add(2)
    elif (1200 <= a and a < 1600):
        rates.add(3)
    elif (1600 <= a and a < 2000):
        rates.add(4)
    elif (2000 <= a and a < 2400):
        rates.add(5)
    elif (2400 <= a and a < 2800):
        rates.add(6)
    elif (2800 <= a and a < 3200):
        rates.add(7)
    else:
        cnt += 1

print(max(len(rates), 1), len(rates) + cnt)

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
red = 0
ans = 0
cnt = [0]*10
for x in a:
    if x < 3200:
        cnt[x//400] +=1
    else:
        red+=1
for x in cnt:
    if x >0:ans+=1

if red == n:print(1)
else:print(ans)
ans+=red
print(ans)

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
o=0
x=[]
for i in range(n):
  if a[i]>=3200:
    o+=1
  else:
    x.append(a[i]//400)
p=len(set(x))
q=max(1,p)
print(q,o+p)

Solution (Python):
import sys

n, *a = map(int, sys.stdin.read().split())

def main():
  cnt = [0] * 9
  for x in a:
    cnt[min(x, 3200) // 400] += 1
  mi = 0
  for x in cnt[:8]: 
    if x: mi += 1
  ma = mi + cnt[8]
  mi = max(1, mi)
  print(mi, ma)
  
if __name__ == '__main__':
  main()

Solution (Python):

def _min(rates):
    return max(len(rates)-rates.count(0),1)

def _max(rates,free):
    return min(len(rates)-rates.count(0)+free,n)

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

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

def get_color(rate):
    if 1<=rate<400:
        return 'gray'
    elif rate<800:
        return 'brown'
    elif rate<1200:
        return 'green'
    elif rate<1600:
        return 'rb'
    elif rate<2000:
        return 'blue'
    elif rate<2400:
        return 'yellow'
    elif rate<2800:
        return 'orange'
    elif rate<3200:
        return 'red'
    else:
        return 'free'

c = set()
free_cnt = 0
for i in range(n):
    if get_color(a[i]) == 'free':
        free_cnt += 1
    else:
        c.add(get_color(a[i]))

min_ans = max(len(c),1)
max_ans = len(c)+free_cnt

print(min_ans, max_ans)

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

color = [False] * 9
i = rate[0] // 400
switch = 400 * (i + 1)

for r in range(len(rate)):
    if rate[r] < switch and i <= 7:
        color[i] = True
        if i == 8:
            color[8] += 1
    else:
        i = rate[r] // 400
        if i <= 7:
            color[i] = True
            switch = 400 * (i + 1)
        else:
            color[8] += 1

ans_min = sum(color[:8])
ans_max = sum(color)

if ans_min == 0:
    print("{} {}".format(1, ans_max))
else:
    print("{} {}".format(ans_min, ans_max))

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

def color(r):
    return min(r // 400, 8)

c = list(map(color, a))
cs = set(c)
cc = len(cs)
ac = c.count(8)
if ac == 0:
    print(cc, cc)
else:
    cc -= 1
    print(max(1,cc), cc+ac)

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

zero = num[:8].count(0)
print(max(8-zero,1), end = ' ')
print(8-zero + num[8])

Solution (Python):
from __future__ import print_function

import sys

import re
import array
import copy
import functools
import operator

import math
import string
import fractions
from fractions import Fraction
from fractions import gcd



import collections
import itertools
import bisect

import random
import time

import heapq
from heapq import heappush
from heapq import heappop
from heapq import heappushpop
from heapq import heapify
from heapq import heapreplace
from queue import PriorityQueue as pq
from queue import Queue

from itertools import accumulate

from collections import deque
from collections import Counter

from operator import mul
from functools import reduce

input = sys.stdin.readline


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return


def lcm(n, m):
    return int(n * m / gcd(n, m))


def coprimize(p, q):
    common = fractions.gcd(p, q)
    return (p // common, q // common)


def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom


def find_gcd(list_l):
    x = reduce(gcd, list_l)
    return x


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

    sur=0
    b=[0 for _ in range(8)]
    for i in range(n):
        if a[i] // 400 >=8:
            sur += 1
        else:
            b[a[i]//400]=1

    eprint('b ',end=':\n')
    eprint(b)

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

    ans1=cnt + sur
    ans2=cnt
    print(max(ans2,1),ans1)

if __name__ == '__main__':
    main()

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

check = [False] * 8
r = 0
for i in range(n):
    if a[i] < 400:
        check[0] = True
    elif 400 <= a[i] < 800:
        check[1] = True
    elif 800 <= a[i] < 1200:
        check[2] = True
    elif 1200 <= a[i] < 1600:
        check[3] = True
    elif 1600 <= a[i] < 2000:
        check[4] = True
    elif 2000 <= a[i] < 2400:
        check[5] = True
    elif 2400 <= a[i] < 2800:
        check[6] = True
    elif 2800 <= a[i] < 3200:
        check[7] = True
    else:
        r += 1

color = 0
ans_max = r
for i in range(8):
    if check[i]:
        color += 1
        ans_max += 1

ans_min = max(color,1)
print(ans_min,ans_max)

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

maximum = 0
minimum = 0
used = [0]*9
for i in A:
    i //= 400
    if i >= 8:
        maximum += 1
    elif used[i] == 0:
        maximum += 1
        minimum += 1
        used[i] = 1
if minimum == 0:
    minimum += 1
print(minimum, maximum)

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
C = [0] * 9
for a in A:
    C[min(8, a//400)] += 1
s = sum([c > 0 for c in C[:-1]])

print(max(s, 1), s + C[-1])

Solution (Python):
N = int(input())
a = list(map(int,input().split()))
ans = [0] * 8
over3200 = 0
rates = [1,400,800,1200,1600,2000,2400,2800,3200]
for i in range(N):
    if a[i] >= rates[8]:
        over3200 += 1
        continue
    for j in range(7,-1,-1):
        if a[i] >= rates[j]:
            ans[j] = 1
            break

min = 0
max = 0

if sum(ans) > 0:
    min = sum(ans)
else:
    min = 1

max = sum(ans) + over3200

print(min, max)

Solution (Python):
import collections
def solve(n, a_list):

    count = collections.Counter()
    for i in a_list:
        no = 8 if i // 400 >= 8 else i // 400
        count[no] += 1

    tmp = len([i for i in count.keys() if i != 8])
    max_value = tmp + count[8]
    min_value = 1 if tmp == 0 else tmp

    return "{0} {1}".format(min_value, max_value)

if __name__ == "__main__":
    n = int(input())
    a_list = [int(i) for i in input().split()]
    print(solve(n, a_list))

Solution (Python):










"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""

""" n! mod m 階乗
mod = 1e9 + 7
N = 10000000
fac = [0] * N
def ini():
  fac[0] = 1 % mod
  for i in range(1,N):
    fac[i] = fac[i-1] * i % mod"""

"""mod = 1e9+7
N = 10000000
pw = [0] * N
def ini(c):
  pw[0] = 1 % mod
  for i in range(1,N):
    pw[i] = pw[i-1] * c % mod"""

"""
def YEILD():
  yield 'one'
  yield 'two'
  yield 'three'
generator = YEILD()
print(next(generator))
print(next(generator))
print(next(generator))
"""
"""def gcd_(a,b):
  if b == 0:
    return a
  return gcd_(a,a % b) 
"""def extgcd(a,b,x,y):
  d = a
  if b!=0:
    d = extgcd(b,a%b,y,x)
    y -= (a//b) * x
    print(x,y)
  else:
    x = 1
    y = 0
  return d"""


def readInts():
  return list(map(int,input().split()))
mod = 10**9 + 7
def main():
  n = int(input())
  A = readInts()
  LIST = set()
  d = 0
  
  for i in A:
    c = i // 400
    if c < 8:
      LIST.add(c)
    else:
      d+=1
  print(max(len(LIST),1),len(LIST)+d)
  
  
if __name__ == '__main__':
  main()

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

color_n = [0 for i in range(9)]

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

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

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

if d['8'] == 0 :
  print(len(d)-1,len(d)-1)
else:
  if len(d)-1 == 0:
    print(1,len(d)+d['8'] -1)
  else:
    print(len(d)-1,len(d)+d['8'] -1)

Solution (Python):
tuplet=set()
count=0
input()
x=map(int,input().split())
for a in x:
    if a<400:
        tuplet.add("gr")
    elif a<800:
        tuplet.add("br")
    elif a<1200:
        tuplet.add("gre")
    elif a<1600:
        tuplet.add("wa")
    elif a<2000:
        tuplet.add("bl")
    elif a<2400:
        tuplet.add("ye")
    elif a<2800:
        tuplet.add("ore")
    elif a<3200:
        tuplet.add("red")
    else:
        count+=1
if count>0:
    ma=len(tuplet)+count
    mi=max(len(tuplet),1)
else:
    ma=len(tuplet)
    mi=ma
print("{} {}".format(mi,ma))

Solution (Python):




def main():
    N = int(input())
    A = list(map(int, input().split()))
    colors = [0] * 8
    over = 0

    for a in A:
        if a < 3200:
            colors[a // 400] += 1
        else:
            over += 1

    result = sum(color > 0 for color in colors)

    if result:
        print(result, result + over)
    else:
        print(1, over)


if __name__ == "__main__":
    main()

Solution (Python):
import numpy as np
N = int(input())
ARR = [int(s) for s in input().split(" ")]

def calculate(n, arr):
    dict = {'gray': False, 'brown': False, 'green': False, 'water': False, 'blue': False, 'yellow': False,
            'orange': False, 'red': False}
    any = 0

    for ar in arr:
        if ar >= 1 and ar <= 399:
            dict.__setitem__('gray',True)
        elif ar >= 400 and ar <= 799:
            dict.__setitem__('brown', True)
        elif ar >= 800 and ar <= 1199:
            dict.__setitem__('green', True)
        elif ar >= 1200 and ar <= 1599:
            dict.__setitem__('water', True)
        elif ar >= 1600 and ar <= 1999:
            dict.__setitem__('blue', True)
        elif ar >= 2000 and ar <= 2399:
            dict.__setitem__('yellow', True)
        elif ar >= 2400 and ar <= 2799:
            dict.__setitem__('orange', True)
        elif ar >= 2800 and ar <= 3199:
            dict.__setitem__('red', True)
        else:
            any = any + 1

    l = np.array(list(dict.values()))

    goodNum = np.sum(l == True)
    badNum = np.sum(l == False)

    if goodNum == 0:
        print(1,goodNum + any)
    else:
        print(goodNum,goodNum + any)

calculate(N,ARR)