import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); HashMap map = new HashMap<>(); int ans = 1; for (int i = 0; i < n; i++) { int max = 0; int x = sc.nextInt(); if (map.containsKey(1) && x != 1) { max = 1; } for (int j = 2; j <= Math.sqrt(x); j++) { if (x % j == 0) { if (map.containsKey(j)) { max = Math.max(max, map.get(j)); } if (map.containsKey(x / j)) { max = Math.max(max, map.get(x / j)); } } } map.put(x, max + 1); ans = Math.max(ans, max + 1); } System.out.println(ans); } }