import java.util.*; public class Main { 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; i < n; i++) { arr[i] = sc.nextInt(); } Arrays.sort(arr); HashMap map = new HashMap<>(); int ans = 0; for (int i = 0; i < n; i++) { int max = 0; for (int j = 1; j <= Math.sqrt(arr[i]); j++) { if (arr[i] % j == 0) { if (map.containsKey(j)) { max = Math.max(max, map.get(j)); } if (map.containsKey(arr[i] / j)) { max = Math.max(max, map.get(arr[i] / j)); } } } map.put(arr[i], max + 1); ans = Math.max(ans, max + 1); } System.out.println(ans); } }