import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); ArrayList xList = new ArrayList(); for(int i = 0; i < N; i++) { xList.add(sc.nextInt()); } Collections.sort(xList); int A = xList.get(xList.size() - 1); int[] dp = new int[A + 1]; for(int i = 1; i < A + 1; i++) { if(xList.contains(i)) { dp[i] = 1; } else { dp[i] = -1; } } int ans = 0; for(int i = 1; i < A + 1; i++) { ans = Math.max(ans, dp[i]); if(dp[i] > 0) { for(int j = 2 * i; j < A + 1; j += i) { if(dp[j] > 0) dp[j] = Math.max(dp[j], 1 + dp[i]); } } } System.out.println(ans); } }