using System; using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; using System.Text; using System.Text.RegularExpressions; using System.Linq; class Magatro { static int N = int.Parse(Console.ReadLine()); static int[] x = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray(); static void Main() { Array.Sort(x); int[] dp = new int[N + 1]; for(int i = 0; i <= N; i++) { if (i == 0) { dp[i] = 0; continue; } bool a = true; int max = 0; for (int j = 0; j <=i-2; j++) { if (x[i - 1] % x[j] == 0) { max = Math.Max(max, dp[j + 1]); a = false; } } if (a) { dp[i] = 1; } else { dp[i] = max + 1; } } Console.WriteLine(dp.Max()); } }