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); ArrayList> lists = new ArrayList<>(); for (int i = 0; i < n; i++) { lists.add(new ArrayList<>()); } int max = 0; for (int i = 0; i < n; i++) { boolean flag = true; for (int j = max - 1; j >= 0 && flag; j--) { for (int x : lists.get(j)) { if (arr[i] % x == 0) { lists.get(j + 1).add(arr[i]); max = Math.max(max, j + 2); flag = false; break; } } } if (flag) { lists.get(0).add(arr[i]); max = Math.max(1, max); } } System.out.println(max); } }