while True:
    
    try:
        n = int(input())
        num_list = list(map(int, input().split()))
        
        help_list = [1] * n 
        for i in range(1, n):
            for j in range(i):
                if num_list[i] > num_list[j]:
                    help_list[i] = max(help_list[i], help_list[j] + 1)
        max_len = max(help_list)
        print(max_len)
        
    except:
        break