qyliang/CodeNanoFix huggingface dataset:
Buggy code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

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

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


Fixed code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

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

ans = sum(rate[:8])
if ans == 0:
    print('1 {}'.format(rate[8]))
elif rate[8] == 0:
    print('{} {}'.format(ans, ans))
else:
    print('{} {}'.format(ans, ans + rate[8]))
Buggy code:
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(C)
print(max(s, 1), s + C[-1])


Fixed code:
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(C)
print(max(s, 1), s + C[-1])
Buggy code:
n=input()
l=list(map(int,input().split()))
col=[False for i in range(8)]
val=0
count=0
for i in range(n):
  m=l[i]
  if m<400:
    col[0]=True
  elif m<800:
    col[1]=True
  elif m<1200:
    col[2]=True
  elif m<1600:
    col[3]=True
  elif m<2000:
    col[4]=True
  elif m<2400:
    col[5]=True
  elif m<2800:
    col[6]=True
  elif m<3200:
    col[7]=True
  else:
    val+=1
for i in range(8):
  if col[i]:
    count+=1
print(count,min(8,count+val))

Fixed code:
n=int(input())
l=list(map(int,input().split()))
col=[False for i in range(8)]
val=0
count=0
for i in range(n):
  m=l[i]
  if m<400:
    col[0]=True
  if 400<=m<800:
    col[1]=True
  if 800<=m<1200:
    col[2]=True
  if 1200<=m<1600:
    col[3]=True
  if 1600<=m<2000:
    col[4]=True
  if 2000<=m<2400:
    col[5]=True
  if 2400<=m<2800:
    col[6]=True
  if 2800<=m<3200:
    col[7]=True
  if m>=3200:
    val+=1
for i in range(8):
  if col[i]:
    count+=1
print(max(1,count),count+val)
Buggy code:
def solve(N, As):
    colors = set()
    allcount = 0
    for a in As:
        if a // 400 < 8:
            colors.add(n)
        else:
            allcount += 1
    return max(len(colors), 1), len(colors) + allcount


if __name__ == "__main__":
    N = int(input())
    As = map(int, input().split(" "))
    m1, m2 = solve(N, As)
    print(m1, m2)


Fixed code:
def solve(N, As):
    colors = set()
    allcount = 0
    for a in As:
        a -= a % 400
        n = a // 400
        if n < 8:
            colors.add(n)
        else:
            allcount += 1
    return max(len(colors), 1), len(colors) + allcount


if __name__ == "__main__":
    N = int(input())
    As = map(int, input().split(" "))
    m1, m2 = solve(N, As)
    print(m1, m2)
Buggy code:
N = int(input())
rate = [0] * 9
for a in [int(x) for x in input().split()]:
  rate[min(a, 3200) // 400] += 1

ret = 0
for r in rate[:-1]:
  if r:
    ret += 1

print(min(ret, 1), ret + rate[-1])

Fixed code:
N = int(input())
rate = [0] * 9
for a in [int(x) for x in input().split()]:
  rate[min(a, 3200) // 400] += 1

ret = 0
for r in rate[:-1]:
  if r:
    ret += 1

print(max(ret, 1), ret + rate[-1])
Buggy code:
from collections import Counter

N = int(input())
A = [int(_) // 400 if int(_) < 3199 else 8 for _ in input().split()]

min_counter = Counter(A).copy()
if 8 in min_counter.keys():
    min_counter.pop(8)
    minimum = 1
else:
    minimum = len(min_counter)

maximum = 0
max_counter = Counter(A).copy()
if max_counter[8] >= 8:
    maximum = max_counter[8]
    max_counter.pop(8)
    maximum += len(max_counter)
else:
    if 8 in max_counter.keys():
        maximum = max_counter[8]
        max_counter.pop(8)
    maximum += len(max_counter)

print(minimum, maximum)

Fixed code:
from collections import Counter

N = int(input())
A = [int(_) // 400 if int(_) <= 3199 else 8 for _ in input().split()]

min_counter = Counter(A).copy()
if 8 in min_counter.keys():
    min_counter.pop(8)
    if not min_counter:
        minimum = 1
    else:
        minimum = len(min_counter)
else:
    minimum = len(min_counter)

maximum = 0
max_counter = Counter(A).copy()

if 8 in max_counter.keys():
    maximum = max_counter[8]
    max_counter.pop(8)
    maximum += len(max_counter)
else:
    maximum += len(max_counter)

print(minimum, maximum)
Buggy code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

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

def LI(): return list(map(int,input().split()))
def I(): return int(input())
def LS(): return input().split()
def S(): return input()

def main():
  n=I()
  l=LI()

  l2=[]
  c=0
  for x in l:
    if x>=3200:
      c+=1
      l2.append(8)
    else:
      l2.append(x//400)

  l2=list(set(l2))

  if len(l2)!=1 and l2.count(8):
    l2.remove(8)

  if len(l2)==1:
    c-=1

  print(len(l2),len(l2)+c)

main()


Fixed code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

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

def LI(): return list(map(int,input().split()))
def I(): return int(input())
def LS(): return input().split()
def S(): return input()

def main():
  n=I()
  l=LI()

  l2=[]
  c=0
  for x in l:
    if x>=3200:
      c+=1
      l2.append(8)
    else:
      l2.append(x//400)

  l2=list(set(l2))

  if len(l2)!=1 and l2.count(8):
    l2.remove(8)

  if len(l2)==1 and l2[0]==8:
    c=max(0,c-1)

  print(len(l2),len(l2)+c)

main()
Buggy code:
n=int(input())
n,k=map(int,input().split())
l=[int(i) for i in input().split()]
cnt=[0]*9
ans=0
for i in l:
    if i>3199:
        i=3200
    cnt[i//400]+=1
for p in range(n-1):
    i=cnt[p]
    if i!=0:
        ans+=1
print(ans if ans!=0 else 1,ans+cnt[-1])

Fixed code:
n=int(input())
l=[int(i) for i in input().split()]
cnt=[0]*9
ans=0
for i in l:
    if i>3199:
        i=3200
    cnt[i//400]+=1
for p in range(8):
    i=cnt[p]
    if i!=0:
        ans+=1
print(ans if ans!=0 else 1,ans+cnt[-1])
Buggy code:
input()
rates = sorted([int(x) for x in input().split()])
counts = []
for boundary in [399, 799, 1199, 1599, 1999, 2399, 2799, 3199]:
    counts.append(1 if rates[0] <= boundary else 0)
    rates = [rate for rate in rates if rate > boundary]
higher = len(rates)
least = sum(counts)
print("{} {}".format(1 if least == 0 else least, least+higher))

Fixed code:
input()
rates = sorted([int(x) for x in input().split()])
counts = []
for boundary in [399, 799, 1199, 1599, 1999, 2399, 2799, 3199]:
    counts.append(1 if rates and (rates[0] <= boundary) else 0)
    rates = [rate for rate in rates if rate > boundary]
higher = len(rates)
least = sum(counts)
print("{} {}".format(1 if least == 0 else least, least+higher))
Buggy code:
from collections import Counter


N = int(input())
a = Counter(map(lambda x: min(8, int(x) // 400), input().split()))
print(a)
super_coders = min(8, a.pop(8, 0))
mn = len(a)
if mn == 0 and super_coders:
    mn = 1
mx = min(8, len(a) + super_coders)
print(mn, mx)


Fixed code:
from collections import Counter


N = int(input())
a = Counter(map(lambda x: min(8, int(x) // 400), input().split()))
super_coders = a.pop(8, 0)
mn = len(a)
if mn == 0 and super_coders:
    mn = 1
mx = len(a) + super_coders
print(mn, mx)
Buggy code:
def main():
    n, *x = map(int, open(0).read().split())

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

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


if __name__ == '__main__':
    main()


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

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

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


if __name__ == '__main__':
    main()
Buggy code:
import bisect

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

A.sort()

rank = [0, 400, 800, 1200, 1600, 2000, 2400, 2800, 3200, 3200, 3200, 3200, 3200, 3200]
n_rank = []
for i in range(1,len(rank)):
  var = bisect.bisect_left(A, rank[i]) - bisect.bisect_left(A, rank[i-1])
  n_rank.append(var)
else:
  n_rank.append(len(A) - bisect.bisect_left(A, rank[-1]))
  
n_color = sum(n_rank[i] != 0 for i in range(len(n_rank)-1))

min_color = max(n_color, 1)
max_color = min(n_color + n_rank[-1])

print(str(min_color) +' '+ str(max_color))
  



Fixed code:
import bisect

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

A.sort()

rank = [0, 400, 800, 1200, 1600, 2000, 2400, 2800, 3200, 3200, 3200, 3200, 3200, 3200]
n_rank = []
for i in range(1,len(rank)):
  var = bisect.bisect_left(A, rank[i]) - bisect.bisect_left(A, rank[i-1])
  n_rank.append(var)
else:
  n_rank.append(len(A) - bisect.bisect_left(A, rank[-1]))
  
n_color = sum(n_rank[i] != 0 for i in range(len(n_rank)-1))

min_color = max(n_color, 1)
max_color = n_color + n_rank[-1]

print(str(min_color) +' '+ str(max_color))
Buggy code:
N = int(input())
a = list(map(int, input().split()))

c = [0] * 8
r = 0

for i in a:
    col = i // 400
    if col <= 7:
        c[col] = 1
    else:
        r += 1

c = sum(c)

print(min(8, r) if r>c else c)
print(min(8,r+c))

Fixed code:
N = int(input())
a = list(map(int, input().split()))

c = [0] * 8
r = 0

for i in a:
    col = i // 400
    if col <= 7:
        c[col] = 1
    else:
        r += 1

c = sum(c)

print(max(1, c), r+c)
Buggy code:
def main():
    n = int(input())
    As = list(map(int, input().split()))
    nums = []
    rainbow = 0
    for A in As:
        num = A // 400
        if num < 8:
            if num not in nums:
                nums.append(num)
        else:
            rainbow += 1
    ans_max = len(nums)+rainbow
    ans_min = max(len(1, nums))
    print(ans_min, ans_max)


if __name__ == "__main__":
    main()


Fixed code:
def main():
    n = int(input())
    As = list(map(int, input().split()))
    nums = []
    rainbow = 0
    for A in As:
        num = A // 400
        if num < 8:
            if num not in nums:
                nums.append(num)
        else:
            rainbow += 1
    ans_max = len(nums)+rainbow
    ans_min = max(1, len(nums))
    print(ans_min, ans_max)


if __name__ == "__main__":
    main()
Buggy code:

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

color=[]
free=0
count=0
for i in a:
    if i//400<8 and i//400 not in color:
        color.append(i//400)
        Sans+=1
    elif i>=3200:
        free+=1
        
Mans=Sans
if free+count>8:
    Mans=8
else:
    Mans=count+free
    
print(Sans,Mans)


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

color=[]
free=0
Sans,Mans=0,0
for i in a:
    if i//400<8 and i//400 not in color:
        color.append(i//400)
        Sans+=1
    elif i>=3200:
        free+=1
        
#Mans=Sans
#if free+Sans>=8:
 #   Mans=8
#else:
 #   Mans=Sans+free

Mans=Sans+free
if Sans==0:
    Sans=1
print(Sans,Mans)
Buggy code:
n = int(input())
a = list(map(int, input().split()))
a.sort()
b = [0 for i in range(9)]
red = 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
	else:
		if i >= 3200:
			red += 1
c = 0
for i in b:
	if i > 0:
		c += 1
mn = c
mx = c + red
print (mn, mx)

Fixed code:
n = int(input())
a = list(map(int, input().split()))
a.sort()
b = [0 for i in range(9)]
red = 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:
		red += 1
c = 0
for i in b:
	if i > 0:
		c += 1
if c == 0:
	mn = 1
else:
	mn = c
mx = c + red
print (mn, mx)
Buggy code:
from collections import defaultdict
N = int(input())
A = list(map(int,input().split()))

dic = defaultdict(int)
for a in A:
    n = a//400
    if n > 7:
        dic[8] += 1
    else: dic[n] += 1

print(dic)
m = len(dic.keys())
if dic[8] > 0:
    m -= 1
    mi = max(1,m)
    ma = min(8,m+dic[8])
else:
    mi = ma = m
print(mi,ma)

Fixed code:
from collections import defaultdict
N = int(input())
A = list(map(int,input().split()))

dic = defaultdict(int)
for a in A:
    n = a//400
    if n > 7:
        dic[8] += 1
    else: dic[n] += 1

m = len(dic.keys())
if dic[8] > 0:
    m -= 1
    mi = max(1,m)
    ma = m+dic[8]
else:
    mi = ma = m
print(mi,ma)
Buggy code:
N = int(input())
A = list(map(int, input().split()))
c = 0
s = set()

for a in A:
  if a >= 3200:
    c += 1
  else:
    s.add(a//400
print(max(1, len(s)), len(s) + c)

Fixed code:
N = int(input())
A = list(map(int, input().split()))
c = 0
s = set()

for a in A:
  if a >= 3200:
    c += 1
  else:
    s.add(a//400)
print(max(1, len(s)), len(s) + c)
Buggy code:
n = input()
a = list(map(int, input().split(" ")))

COLOR_LIST = [399, 799, 1199, 1599, 1999, 2399, 2799, 3199]
free_color = 0
color_contain = [0, 0, 0, 0, 0, 0, 0, 0]



for i in a:
	cnt = 0
	for j in COLOR_LIST:
		if i > j:
			cnt += 1
	
	if cnt < len(color_contain):
	    color_contain[cnt] = 1
	else:
	    free_color += 1

if free_color == 0:
	min_ans = sum(color_contain)
	max_ans = sum(color_contain)
else:
    min_ans = max(min(8, sum(color_contain)+1), sum(color_contain))
    max_ans = min(8, sum(color_contain) + free_color)
print(min_ans, max_ans)
		

Fixed code:
n = input()
a = list(map(int, input().split(" ")))

COLOR_LIST = [399, 799, 1199, 1599, 1999, 2399, 2799, 3199]
free_color = 0
color_contain = [0, 0, 0, 0, 0, 0, 0, 0]



for i in a:
	cnt = 0
	for j in COLOR_LIST:
		if i > j:
			cnt += 1
	
	if cnt < len(color_contain):
	    color_contain[cnt] = 1
	else:
	    free_color += 1

if free_color == 0:
	min_ans = sum(color_contain)
	max_ans = sum(color_contain)
else:
    min_ans = max(1, sum(color_contain))
    max_ans = sum(color_contain) + free_color
print(min_ans, max_ans)
Buggy code:
n=int(input())
a=list(map(int,input().split()))
l=[False]*7+[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
    else:
        l[7]+=1
print(sum(l[:7]),sum(l[:7])+l[7])#https://yukicoder.me/run/f8089b4d83c81

Fixed code:
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])#https://yukicoder.me/run/08454c2883ca1
Buggy code:
n=int(input())
a=list(map(int,input().split()))
l=[0]*9
for i in a:
    if i<3200:
        l[i//400]+=1
    else:
        l[8]+=1
if l[8]==0:
    print(sum(l[:8]),sum(l[:8]))
else:
    print(sum(l[:8]),sum(l))

Fixed code:
n=int(input())
a=list(map(int,input().split()))
l=[False]*9
for i in a:
    if i<3200:
        l[i//400]=True
    else:
        l[8]+=1
if sum(l[:8])>0:
    print(sum(l[:8]),sum(l))
else:
    print(1,sum(l))
Buggy code:
n=int(input())
a=list(map(int,input().split()))
for i in range(n):
	a[i]//=400
free=0
b=set()
for i in range(n):
	if a[i]>=8:
		free+=1
	else:
		b.add(a[i])
cnt=len(b)
x=max(cnt,1)
y=min(cnt+free)
print(x,y)

Fixed code:
n=int(input())
a=list(map(int,input().split()))
for i in range(n):
	a[i]//=400
free=0
b=set()
for i in range(n):
	if a[i]>=8:
		free+=1
	else:
		b.add(a[i])
cnt=len(b)
x=max(cnt,1)
y=(cnt+free)
print(x,y)
Buggy code:
N = int(input())
a = [int(_) for _ in input().split()]
color = [False]*8
overnum = 0

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

print(min(1, color.count(True)), color.count(True)+overnum)

Fixed code:
N = int(input())
a = [int(_) for _ in input().split()]
color = [False]*8
overnum = 0

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

print(max(1, color.count(True)), color.count(True)+overnum)
Buggy code:
n=int(input())
a=list(map(int,input().split()))
color_val=0
bigList=[]
for i in range(1,400):
  if i in a:
    color_val+=1
    break
for s in range(400,800):
  if s in a:
    color_val+=1
    break
for t in range(800,1200):
  if t in a:
    color_val+=1
    break
for u in range(1200,1600):
  if u in a:
    color_val+=1
    break
for q in range(1600,2000):
  if q in a:
    color_val+=1
    break
for e in range(2000,2400):
  if e in a:
    color_val+=1
    break
for f in range(2400,2800):
  if f in a:
    color_val+=1
    break
for g in range(2800,3200):
  if g in a:
    color_val+=1
    break
for z in a:
  if z >=3200:
    bigList.append(z)
    
if color_val<8:
  color_val+=len(bigList)
  if color_val>8:
    print(color_val-len(bigList),8)
  else:
    print(color_val-len(bigList),color_val)
else:
  print(8,8)
print(color_val)
print(len(bigList))
    
    
    
   

Fixed code:
n=int(input())
a=list(map(int,input().split()))
color_val=0
bigList=[]
for i in range(1,400):
  if i in a:
    color_val+=1
    break
for s in range(400,800):
  if s in a:
    color_val+=1
    break
for t in range(800,1200):
  if t in a:
    color_val+=1
    break
for u in range(1200,1600):
  if u in a:
    color_val+=1
    break
for q in range(1600,2000):
  if q in a:
    color_val+=1
    break
for e in range(2000,2400):
  if e in a:
    color_val+=1
    break
for f in range(2400,2800):
  if f in a:
    color_val+=1
    break
for g in range(2800,3200):
  if g in a:
    color_val+=1
    break
for z in a:
  if z >=3200:
    bigList.append(z)
    
max=color_val+len(bigList)
if color_val!=0:
  print(color_val,max)
else:
  print(1,max)
Buggy code:
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
    if ls.count(False) <= cnt:
        maxval = 8
    else:
        maxval = 8 - (ls.count(False) - cnt)

    print(minval, maxval)


resolve()

Fixed code:
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()
Buggy code:
rates  = [399,799,1199,1599,1999,2399,2799,3199]
from collections import defaultdict


def return_index(score):
  for i in rates:
    if score <= i:
      return rates.index(i)
  else:
    return 8

N = int(input())
A = list(map(int,input().split()))
d = defaultdict(int)
for a in A:
  d[return_index(a)] += 1
num_of_9s = d[8]
has_9 = 1 if num_of_9s > 0 else 0
print("{} {}".format(len(d.keys()-has_9 ),len(d.keys())-has_9+num_of_9s ))

Fixed code:
rates  = [399,799,1199,1599,1999,2399,2799,3199]
from collections import defaultdict


def return_index(score):
  for i in rates:
    if score <= i:
      return rates.index(i)
  else:
    return 8

N = int(input())
A = list(map(int,input().split()))
d = defaultdict(int)
for a in A:
  d[return_index(a)] += 1
key_len = len(d.keys())
num_of_9s = d[8]
has_9 = 1 if num_of_9s > 0 else 0
print("{} {}".format(max(1,key_len-has_9),key_len-has_9+num_of_9s ))
Buggy code:
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
        if used[8] == 0:
            used[8] = 1
            minimum += 1
    elif used[i] == 0:
        maximum += 1
        minimum += 1
        used[i] = 1
if minimum == 0:
    minimum += 1
print(minimum, maximum)

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

rate=[0]*9
over=0

for i in a:
  for j in range(1,9):
    if 400*(j-1) <= i < 400*j:
      rate[j]=1
      break
    elif i >= 3200:
      over+=1
      break

ansmin = rate.counta(1)
ansmax = rate.count(1)
if ansmin == 0:
  ansmin=1

if over > 0:
  ansmax = ansmax + over
    
#print(rate,over)
print(ansmin, ansmax)

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

rate=[0]*9
over=0

for i in a:
  for j in range(1,9):
    if 400*(j-1) <= i < 400*j:
      rate[j]=1
      break
    elif i >= 3200:
      over+=1
      break

ansmin = rate.count(1)
ansmax = rate.count(1)
if ansmin == 0:
  ansmin=1

if over > 0:
  ansmax += over
    
#print(rate,over)
print(ansmin, ansmax)
Buggy code:
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)
print(colors)
max_value = len(colors) + other
min_value = len(colors)

if max_value > 8:
    max_value = 8
if len(colors) == 0:
    min_value = 1

print(min_value, max_value)

Fixed code:
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)
Buggy code:
n = int(input())
a = list(map(int,input().split()))
aa=[0]*9
for i in range(n):
    x = a[i]//400 - 1
    if x<8:
        aa[x] = 1
    else:
        aa[8] += 1
print(aa)
suma = sum(aa[0:8])
if suma==0:
    mina = 1
else:
    mina = suma
maxa = min(suma+aa[8],8)
print(mina,maxa)


Fixed code:
n = int(input())
a = list(map(int,input().split()))
aa=[0]*9
for i in range(n):
    x = a[i]//400
    if x<8:
        aa[x] = 1
    else:
        aa[8] += 1
suma = sum(aa[0:8])
if suma==0:
    mina = 1
else:
    mina = suma
maxa = suma+aa[8]
print(mina,maxa)
Buggy code:
N = int(input())
a = list(map(int, input().split()))
flag = [0]*9
ans = 0
ans_max =0
for i in range(N):
    num = a[i]//400
    if num>8:
        flag[num]+=1
    else:
        flag[num]=1
ans = sum(flag[:-1])
if flag[8]>8:
    ans_sum = ans + 8
else:
    ans_sum = ans + flag[8]
    
print(ans, ans_sum)

Fixed code:
# coding: utf-8

N = int(input())
a = list(map(int, input().split()))
flag = [0]*9
ans = 0
ans_max =0
for i in range(N):
    num = a[i]//400
    if num>=8:
        flag[8]+=1
    else:
        flag[num]=1
ans = sum(flag[:-1])
if ans == 0:
    ans =1
    ans_sum = flag[8]
else: 
    ans_sum= ans+flag[8]
    
print(ans, ans_sum)