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; iArr[j]) dp[i] = Math.max(dp[i], dp[j] + 1); } } int maxLenth = Arrays.stream(dp).max().getAsInt(); System.out.println(maxLenth); } }