using System;

namespace DPL_1_D
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] a = new int[n];
            for (int i = 0; i < n; i++) a[i] = int.Parse(Console.ReadLine());
            int[] dp = new int[n];
            int ret = 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);
                    }
                }
                ret = Math.Max(ret,dp[i]);
            }
            Console.WriteLine(ret);
        }
    }
}
