import java.util.Scanner; import java.util.Arrays; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); while(sc.hasNextInt()){ int num = sc.nextInt(); int[] arr = new int[num]; for(int i = 0; i < num; i++){ arr[i] = sc.nextInt(); } int[] dp = new int[num];//记录到第i个木桩最多走多少步 Arrays.fill(dp, 1); for(int i = 0; i < num; i++){ //选一个木桩 for(int j = 0; j < i; j++){ if(arr[j] < arr[i]) dp[i] = Math.max(dp[i],dp[j] + 1); } } int tmp = dp[0]; for(int i = 0; i < num; i++){ tmp = Math.max(tmp,dp[i]); } System.out.println(tmp); } } }