import java.util.*;
public class Main{

    public static void main(String[] arg) {
        Scanner scan = new Scanner(System.in);
        while (scan.hasNext()) {
            scan.nextLine();
            String[] input1 = scan.nextLine().split(" ");
            int[] intArr = Arrays.stream(input1).mapToInt(Integer::parseInt).toArray();
            int[] k=new int[intArr.length];
            for(int j=1;j<intArr.length;j++){
                for(int i=0;i<j;i++){
                    if(intArr[i]<intArr[j]){
                        k[j]=Math.max(k[j],k[i]+1);
                        //System.out.print(intArr[i]+" ");
                    }
                }
                //System.out.println();
            }
            Arrays.sort(k);
            System.out.println(k[k.length-1]+1);
        }
    }
}