n = int(input()) A = [int(input()) for i in range(n)] if n == 1: print(1) exit() A.sort() B = [A[0]] import bisect for i in range(1, n): j = bisect.bisect_left(B, A[i]-1) if j == 0: B.append(A[i]) else: B[j-1] = A[i] print(len(B))