import std.algorithm; import std.array; import std.conv; import std.math; import std.range; import std.stdio; import std.string; import std.typecons; int readint() { return readln.chomp.to!int; } int[] readints() { return readln.split.to!(int[]); } int calc(int[] xs) { auto dp = new int[xs.maxElement + 1]; bool[int] m; foreach (x; xs) m[x] = true; foreach (x; xs.sort!((a, b) => a > b)) { for (int i = x; i < dp.length; i += x) { if (i in m) { dp[x] = max(dp[x], dp[i] + 1); } } } return dp.maxElement; } void main() { readint; auto xs = readints; int ans = calc(xs); writeln(ans); }