2026-03-24 22:10:56 +09:00

15 lines
248 B
Python

from bisect import bisect_left
N = int(input())
A = list(map(int, input().split()))
LIS = []
for a in A :
if not len(LIS) or a > LIS[-1]:
LIS.append(a)
else:
idx = bisect_left(LIS, a)
LIS[idx] = a
print(len(LIS))