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 max = 1; for (int i = n - 1; i >= 0; i--) { int count = 1; if (map.containsKey(arr[i])) { count = map.get(arr[i]) + 1; } max = Math.max(max, count); for (int j = 1; j <= Math.sqrt(arr[i]); j++) { if (arr[i] % j == 0) { Integer x = map.get(j); if (x == null || x < count) { map.put(j, count); } x = map.get(arr[i] / j); if (x == null || x < count) { map.put(arr[i] / j, count); } } } } System.out.println(max); } }