#include #include #include #include #include #include #include #include #include #include #include #include #include #define all(x) (x).begin(),(x).end() #define rall(x) (x).rbegin(),(x).rend() using namespace std; typedef long long ll; typedef pair pi; typedef pair pl; typedef pair pls; #define MAX_N 1000000 int n; int a[100010]; int used[MAX_N+1]; map m; int main() { cin >> n; int mx = 0; for (int i = 0; i < n; i++) { cin >> a[i]; m[a[i]] = 1; mx = max(mx,a[i]); } sort(a, a + n); int num, num_mx = 0,x,ans = 0; for (int i = 0; i < n - num_mx; i++) { if (a[i] == 1)continue; if (used[a[i]])continue; x = a[i]; for(int k= 1; k * x <= mx; k++){ num = 0; x = k * a[i]; if (used[k*a[i]])continue; if (!m[k*a[i]])continue; for (int j = 1; x * j <= mx; j++) { if (m[x * j]) { used[x*j] = 1; num++; x = x*j; j = 1; } } ans = max(ans,num); x = a[i]; } num_mx = max(num_mx, ans); } if (a[0] == 1)num_mx++; cout << num_mx << endl; return 0; }