using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; class Magatro { static void Main() { int N = int.Parse(Console.ReadLine()); int[] x = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray(); Array.Sort(x); int A = x.Max(); int[] dp = (new int[A+1]).Select(q=>-1).ToArray(); for(int i = 0; i < N; i++) { dp[x[i]] = 1; } for(int i = 1; i <= A; i++) { if (dp[i] == -1) { continue; } for(int j = i + i; j <= A; j += i) { if (dp[j] != -1) { dp[j] = Math.Max(dp[i] + 1, dp[j]); } } } Console.Write(dp.Max()); } }