#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; int main(){ int i, j; int n; vectorlist; cin >> n; for (i = 0; i < n; i++) { int num; cin >> num; list.push_back(num); } sort(list.begin(), list.end()); vector>dp(10005, vector(10005, 0)); //vectordp(100005, 0); for (i = 0; i < n; i++) { dp[i][i] = max(1, dp[i][i]); for (j = 0; j < n; j++) { if (list[j] < list[i])continue; if (list[j] % list[i] == 0) { dp[i + 1][j] = max(dp[i][j], dp[i][i] + 1); //dp[j] = max(dp[j], dp[i] + 1); } else { dp[i + 1][j] = dp[i][j]; } } } cout << dp[n][n-1]-1 << endl; getchar(); getchar(); return 0; }