2025-08-23 20:13:34 +09:00

24 lines
600 B
Java

import java.util.*;
public class _11053 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int[] Arr = new int[N];
for(int i=0; i<N; i++) Arr[i] = sc.nextInt();
sc.close();
int[] dp = new int[N];
Arrays.fill(dp, 1);
for(int i=0; i<N; i++) {
for(int j=0; j<i; j++) {
if(Arr[i]>Arr[j]) dp[i] = Math.max(dp[i], dp[j] + 1);
}
}
int maxLenth = Arrays.stream(dp).max().getAsInt();
System.out.println(maxLenth);
}
}