import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static HashMap dp=new HashMap(); static{dp.put("1",Long.parseLong("1")); dp.put("2",Long.parseLong("3"));} static long longestSequence(long[] a) { long answer=0; for(int i=0;i li=new ArrayList(); for (long i=1; i<=Math.sqrt(k)+1; i++) { if (k%i==0) { // If divisors are equal, print only one // if (n/i == i) //System.out.printf("%d ", i); li.add(i); // else // Otherwise print both //System.out.printf("%d %d ", i, n/i); } } long max=0; for(int i=0;imax){max=val1;} } } long lis=max+1; dp.put(k+"",lis); return lis; } else { long ans=1+k; dp.put(k+"",ans); return ans; } } } public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); long[] a = new long[n]; for(int a_i = 0; a_i < n; a_i++){ a[a_i] = in.nextLong(); } long result = longestSequence(a); System.out.println(result); in.close(); } }