using System;

public class Hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        var a = new int[n];
        for (int i = 0; i < n; i++) a[i] =  int.Parse(Console.ReadLine().Trim());
        goDP(a);
    }
    public static void goDP(int[] a)
    {
        var n = a.Length;
        var dp = new int[n];
        var res = 0;
        for (int i = 0; i < n; i++)
        {
            dp[i] = 1;
            for (int j = 0; j < i; j++)
                if (a[j] < a[i])
                    dp[i] = Math.Max(dp[i], dp[j] + 1);
            res = Math.Max(res, dp[i]);
        }
        Console.WriteLine(res);
    }
}

