def _input(n):
    return [int(raw_input()) for i in xrange(n)]

def LIS(arr):
    arr = [0] + arr
    L = [0] + [0] * len(arr)
    P = [-1] + [0] * len(arr)

    for i in xrange(1, len(arr)):
        k = 0
        for j in xrange(0, i):
            if arr[j] < arr[i] and L[j] > L[k]:
                k = j
        L[i] = L[k] + 1
        P[i] = k

    return max(L)

#==============================================
def main():
    n = int(raw_input())
    arr = _input(n)
    print LIS(arr)

if __name__ == "__main__":
    main()