package longestsequence; import java.util.Scanner; public class Main { public static int X_MAX = 1000000; public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] x = new int[n]; for(int i=0;i= 1) { dp[j] = Math.max(dp[j], dp[i] + 1); } } ans = Math.max(ans, dp[i]); } return ans; } }