lt = list(map(int, input().split()))
n = len(lt)
g = [1] * n
for i in range(n):
for j in range(i):
if lt[i] <= lt[j]:
g[i] = max(g[i], g[j] + 1)
print(max(g))
r = []
for i in range(n):
f = True
for idx,j in enumerate(r):
if j >= lt[i]:
r[idx] = lt[i]
f = False
break
if f:
r.append(lt[i])
print(len(r))