@staticmethod
def d():
    (n, *c) = map(int, sys.stdin.read().split())
    lis = ([inf] * n)
    for x in c:
        lis[bi_l(lis, x)] = x
    print((n - bi_l(lis, inf)))
@staticmethod
def d():
    (n, *c) = map(int, sys.stdin.read().split())
    lis = ([inf] * n)
    for x in c:
        lis[bi_l(lis, x)] = x
    print((n - bi_l(lis, inf)))