#include <bits/stdc++.h>
using namespace std;

int main ()
{
	int n,ans = 0;
	scanf("%d",&n);
	int a[n];
	for(int i = 0;i < n;i++)
	{
		scanf("%d", &a[i]);
	}
	sort(a,a + n);
	for(int i = 0;i < n;i++)
	{
		if(a[i] == 1)
			continue;
		int temp = 1;
		for(int j = n - 1;j > i;j--)
		{
			if(!(a[j] % a[i]))
				temp++;
		}
		ans = ans < temp ? temp : ans;
	}
	if(!ans) ans++;
	printf("%d", ans);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main ()
{
	int n,ans = 0;
	scanf("%d",&n);
	int a[n];
	for(int i = 0;i < n;i++)
	{
		scanf("%d", &a[i]);
	}
	sort(a,a + n);
	for(int i = 2;i <= a[n - 1];i++)
	{
		int temp = 0;
		for(int j = 0;j < n;j++)
		{
			if(!(a[j] % i))
				temp++;
		}
		ans = ans < temp?temp:ans;
	}
	printf("%d", ans);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main ()
{
	int n,ans = 0;
	scanf("%d",&n);
	int a[n];
	for(int i = 0;i < n;i++)
	{
		scanf("%d", &a[i]);
	}
	sort(a,a + n);
	int k = a[n - 1]/2;
	for(int i = 2;i <= k;i++)
	{
		int temp = 0;
		for(int j = 0;j < n;j++)
		{
			if(!(a[j] % i))
				temp++;
		}
		ans = ans < temp?temp:ans;
	}
	printf("%d", ans);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

bool snt(int o)
{
	if(o == 2)
		return true;
	int q = sqrt(o);
	for(int i = 2;i <= q;i++)
		if(!(o % i))
		{
			 return false;
		}
	return true;
}

int main ()
{
	int n,ans = 0,max = 0;
	scanf("%d",&n);
	int a[n];
	for(int i = 0;i < n;i++)
	{
		scanf("%d", &a[i]);
		max = max > a[i]/2?max:a[i]/2;
	}
	max += 10;
	for(int i = 2;i <= max;i++)
	{
		if(!snt(i))
			continue;
		int temp = 0;
		for(int j = 0;j < n;j++)
		{
			if(!(a[j] % i))
				temp++;
		}
		ans = ans < temp?temp:ans;
	}
	if(!ans) ans++;
	printf("%d", ans);
}


#include <bits/stdc++.h>
using namespace std;

int main ()
{
	int n,ans = 0;
	scanf("%d",&n);
	int a[n];
	for(int i = 0;i < n;i++)
	{
		scanf("%d", &a[i]);
	}
	sort(a,a + n);
	int k = (a[(n)/2] + 1)/2;
	for(int i = 2;i <= k;i++)
	{
		int temp = 0;
		for(int j = 0;j < n;j++)
		{
			if(!(a[j] % i))
				temp++;
		}
		ans = ans < temp?temp:ans;
	}
	if(!ans) ans++;
	printf("%d", ans);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

bool snt(int o)
{
	int q = sqrt(o);
	for(int i = 2;i <= o;i++)
		if(!(o % i))
		{
			if(o == 2)
				return true;
			else return false;
		}
	return true;
}

int main ()
{
	int n,ans = 0,max = 0;
	scanf("%d",&n);
	int a[n];
	for(int i = 0;i < n;i++)
	{
		scanf("%d", &a[i]);
		max = max > a[i]/2?max:a[i]/2;
	}
	max += 7;
	for(int i = 2;i <= max;i++)
	{
		if(!snt(i))
			continue;
		int temp = 0;
		for(int j = 0;j < n;j++)
		{
			if(!(a[j] % i))
				temp++;
		}
		ans = ans < temp?temp:ans;
	}
	if(!ans) ans++;
	printf("%d", an
	return 0;s);
}


#include <bits/stdc++.h>
using namespace std;
bool p[100001];
int z[50000];
int kt(int n)
{
	int c = sqrt(n);
	for(int i = 2;i <= c;i++)
		if(!(n % i))
			return 0;
	return 1;
}

int main ()
{
	int q = 2;
	z[1] = 2;
	memset(p,true,sizeof(p));
	for(int i = 2;i < 100001;i++)
	{
		if(p[i])
		{
			if(kt(i))
			{
				for(int l = i + i;l < 100001;l += i)
					p[l] = false;
			}
		}
	}
	for(int i = 3;i < 100001;i++)
	{
		if(p[i])
			z[q++] = i;
	}
	int n,ans = 0,t;
	scanf("%d",&n);
	int a[n];
	for(int i = 0;i < n;i++)
	{
		scanf("%d", &a[i]);
	}
	sort(a,a + n);
	for(int i = 0;i < n;i++)
	{
		if(a[i] == 1)
			continue;
		for(int k = 1;z[k] <= a[i];k++)
		{
			if(!(a[i] % z[k]))
			{
				t = z[k];
				break;
			}
		}
		int temp = 1;
		for(int j = n - 1;j > i;j--)
		{
			if(!(a[j] % t))
				temp++;
		}
		ans = ans < temp ? temp : ans;
	}
	if(!ans) ans++;
	printf("%d", ans);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main ()
{
	int n,ans = 0,max = 0;
	scanf("%d",&n);
	int a[n];
	for(int i = 0;i < n;i++)
	{
		scanf("%d", &a[i]);
		max = max > a[i]/2?max:a[i]/2;
	}
	for(int i = 2;i <= max;i++)
	{
		int temp = 0;
		for(int j = 0;j < n;j++)
		{
			if(!(a[j] % i))
				temp++;
		}
		ans = ans < temp?temp:ans;
	}
	if(!ans) ans++;
	printf("%d", ans);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main ()
{
	int n,ans = 0;
	scanf("%d",&n);
	int a[n];
	for(int i = 0;i < n;i++)
	{
		scanf("%d", &a[i]);
	}
	sort(a,a + n);
	for(int i = n - 1;i >= 0;i--)
	{
		if(a[i] == 1)
			continue;
		int temp = 1;
		for(int j = 0;j < i;j++)
		{
			if(!(a[i] % a[j]))
				temp++;
		}
		ans = ans < temp ? temp : ans;
	}
	if(!ans) ans++;
	printf("%d", ans);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

bool snt(int o)
{
	int q = sqrt(o);
	for(int i = 2;i <= o;i++)
		if(!(q % i))
		{
			if(o == 2)
				return true;
			else return false;
		}
	return true;
}

int main ()
{
	int n,ans = 0,max = 0;
	scanf("%d",&n);
	int a[n];
	for(int i = 0;i < n;i++)
	{
		scanf("%d", &a[i]);
		max = max > a[i]/2?max:a[i]/2;
	}
	max += 10;
	for(int i = 2;i <= max;i++)
	{
		if(!snt(i))
			continue;
		int temp = 0;
		for(int j = 0;j < n;j++)
		{
			if(!(a[j] % i))
				temp++;
		}
		ans = ans < temp?temp:ans;
	}
	if(!ans) ans++;
	printf("%d", ans);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main ()
{
	int n,ans = 0;
	scanf("%d",&n);
	int a[n];
	for(int i = 0;i < n;i++)
	{
		scanf("%d", &a[i]);
	}
	sort(a,a + n);
	for(int i = 0;i < n;i++)
	{
		if(a[i] == 1)
			continue;
		int temp = 1;
		for(int j = 0;j < i;j++)
		{
			if(!(a[i] % a[j]))
				temp++;
		}
		ans = ans < temp ? temp : ans;
	}
	if(!ans) ans++;
	printf("%d", ans);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main ()
{
	int n,ans = 0;
	scanf("%d",&n);
	int a[n];
	for(int i = 0;i < n;i++)
	{
		scanf("%d", &a[i]);
	}
	sort(a,a + n);
	for(int i = 0;i < n;i++)
	{
		if(a[i] == 1)
			continue;
		int temp = 0;
		for(int j = i;j < n;j++)
		{
			if(!(a[j] % a[i]))
				temp++;
		}
		ans = ans < temp ? temp : ans;
	}
	printf("%d", ans);
	return 0;
}


// author: RENT
// lang  : C/C++
#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>
using namespace std;

/* Begin define all keywords to quick write... */
#define FOR(i, a, b) for (int i = (a), _b = (b); i <= _b; ++i)
#define FORD(i, a, b) for (int i = (a), _b = (b); i >= _b; --i)
#define REP(i, a) for (int i = 0, _a = (a); i < _a; ++i)
#define _it(i,v) for (typeof((v).begin()) i = (v).begin(); i != (v).end(); ++i)
#define _all(v) v.begin(), v.end()

#define pb push_back
#define mp make_pair
#define fi first
#define se second

#define ll long long

#define DEBUG(x) { cout << "--> " << #x << " = " << x << '\n'; }
#define PR(a,n) { cout << "--> " << #a << " = "; FOR(_,1,n) cout << a[_] << ' '; cout << endl; }
#define PR0(a,n) { cout << "--> " << #a << " = "; REP(_,n) cout << a[_] << ' '; cout << endl; }
#define sqr(x) ((x)*(x))
#define ms(a,val) memset(a, val, sizeof(a))

#define inf         (int)1e9
#define EPS         (double)1e-8
#define mod         1000000007
#define PI          3.14159265358979
/* End define template... */

const int MN = 100025;
int cnt[MN], pr[MN], lp[MN];

void solve() {
    // solution starts...

    FOR(i,2,MN-1) {
        if(!pr[i]) {
            lp[i] = i;
            for(int j = i+i; j < MN; j+= i) {
                pr[j] = 1;
                lp[j] = i;
            }
        }
    }
    int n, x;
    cin >> n;
    REP(i,n) {
        cin >> x;
        while(x > 1) {
            int d = lp[x];
            cnt[d]++;
            while(!(x%d)) {
                x /= d;
            }
        }
    }
    int ans(1);
    for(int i = 2; i < MN-1; i++) {
        ans = max(ans, cnt[i]);
    }
    cout << ans << endl;

    // solution end...
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    // open input files....
    // #ifndef ONLINE_JUDGE
    //     assert(freopen("INPUT.inp", "r", stdin));
    // #endif
    // close input files and process program function...

    solve();
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

bool snt(int o)
{
	int q = sqrt(o);
	for(int i = 2;i <= o;i++)
		if(!(q % i))
		{
			if(o == 2)
				return true;
			else return false;
		}
	return true;
}

int main ()
{
	int n,ans = 0,max = 0;
	scanf("%d",&n);
	int a[n];
	for(int i = 0;i < n;i++)
	{
		scanf("%d", &a[i]);
		max = max > a[i]/2?max:a[i]/2;
	}
	for(int i = 2;i <= max;i++)
	{
		if(!snt(i))
			continue;
		int temp = 0;
		for(int j = 0;j < n;j++)
		{
			if(!(a[j] % i))
				temp++;
		}
		ans = ans < temp?temp:ans;
	}
	if(!ans) ans++;
	printf("%d", ans);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int a[100000],b[100000],ans = 0;
int main ()
{
	int n;
	scanf("%d",&n);
	int a[n];
	for(int i = 0;i < n;i++)
	{
		scanf("%d", &a[i]);
	}
	sort(a,a + n);
	int b[n];
	for(int i = 0;i < n;i++)
	{
		int temp = 0;
		for(int j = i;j < n;j++)
		{
			if(!(a[j] % a[i]))
				temp++;
		}
		ans = ans < temp ? temp : ans;
	}
	printf("%d", ans);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

bool snt(int o)
{
	if(o == 2)
		return true;
	int q = sqrt(o);
	for(int i = 2;i <= q;i++)
		if(!(o % i))
		{
			 return false;
		}
	return true;
}

int main ()
{
	int n,ans = 0,max = 0;
	scanf("%d",&n);
	int a[n];
	for(int i = 0;i < n;i++)
	{
		scanf("%d", &a[i]);
		max = max > a[i]?max:a[i];
	}
	for(int i = 2;i <= max;i++)
	{
		if(!snt(i))
			continue;
		int temp = 0;
		for(int j = 0;j < n;j++)
		{
			if(!(a[j] % i))
				temp++;
		}
		ans = ans < temp?temp:ans;
	}
	if(!ans) ans++;
	printf("%d", ans);
}


#include <bits/stdc++.h>
using namespace std;

int main ()
{
	int n,ans = 0,t;
	scanf("%d",&n);
	int a[n];
	for(int i = 0;i < n;i++)
	{
		scanf("%d", &a[i]);
	}
	sort(a,a + n);
	for(int i = 0;i < n;i++)
	{
		if(a[i] == 1)
			continue;
		for(int k = 2;k <= a[i];k++)
		{
			if(!(a[i] % k))
			{
				t = k;
				break;
			}
		}
		int temp = 1;
		for(int j = n - 1;j > i;j--)
		{
			if(!(a[j] % t))
				temp++;
		}
		ans = ans < temp ? temp : ans;
	}
	if(!ans) ans++;
	printf("%d", ans);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main ()
{
	int n,ans = 0;
	scanf("%d",&n);
	int a[n];
	for(int i = 0;i < n;i++)
	{
		scanf("%d", &a[i]);
	}
	sort(a,a + n);
	int k = a[(n-1)/2]/2;
	for(int i = 2;i <= k;i++)
	{
		int temp = 0;
		for(int j = 0;j < n;j++)
		{
			if(!(a[j] % i))
				temp++;
		}
		ans = ans < temp?temp:ans;
	}
	printf("%d", ans);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

bool snt(int o)
{
	int q = sqrt(o);
	for(int i = 2;i <= o;i++)
		if(!(q % i))
		{
			if(o == 2)
				return true;
			else return false;
		}
	return true;
}

int main ()
{
	int n,ans = 0,max = 0;
	scanf("%d",&n);
	int a[n];
	for(int i = 0;i < n;i++)
	{
		scanf("%d", &a[i]);
		max = max > a[i]/2?max:a[i]/2;
	}
	max += 7;
	for(int i = 2;i <= max;i++)
	{
		if(!snt(i))
			continue;
		int temp = 0;
		for(int j = 0;j < n;j++)
		{
			if(!(a[j] % i))
				temp++;
		}
		ans = ans < temp?temp:ans;
	}
	if(!ans) ans++;
	printf("%d", an
	return 0;s);
}


#include <bits/stdc++.h>
using namespace std;

int main ()
{
	int n,ans = 0;
	scanf("%d",&n);
	int a[n];
	for(int i = 0;i < n;i++)
	{
		scanf("%d", &a[i]);
	}
	sort(a,a + n);
	for(int i = 0;i < n;i++)
	{
		int temp = 0;
		for(int j = i;j < n;j++)
		{
			if(!(a[j] % a[i]))
				temp++;
		}
		ans = ans < temp ? temp : ans;
	}
	printf("%d", ans);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main ()
{
	int n,ans = 0;
	scanf("%d",&n);
	int a[n];
	for(int i = 0;i < n;i++)
	{
		scanf("%d", &a[i]);
	}
	sort(a,a + n);
	for(int i = 0;i < n;i++)
	{
		if(a[i] == 1)
			continue;
		int temp = 0;
		for(int j = i;j < n;j++)
		{
			if(!(a[j] % a[i]))
				temp++;
		}
		ans = ans < temp ? temp : ans;
	}
	if(!ans) ans++;
	printf("%d", ans);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

bool snt(int o)
{
	int q = sqrt(o);
	for(int i = 2;i <= o;i++)
		if(!(o % i))
		{
			if(o == 2)
				return true;
			else return false;
		}
	return true;
}

int main ()
{
	int n,ans = 0,max = 0;
	scanf("%d",&n);
	int a[n];
	for(int i = 0;i < n;i++)
	{
		scanf("%d", &a[i]);
		max = max > a[i]/2?max:a[i]/2;
	}
	max += 10;
	for(int i = 2;i <= max;i++)
	{
		if(!snt(i))
			continue;
		int temp = 0;
		for(int j = 0;j < n;j++)
		{
			if(!(a[j] % i))
				temp++;
		}
		ans = ans < temp?temp:ans;
	}
	if(!ans) ans++;
	printf("%d", ans);
	return 0;
}


#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<set>
#include<cstring>
#include<queue>
#include<map>
#include<stack>
#include<climits>
#include<cmath>
#include<sstream>
using namespace std;

long long n;
int a[100005];
int prime[100005];
int cnt[100005];

int main(){
	cin >> n;
	for(int i = 0; i < n; i++) cin >> a[i];

	for(int i = 2; i <= 100000; i++) prime[i] = 1;

	memset(cnt, 0, sizeof cnt);

	prime[0] = prime[1] = 0;

	for(long long i = 2; i <= 100000; i ++) {
		if(prime[i] == 1) {
			for(long long j = i; j*i <= 100000; j++) prime[i*j] = 0;
		}
	}

	vector<int> p;
	for(int i = 2; i <= 100000; i++) if(prime[i] == 1) p.push_back(i);

	//for(int i = 0; i < p.size(); i++) cout << p[i] << endl;

	//cout << p[p.size()-1] << " " << prime[99991] << endl;

	for(int i = 0; i < n; i++) {
		for(int j = 0; j < p.size(); j++) {

			if(prime[a[i]] == 1) {
				cnt[a[i]]++;
				break;
			}

			if(p[j] > a[i]) break;

			if((a[i]%p[j]) == 0) {
				cnt[p[j]]++;

				while(a[i] >= p[j]) a[i] /= p[j];
			}
		}
	}

	//for(int i = 0; i <= 10; i++) {
	//	cout << p[i] << " " << cnt[p[i]] << endl;
	//}
	//cout << endl;

	int ret = 1;
	for(int i = 0; i < p.size(); i++) {
		ret = max(ret, cnt[p[i]]);
	}

	cout << ret << endl;
}


#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<set>
#include<cstring>
#include<queue>
#include<map>
#include<stack>
#include<climits>
#include<cmath>
#include<sstream>
using namespace std;

long long n;
int a[100005];
int prime[100005];
int cnt[100005];

int main(){
	cin >> n;
	for(int i = 0; i < n; i++) cin >> a[i];

	memset(prime, 1, sizeof prime);
	memset(cnt, 0, sizeof cnt);

	for(long long i = 2; i <= 100000; i ++) {
		if(prime[i]) {
			for(long long j = i*2; j <= n; j+=i) prime[j] = 0;
		}
	}

	vector<int> p;
	for(int i = 2; i <= 100000; i++) if(prime[i]) p.push_back(i);

	//for(int i = 0; i < p.size(); i++) cout << p[i] << endl;

	for(int i = 0; i < n; i++) {
		for(int j = 0; j < p.size(); j++) {
//			cout << a[i] << " " << p[j] << endl;

			if(p[j] > a[i]) break;

			if((a[i]%p[j]) == 0) {
				cnt[p[j]]++;

				while(a[i] >= p[j]) a[i] /= p[j];
			}
		}
	}

	int ret = 1;
	for(int i = 0; i < p.size(); i++) {
		ret = max(ret, cnt[p[i]]);
	}

	cout << ret << endl;
}


#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<set>
#include<cstring>
#include<queue>
#include<map>
#include<stack>
#include<climits>
#include<cmath>
#include<sstream>
using namespace std;

int n;
int a[100005];
int prime[100005];
int cnt[100005];

int main(){
	cin >> n;
	for(int i = 0; i < n; i++) cin >> a[i];

	prime[0] = prime[1] = 0;
	for(int i = 2; i <= 100004; i++) prime[i] = 1;
	for(int i = 0; i <= 100004; i++) cnt[i] = 0;

	for(long long i = 2; i <= 100000; i ++) {
		if(prime[i] == 1) {
			for(long long j = i; j*i <= 100000; j++) prime[i*j] = 0;
		}
	}

	vector<int> p;
	for(int i = 2; i <= 100000; i++) if(prime[i] == 1) p.push_back(i);

	int ret = 1;
	for(int i = 0; i < n; i++) {
		for(int j = 0; j < p.size(); j++) {

			if(prime[a[i]] == 1 && a[i] > 1) {
				cnt[a[i]]++;
				break;
			}

			//cout << a[i] << endl;

			if(p[j] > a[i]) break;

			if((a[i]%p[j]) == 0) {
				cnt[p[j]]++;

				while(a[i]%p[j] == 0) a[i] /= p[j];
			}
		}
	}

	for(int i = 0; i < p.size(); i++) {
		ret = max(ret, cnt[p[i]]);
	}

	cout << ret << endl;
}


#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<set>
#include<cstring>
#include<queue>
#include<map>
#include<stack>
#include<climits>
#include<cmath>
#include<sstream>
using namespace std;

long long n;
int a[100005];
int prime[100005];
int cnt[100005];

int main(){
	cin >> n;
	for(int i = 0; i < n; i++) cin >> a[i];

	memset(prime, 1, sizeof prime);
	memset(cnt, 0, sizeof cnt);

	for(long long i = 2; i <= 100000; i ++) {
		if(prime[i]) {
			for(long long j = i*2; j <= 100000; j+=i) prime[j] = 0;
		}
	}

	vector<int> p;
	for(int i = 2; i <= 100000; i++) if(prime[i]) p.push_back(i);

	//for(int i = 0; i < p.size(); i++) cout << p[i] << endl;

	for(int i = 0; i < n; i++) {
		for(int j = 0; j < p.size(); j++) {

			//if(prime[a[i]]) {
			//	cnt[a[i]]++;
			//	break;
			//}

			if(p[j] > a[i]) break;

			if((a[i]%p[j]) == 0) {
				cnt[p[j]]++;

				while(a[i] >= p[j]) a[i] /= p[j];
			}
		}
	}

	//for(int i = 0; i <= 10; i++) {
	//	cout << p[i] << " " << cnt[p[i]] << endl;
	//}
	//cout << endl;

	int ret = 1;
	for(int i = 0; i < p.size(); i++) {
		ret = max(ret, cnt[p[i]]);
	}

	cout << ret << endl;
}


#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<set>
#include<cstring>
#include<queue>
#include<map>
#include<stack>
#include<climits>
#include<cmath>
#include<sstream>
using namespace std;

int n;
int a[100005];
int prime[100005];
int cnt[100005];

int main(){
	cin >> n;
	for(int i = 0; i < n; i++) cin >> a[i];

	memset(prime, 1, sizeof prime);
	memset(cnt, 0, sizeof cnt);

	for(int i = 2; i*i <= n; i ++) {
		if(prime[i]) {
			for(int j = i*2; j <= n; j+=i) prime[j] = 0;
		}
	}

	vector<int> p;
	for(int i = 2; i <= n; i++) if(prime[i]) p.push_back(i);

	for(int i = 0; i < n; i++) {
		for(int j = 0; j < p.size(); j++) {
			if(p[j] > a[i]) break;

			if(a[i]%p[j] == 0) {
				cnt[p[j]]++;

				while(a[i] >= p[j]) a[i] /= p[j];
			}
		}
	}

	int ret = 0;
	for(int i = 0; i < p.size(); i++) {
		ret = max(ret, cnt[p[i]]);
	}

	cout << ret << endl;
}


#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<set>
#include<cstring>
#include<queue>
#include<map>
#include<stack>
#include<climits>
#include<cmath>
#include<sstream>
using namespace std;

long long n;
int a[100005];
int prime[100005];
int cnt[100005];

int main(){
	cin >> n;
	for(int i = 0; i < n; i++) cin >> a[i];

	for(int i = 2; i <= 100000; i++) prime[i] = 1;

	memset(cnt, 0, sizeof cnt);

	prime[0] = prime[1] = 0;

	for(long long i = 2; i <= 100000; i ++) {
		if(prime[i] == 1) {
			for(long long j = i; j*i <= 100000; j++) prime[i*j] = 0;
		}
	}

	vector<int> p;
	for(int i = 2; i <= 100000; i++) if(prime[i] == 1) p.push_back(i);

	int ret = 0;
	for(int i = 0; i < n; i++) ret += (a[i] == 1);

	if(ret == 0) ret = 1;

	//for(int i = 0; i < p.size(); i++) cout << p[i] << endl;

	//cout << p[p.size()-1] << " " << prime[99991] << endl;

	for(int i = 0; i < n; i++) {
		for(int j = 0; j < p.size(); j++) {

			if(prime[a[i]] == 1) {
				cnt[a[i]]++;
				break;
			}

			if(p[j] > a[i]) break;

			if((a[i]%p[j]) == 0) {
				cnt[p[j]]++;

				while(a[i] >= p[j]) a[i] /= p[j];
			}
		}
	}

	for(int i = 0; i < p.size(); i++) {
		ret = max(ret, cnt[p[i]]);
	}

	cout << ret << endl;
}


#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<set>
#include<cstring>
#include<queue>
#include<map>
#include<stack>
#include<climits>
#include<cmath>
#include<sstream>
using namespace std;

long long n;
int a[100005];
int prime[100005];
int cnt[100005];

int main(){
	cin >> n;
	for(int i = 0; i < n; i++) cin >> a[i];

	memset(prime, 1, sizeof prime);
	memset(cnt, 0, sizeof cnt);

	for(long long i = 2; i <= 100000; i ++) {
		if(prime[i]) {
			for(long long j = i*2; j <= n; j+=i) prime[j] = 0;
		}
	}

	vector<int> p;
	for(int i = 2; i <= 100000; i++) if(prime[i]) p.push_back(i);

	//for(int i = 0; i < p.size(); i++) cout << p[i] << endl;

	for(int i = 0; i < n; i++) {
		for(int j = 0; j < p.size(); j++) {

			if(prime[a[i]]) {
				cnt[a[i]]++;
				break;
			}

			if(p[j] > a[i]) break;

			if((a[i]%p[j]) == 0) {
				cnt[p[j]]++;

				while(a[i] >= p[j]) a[i] /= p[j];
			}
		}
	}

	int ret = 1;
	for(int i = 0; i < p.size(); i++) {
		ret = max(ret, cnt[p[i]]);
	}

	cout << ret << endl;
}


#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<set>
#include<cstring>
#include<queue>
#include<map>
#include<stack>
#include<climits>
#include<cmath>
#include<sstream>
using namespace std;

long long n;
int a[100005];
int prime[100005];
int cnt[100005];

int main(){
	cin >> n;
	for(int i = 0; i < n; i++) cin >> a[i];

	prime[0] = prime[1] = 0;
	for(int i = 2; i <= 100004; i++) prime[i] = 1;
	for(int i = 0; i <= 100004; i++) cnt[i] = 0;

	for(long long i = 2; i <= 100000; i ++) {
		if(prime[i] == 1) {
			for(long long j = i; j*i <= 100000; j++) prime[i*j] = 0;
		}
	}

	vector<int> p;
	for(int i = 2; i <= 100000; i++) if(prime[i] == 1) p.push_back(i);

	int ret = 1;
	for(int i = 0; i < n; i++) {
		for(int j = 0; j < p.size(); j++) {

			if(prime[a[i]] == 1) {
				cnt[a[i]]++;
				a[i] = 1;
				break;
			}

			if(p[j] > a[i]) break;

			if((a[i]%p[j]) == 0) {
				cnt[p[j]]++;

				while(a[i] >= p[j]) a[i] /= p[j];
			}
		}
	}

	for(int i = 0; i < p.size(); i++) {
		ret = max(ret, cnt[p[i]]);
	}

	cout << ret << endl;
}


#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<set>
#include<cstring>
#include<queue>
#include<map>
#include<stack>
#include<climits>
#include<cmath>
#include<sstream>
using namespace std;

int n;
int a[100005];
int prime[100005];
long long cnt[100005];

int main(){
	cin >> n;
	for(int i = 0; i < n; i++) cin >> a[i];

	prime[0] = prime[1] = 0;
	for(int i = 2; i <= 100004; i++) prime[i] = 1;
	for(int i = 0; i <= 100004; i++) cnt[i] = 0;

	for(long long i = 2; i <= 100000; i ++) {
		if(prime[i] == 1) {
			for(long long j = i; j*i <= 100000; j++) prime[i*j] = 0;
		}
	}

	vector<int> p;
	for(int i = 2; i <= 100000; i++) if(prime[i] == 1) p.push_back(i);

	int ret = 1;
	for(int i = 0; i < n; i++) {
		for(int j = 0; j < p.size(); j++) {

			if(prime[a[i]] == 1 && a[i] > 1) {
				cnt[a[i]]++;
				break;
			}

			if(p[j] > a[i]) break;

			if((a[i]%p[j]) == 0) {
				cnt[p[j]]++;

				while(a[i] >= p[j]) a[i] /= p[j];
			}
		}
	}

	for(int i = 0; i < p.size(); i++) {
		ret = max(ret, cnt[p[i]]);
	}

	cout << ret << endl;
}


#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<set>
#include<cstring>
#include<queue>
#include<map>
#include<stack>
#include<climits>
#include<cmath>
#include<sstream>
using namespace std;

long long n;
int a[100005];
int prime[100005];
int cnt[100005];

int main(){
	cin >> n;
	for(int i = 0; i < n; i++) cin >> a[i];

	memset(prime, 1, sizeof prime);
	memset(cnt, 0, sizeof cnt);

	for(long long i = 2; i*i <= n; i ++) {
		if(prime[i]) {
			for(long long j = i*2; j <= n; j+=i) prime[j] = 0;
		}
	}

	vector<int> p;
	for(int i = 2; i <= n; i++) if(prime[i]) p.push_back(i);

	for(int i = 0; i < n; i++) {
		for(int j = 0; j < p.size(); j++) {
			if(p[j] > a[i]) break;

			if((a[i]%p[j]) == 0) {
				cnt[p[j]]++;

				while(a[i] >= p[j]) a[i] /= p[j];
			}
		}
	}

	int ret = 1;
	for(int i = 0; i < p.size(); i++) {
		ret = max(ret, cnt[p[i]]);
	}

	cout << ret << endl;
}


#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<set>
#include<cstring>
#include<queue>
#include<map>
#include<stack>
#include<climits>
#include<cmath>
#include<sstream>
using namespace std;

int n;
int a[100005];
int prime[100005];
int cnt[100005];

int main(){
	cin >> n;
	for(int i = 0; i < n; i++) cin >> a[i];

	prime[0] = prime[1] = 0;
	for(int i = 2; i <= 100004; i++) prime[i] = 1;
	for(int i = 0; i <= 100004; i++) cnt[i] = 0;

	for(long long i = 2; i <= 100000; i ++) {
		if(prime[i] == 1) {
			for(long long j = i; j*i <= 100000; j++) prime[i*j] = 0;
		}
	}

	vector<int> p;
	for(int i = 2; i <= 100000; i++) if(prime[i] == 1) p.push_back(i);

	int ret = 1;
	for(int i = 0; i < n; i++) {
		for(int j = 0; j < p.size(); j++) {

			if(prime[a[i]] == 1 && a[i] > 1) {
				cnt[a[i]]++;
				break;
			}

			if(p[j] > a[i]) break;

			if((a[i]%p[j]) == 0) {
				cnt[p[j]]++;

				while(a[i] >= p[j]) a[i] /= p[j];
			}
		}
	}

	for(int i = 0; i < p.size(); i++) {
		ret = max(ret, cnt[p[i]]);
	}

	cout << ret << endl;
}


#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<set>
#include<cstring>
#include<queue>
#include<map>
#include<stack>
#include<climits>
#include<cmath>
#include<sstream>
using namespace std;

long long n;
int a[100005];
int prime[100005];
int cnt[100005];

int main(){
	cin >> n;
	for(int i = 0; i < n; i++) cin >> a[i];

	for(int i = 2; i <= 100000; i++) prime[i] = 1;

	memset(cnt, 0, sizeof cnt);

	prime[0] = prime[1] = 0;

	for(long long i = 2; i <= 100000; i ++) {
		if(prime[i]) {
			for(long long j = i*2; j <= 100000; j+=i) prime[j] = 0;
		}
	}

	vector<int> p;
	for(int i = 2; i <= 100000; i++) if(prime[i]) p.push_back(i);

	//for(int i = 0; i < p.size(); i++) cout << p[i] << endl;

	//cout << p[p.size()-1] << " " << prime[99991] << endl;

	for(int i = 0; i < n; i++) {

		for(int j = 0; j < p.size(); j++) {

			if(prime[a[i]] == 1) {
				cnt[a[i]]++;
				break;
			}

			if(p[j] > a[i]) break;

			if((a[i]%p[j]) == 0) {
				cnt[p[j]]++;

				while(a[i] >= p[j]) a[i] /= p[j];
			}
		}
	}

	//for(int i = 0; i <= 10; i++) {
	//	cout << p[i] << " " << cnt[p[i]] << endl;
	//}
	//cout << endl;

	int ret = 1;
	for(int i = 0; i < p.size(); i++) {
		ret = max(ret, cnt[p[i]]);
	}

	cout << ret << endl;
}


#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<set>
#include<cstring>
#include<queue>
#include<map>
#include<stack>
#include<climits>
#include<cmath>
#include<sstream>
using namespace std;

long long n;
int a[100005];
int prime[100005];
int cnt[100005];

int main(){
	cin >> n;
	for(int i = 0; i < n; i++) cin >> a[i];

	memset(prime, 1, sizeof prime);
	memset(cnt, 0, sizeof cnt);

	for(long long i = 2; i <= 100000; i ++) {
		if(prime[i]) {
			for(long long j = i*2; j <= 100000; j+=i) prime[j] = 0;
		}
	}

	vector<int> p;
	for(int i = 2; i <= 100000; i++) if(prime[i]) p.push_back(i);

	//for(int i = 0; i < p.size(); i++) cout << p[i] << endl;

	for(int i = 0; i < n; i++) {
		for(int j = 0; j < p.size(); j++) {

			if(prime[a[i]]) {
				cnt[a[i]]++;
				break;
			}

			if(p[j] > a[i]) break;

			if((a[i]%p[j]) == 0) {
				cnt[p[j]]++;

				while(a[i] >= p[j]) a[i] /= p[j];
			}
		}
	}

	//for(int i = 0; i <= 10; i++) {
	//	cout << p[i] << " " << cnt[p[i]] << endl;
	//}
	//cout << endl;

	int ret = 1;
	for(int i = 0; i < p.size(); i++) {
		ret = max(ret, cnt[p[i]]);
	}

	cout << ret << endl;
}


#include<fstream>
#include<string>
#include<vector>
#include<iostream>
#include <algorithm>
using namespace std;
typedef  long long ll;

int main(){
    ll n;
    cin>>n;
    vector<ll> Strength (n);
    for (ll i=0;i<n;i++){
        ll a;
        cin>>a;
        Strength.push_back(a);
    }
    ll rec=0;
    for (ll t=2;t<317;t++){
        ll att=0;
        for (ll i=0;i<n;i++){
            if (Strength[i]%t==0){
                att++;
            }
        }
        if (att>rec){
            rec=att;
        }
    }
    cout<<rec;
    return 0;
}


#include<fstream>
#include<string>
#include<vector>
#include<iostream>
#include <algorithm>
using namespace std;
typedef  long long ll;

vector<ll> primes(ll n){
    vector<bool> prime(n+1);
    prime[0]=false;
    prime[1]=false;
    for (ll i=2;i<=n;i++){
        prime[i]=true;
    }
    for (ll i=2;i<=sqrt(n);i++){
        if (prime[i]){
            for (ll j=2;j*i<=n;j++){
                prime[i*j]=false;
            }
        }
    }
    vector<ll> prim;
    for (ll i=2;i<=n;i++){
        if (prime[i]) prim.push_back(i);
    }
    return(prim);
}

int main(){
    ll n;
    cin>>n;
    vector<ll> Strength (n);
    for (ll i=0;i<n;i++){
        cin>>Strength[i];
    }
    ll rec=0;
    for (ll i=0;i<n;i++){
        if (Strength[i]==1){
            rec=1;
        }
    }
    vector<ll> V=primes(20000);
    for (ll t=0;t<V.size();t++){
        ll att=0;
        for (ll i=0;i<n;i++){
            if ((Strength[i]%V[t])==0){
                att++;
            }
        }
        if (att>rec){
            rec=att;
        }
    }
    cout<<rec;
    return 0;
}


#include<fstream>
#include<string>
#include<vector>
#include<iostream>
#include <algorithm>
using namespace std;
typedef  long long ll;

int main(){
    ll n;
    cin>>n;
    vector<ll> Strength (n);
    for (ll i=0;i<n;i++){
        cin>>Strength[i];
    }
    ll rec=0;
    for (ll i=0;i<n;i++){
        if (Strength[i]==1){
            rec=1;
        }
    }
    for (ll t=2;t<317;t++){
        ll att=0;
        for (ll i=0;i<n;i++){
            if ((Strength[i]%t)==0){
                att++;
            }
        }
        if (att>rec){
            rec=att;
        }
    }
    cout<<rec;
    return 0;
}


#include<fstream>
#include<string>
#include<vector>
#include<iostream>
#include <algorithm>
using namespace std;
typedef  long long ll;

vector<ll> primes(ll n){
    vector<bool> prime(n+1);
    prime[0]=false;
    prime[1]=false;
    for (ll i=2;i<=n;i++){
        prime[i]=true;
    }
    for (ll i=2;i<=sqrt(n);i++){
        if (prime[i]){
            for (ll j=2;j*i<=n;j++){
                prime[i*j]=false;
            }
        }
    }
    vector<ll> prim;
    for (ll i=2;i<=n;i++){
        if (prime[i]) prim.push_back(i);
    }
    return(prim);
}

int main(){
    ll n;
    cin>>n;
    vector<ll> Strength (n);
    for (ll i=0;i<n;i++){
        cin>>Strength[i];
    }
    ll rec=0;
    for (ll i=0;i<n;i++){
        if (Strength[i]==1){
            rec=1;
        }
    }
    vector<ll> V=primes(10000);
    for (ll t=0;t<V.size();t++){
        ll att=0;
        for (ll i=0;i<n;i++){
            if ((Strength[i]%V[t])==0){
                att++;
            }
        }
        if (att>rec){
            rec=att;
        }
    }
    cout<<rec;
    return 0;
}


#include<fstream>
#include<string>
#include<vector>
#include<iostream>
#include <algorithm>
using namespace std;
typedef  long long ll;

vector<ll> primes(ll n){
    vector<bool> prime(n+1);
    prime[0]=false;
    prime[1]=false;
    for (ll i=2;i<=n;i++){
        prime[i]=true;
    }
    for (ll i=2;i<=sqrt(n);i++){
        if (prime[i]){
            for (ll j=2;j*i<=n;j++){
                prime[i*j]=false;
            }
        }
    }
    vector<ll> prim;
    for (ll i=2;i<=n;i++){
        if (prime[i]) prim.push_back(i);
    }
    return(prim);
}

int main(){
    ll n;
    cin>>n;
    vector<ll> Strength (n);
    for (ll i=0;i<n;i++){
        cin>>Strength[i];
    }
    ll rec=0;
    for (ll i=0;i<n;i++){
        if (Strength[i]==1){
            rec=1;
        }
    }
    vector<ll> V=primes(100000);
    for (ll t=0;t<V.size();t++){
        ll att=0;
        for (ll i=0;i<n;i++){
            if ((Strength[i]%V[t])==0){
                att++;
            }
        }
        if (att>rec){
            rec=att;
        }
    }
    cout<<rec;
    return 0;
}


#include<fstream>
#include<string>
#include<vector>
#include<iostream>
#include <algorithm>
using namespace std;
typedef  long long ll;

int main(){
    ll n;
    ll big = 0;
    cin>>n;
    vector<ll> cnt (123456);
    for (ll i=0;i<n;i++){
        ll t;
        cin>>t;
        big = max(t, big);
        cnt[t]++;
    }

    ll rec=1;
    vector<bool> pokeys (123456,true);
    pokeys[0] = pokeys[1] = false;
    for(ll i = 2; i <= big; i++){
        if(pokeys[i]){
            ll att = 0;
            for(ll j=i; j<=big; j+=i){
                att+=cnt[j];
                pokeys[j] = false;
            }
            rec=max(att,rec);
        }
    }
    cout<<rec;
    return 0;
}


#include<fstream>
#include<string>
#include<vector>
#include<iostream>
#include <algorithm>
using namespace std;
typedef  long long ll;

vector<ll> primes(ll n){
    vector<bool> prime(n+1);
    prime[0]=false;
    prime[1]=false;
    for (ll i=2;i<=n;i++){
        prime[i]=true;
    }
    for (ll i=2;i<=sqrt(n);i++){
        if (prime[i]){
            for (ll j=2;j*i<=n;j++){
                prime[i*j]=false;
            }
        }
    }
    vector<ll> prim;
    for (ll i=2;i<=n;i++){
        if (prime[i]) prim.push_back(i);
    }
    return(prim);
}

int main(){
    ll n;
    cin>>n;
    vector<ll> Strength (n);
    for (ll i=0;i<n;i++){
        cin>>Strength[i];
    }
    ll rec=0;
    for (ll i=0;i<n;i++){
        if (Strength[i]==1){
            rec=1;
        }
    }
    vector<ll> V=primes(40000);
    for (ll t=0;t<V.size();t++){
        ll att=0;
        for (ll i=0;i<n;i++){
            if ((Strength[i]%V[t])==0){
                att++;
            }
        }
        if (att>rec){
            rec=att;
        }
    }
    cout<<rec;
    return 0;
}


#include<fstream>
#include<string>
#include<vector>
#include<iostream>
#include <algorithm>
using namespace std;
typedef  long long ll;

int main(){
    ll n;
    cin>>n;
    vector<ll> cnt (123456);
    for (ll i=0;i<n;i++){
        ll t;
        cin>>t;
        cnt[t]++;
    }

    ll rec=1;
    vector<bool> pokeys (123456,true);
    pokeys[0] = pokeys[1] = false;
    for(ll i = 2; i <= n; i++){
        if(pokeys[i]){
            ll att = 0;
            for(ll j=i; j<=n; j++){
                att+=cnt[j];
                pokeys[j] = false;
            }
            rec=max(att,rec);
        }
    }
    cout<<rec;
    return 0;
}


#include<fstream>
#include<string>
#include<vector>
#include<iostream>
#include <algorithm>
using namespace std;
typedef  long long ll;

vector<ll> primes(ll n){
    vector<bool> prime(n+1);
    prime[0]=false;
    prime[1]=false;
    for (ll i=2;i<=n;i++){
        prime[i]=true;
    }
    for (ll i=2;i<=sqrt(n);i++){
        if (prime[i]){
            for (ll j=2;j*i<=n;j++){
                prime[i*j]=false;
            }
        }
    }
    vector<ll> prim;
    for (ll i=2;i<=n;i++){
        if (prime[i]) prim.push_back(i);
    }
    return(prim);
}

int main(){
    ll n;
    cin>>n;
    vector<ll> Strength (n);
    for (ll i=0;i<n;i++){
        cin>>Strength[i];
    }
    ll rec=0;
    for (ll i=0;i<n;i++){
        if (Strength[i]==1){
            rec=1;
        }
    }
    vector<ll> V=primes(25000);
    for (ll t=0;t<V.size();t++){
        ll att=0;
        for (ll i=0;i<n;i++){
            if ((Strength[i]%V[t])==0){
                att++;
            }
        }
        if (att>rec){
            rec=att;
        }
    }
    cout<<rec;
    return 0;
}


#include<fstream>
#include<string>
#include<vector>
#include<iostream>
#include <algorithm>
using namespace std;
typedef  long long ll;

vector<ll> primes(ll n){
    vector<bool> prime(n+1);
    prime[0]=false;
    prime[1]=false;
    for (ll i=2;i<=n;i++){
        prime[i]=true;
    }
    for (ll i=2;i<=sqrt(n);i++){
        if (prime[i]){
            for (ll j=2;j*i<=n;j++){
                prime[i*j]=false;
            }
        }
    }
    vector<ll> prim;
    for (ll i=2;i<=n;i++){
        if (prime[i]) prim.push_back(i);
    }
    return(prim);
}

int main(){
    ll n;
    cin>>n;
    vector<ll> Strength (n);
    for (ll i=0;i<n;i++){
        cin>>Strength[i];
    }
    ll rec=0;
    for (ll i=0;i<n;i++){
        if (Strength[i]==1){
            rec=1;
        }
    }
    vector<ll> V=primes(30000);
    for (ll t=0;t<V.size();t++){
        ll att=0;
        for (ll i=0;i<n;i++){
            if ((Strength[i]%V[t])==0){
                att++;
            }
        }
        if (att>rec){
            rec=att;
        }
    }
    cout<<rec;
    return 0;
}


#include<fstream>
#include<string>
#include<vector>
#include<iostream>
#include <algorithm>
using namespace std;
typedef  long long ll;

vector<ll> primes(ll n){
    vector<bool> prime(n+1);
    prime[0]=false;
    prime[1]=false;
    for (ll i=2;i<=n;i++){
        prime[i]=true;
    }
    for (ll i=2;i<=sqrt(n);i++){
        if (prime[i]){
            for (ll j=2;j*i<=n;j++){
                prime[i*j]=false;
            }
        }
    }
    vector<ll> prim;
    for (ll i=2;i<=n;i++){
        if (prime[i]) prim.push_back(i);
    }
    return(prim);
}

int main(){
    ll n;
    cin>>n;
    vector<ll> Strength (n);
    for (ll i=0;i<n;i++){
        cin>>Strength[i];
    }
    ll rec=0;
    for (ll i=0;i<n;i++){
        if (Strength[i]==1){
            rec=1;
        }
    }
    vector<ll> V=primes(22000);
    for (ll t=0;t<V.size();t++){
        ll att=0;
        for (ll i=0;i<n;i++){
            if ((Strength[i]%V[t])==0){
                att++;
            }
        }
        if (att>rec){
            rec=att;
        }
    }
    cout<<rec;
    return 0;
}


#include<fstream>
#include<string>
#include<vector>
#include<iostream>
#include <algorithm>
using namespace std;
typedef  long long ll;

int main(){
    ll n;
    cin>>n;
    vector<ll> Strength (n);
    for (ll i=0;i<n;i++){
        cin>>Strength[i];
    }
    ll rec=0;
    for (ll t=2;t<317;t++){
        ll att=0;
        for (ll i=0;i<n;i++){
            if ((Strength[i]%t)==0){
                att++;
            }
        }
        if (att>rec){
            rec=att;
        }
    }
    cout<<rec;
    return 0;
}


//
//
//
//
//
#include <bits/stdc++.h>

using namespace std;

#define topper top //WE ARE TOPPER

#define mp make_pair
#define pb push_back
#define db(x) cerr << #x << " == " <<  x << endl;
#define _ << " " <<

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<string> vs;
typedef pair<int,int> ii;
typedef stack<int> sti;

const ld EPS = 1e-9;
const int N=1e5+5;
const int MOD=1e9+7;
const int INF=0x3f3f3f3f;

int sieve[N], group[N], vis[N];
vi divisors[N];
set<int> primes;

int main(){
	ios_base::sync_with_stdio(false);

	int n, ans=0;
	cin >> n;

	for(int i=2;i*i<=N;++i){
		for(int j=2*i;j<=N;j+=i){
			sieve[j] = 1;
		}
	}

	for(int i=2;i<=N;++i) if(!sieve[i]) primes.insert(i);

	for(int i=0;i<n;++i){
		int u;
		cin >> u;
		if(vis[u]) for(int v : divisors[u]) group[v]++;
		else for(auto it=primes.begin();it!=primes.end();++it)	if(u%(*it) == 0)	divisors[u].pb(*it), group[*it]++;
	}

	for(auto it=primes.begin();it!=primes.end();++it) ans = max(ans, group[*it]);

	/*for(auto it=primes.begin();it!=primes.end();++it) if(*it <= 100){
		cout << *it << ": ";
		for(int u : group[*it]) cout << u << ' ';
		cout << endl;
	}*/

	cout << ans << endl;
	return 0;
}


//
//
//
//
//
#include <bits/stdc++.h>

using namespace std;

#define topper top //WE ARE TOPPER

#define mp make_pair
#define pb push_back
#define db(x) cerr << #x << " == " <<  x << endl;
#define _ << " " <<

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<string> vs;
typedef pair<int,int> ii;
typedef stack<int> sti;

const ld EPS = 1e-9;
const int N=1e5+5;
const int MOD=1e9+7;
const int INF=0x3f3f3f3f;

int sieve[N], group[N], vis[N], inp[N];
vi divisors[N];
set<int> primes, numbers;

int main(){
	ios_base::sync_with_stdio(false);

	int n, ans=0;
	cin >> n;

	for(int i=2;i*i<=N;++i){
		for(int j=2*i;j<=N;j+=i){
			sieve[j] = 1;
		}
	}

	for(int i=2;i<=N;++i) if(!sieve[i]) primes.insert(i);

	for(int i=0;i<n;++i){
		int u;
		cin >> u;
		if(!vis[u]) for(auto it=primes.begin();it!=primes.end();++it) if(u%(*it)==0) divisors[u].pb(*it);
		vis[u]++;
		numbers.insert(u);
	}

	for(auto it=numbers.begin();it!=numbers.end();++it){
		for(int j=0;j<vis[*it];++j){
			for(int k : divisors[*it]) group[k]++;
		}
	}

	for(auto it=primes.begin(); it!=primes.end(); ++it) ans = max(ans, group[*it]);

	cout << ans << endl;
	return 0;
}


//
//
//
//
//
#include <bits/stdc++.h>

using namespace std;

#define topper top //WE ARE TOPPER

#define mp make_pair
#define pb push_back
#define db(x) cerr << #x << " == " <<  x << endl;
#define _ << " " <<

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<string> vs;
typedef pair<int,int> ii;
typedef stack<int> sti;

const ld EPS = 1e-9;
const int N=1e5+5;
const int MOD=1e9+7;
const int INF=0x3f3f3f3f;

int sieve[N], group[N];
vi divisors[N];
set<int> primes;

int main(){
	ios_base::sync_with_stdio(false);

	int n, ans=0;
	bool only_1 = true;
	cin >> n;

	for(int i=2;i*i<=N;++i){
		if(!sieve[i])
		for(int j=2*i;j<=N;j+=i){
			sieve[j] = 1;
			divisors[j].pb(i);
		}
	}

	for(int i=2;i<=N;++i) if(!sieve[i]) divisors[i].pb(i), primes.insert(i);

	for(int i=0;i<n;++i){
		int u;
		cin >> u;
		if(u != 1) only_1 = false;
		for(int k : divisors[u]) group[k]++;
	}

	for(auto it=primes.begin(); it!=primes.end(); ++it) ans = max(ans, group[*it]);

	cout << ((only_1) ? 1 : ans) << endl;
	return 0;
}


//
//
//
//
//
#include <bits/stdc++.h>

using namespace std;

#define topper top //WE ARE TOPPER

#define mp make_pair
#define pb push_back
#define db(x) cerr << #x << " == " <<  x << endl;
#define _ << " " <<

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<string> vs;
typedef pair<int,int> ii;
typedef stack<int> sti;

const ld EPS = 1e-9;
const int N=1e5+5;
const int MOD=1e9+7;
const int INF=0x3f3f3f3f;

int sieve[N], group[N];
vi divisors[N];
set<int> primes;

int main(){
	ios_base::sync_with_stdio(false);

	int n, ans=0;
	bool only_1 = true;
	cin >> n;

	for(int i=2;i<=N;++i){
		for(int j=2*i;j<=N;j+=i){
			sieve[j] = 1;
			if(!sieve[i])	divisors[j].pb(i);
		}
	}

	for(int i=2;i<=N;++i) if(!sieve[i]) divisors[i].pb(i), primes.insert(i);

	for(int i=0;i<n;++i){
		int u;
		cin >> u;
		if(u != 1) only_1 = false;
		for(int k : divisors[u])	group[k]++;
	}

	for(auto it=primes.begin(); it!=primes.end(); ++it) ans = max(ans, group[*it]);

	cout << ((only_1) ? 1 : ans) << endl;
	return 0;
}


//
//
//
//
//
#include <bits/stdc++.h>

using namespace std;

#define topper top //WE ARE TOPPER

#define mp make_pair
#define pb push_back
#define db(x) cerr << #x << " == " <<  x << endl;
#define _ << " " <<

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<string> vs;
typedef pair<int,int> ii;
typedef stack<int> sti;

const ld EPS = 1e-9;
const int N=1e5+5;
const int MOD=1e9+7;
const int INF=0x3f3f3f3f;

int sieve[N];
map<int, vi> group;
set<int> primes;

int main(){
	ios_base::sync_with_stdio(false);

	int n, ans=0;
	cin >> n;

	for(int i=2;i*i<=N;++i){
		for(int j=2*i;j<=N;j+=i){
			sieve[j] = 1;
		}
	}

	for(int i=2;i<=N;++i) if(!sieve[i]) primes.insert(i);

	for(int i=0;i<n;++i){
		int u;
		cin >> u;
		for(auto it=primes.begin();it!=primes.end();++it) if(u%(*it) == 0)	group[*it].pb(u);
	}

	for(auto it=primes.begin();it!=primes.end();++it) ans = max(ans, (int)group[*it].size());

	/*for(auto it=primes.begin();it!=primes.end();++it) if(*it <= 100){
		cout << *it << ": ";
		for(int u : group[*it]) cout << u << ' ';
		cout << endl;
	}*/

	cout << ans << endl;
	return 0;
}


//
//
//
#include <bits/stdc++.h>

using namespace std;

#define topper top //XDDDDDDD

#define mp make_pair
#define pb push_back
#define db(x) cerr << #x << " == " <<  x << endl;
#define _ << " " <<

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;

const long double EPS = 1e-9;
const int N=1e5+5;
const int MOD=1e9+7;
const int INF=0x3f3f3f3f;

int sieve[N], quant[N];
vi pf[N];

int main(){
	ios_base::sync_with_stdio(false);

	for(int i=2;i<N;++i){
		if(!sieve[i]){
			pf[i].pb(i);
			for(int j=2*i;j<N;j+=i) sieve[j] = 1, pf[j].pb(i);
		}
	}

	int n;
	bool so1 = true;
	cin >> n;
	for(int i=0;i<n;++i){
		int x;
		cin >> x;
		if(x != 1) so1 = false;
		for(int y : pf[x]) quant[y]++;
	}

	int ans=0;
	for(int i=0;i<N;++i) ans = max(ans, quant[i]);

	cout << ((n == 1 or so1) ? 1 : ans)<< endl;

	return 0;
}


//
//
//
//
//
#include <bits/stdc++.h>

using namespace std;

#define topper top //WE ARE TOPPER

#define mp make_pair
#define pb push_back
#define db(x) cerr << #x << " == " <<  x << endl;
#define _ << " " <<

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<string> vs;
typedef pair<int,int> ii;
typedef stack<int> sti;

const ld EPS = 1e-9;
const int N=1e5+5;
const int MOD=1e9+7;
const int INF=0x3f3f3f3f;

int sieve[N], group[N], vis[N], inp[N];
vi divisors[N];
set<int> primes, numbers;

int main(){
	ios_base::sync_with_stdio(false);

	int n, ans=0;
	bool only_1 = true;
	cin >> n;

	for(int i=2;i*i<=N;++i){
		for(int j=2*i;j<=N;j+=i){
			sieve[j] = 1;
		}
	}

	for(int i=2;i<=N;++i) if(!sieve[i]) primes.insert(i);

	for(int i=0;i<n;++i){
		int u;
		cin >> u;
		if(u != 1) only_1 = false;
		vis[u]++;
		if(vis[u] == 1)for(auto it=primes.begin();it!=primes.end();++it) if(u%(*it)==0){
			divisors[u].pb(*it);
			while(u%(*it)==0) u/=(*it);
		}
		numbers.insert(u);
	}

	for(auto it=numbers.begin();it!=numbers.end();++it){
		for(int j=0;j<vis[*it];++j){
			for(int k : divisors[*it]) group[k]++;
		}
	}
	for(auto it=primes.begin(); it!=primes.end(); ++it) ans = max(ans, group[*it]);

	cout << ((only_1) ? 1 : ans) << endl;
	return 0;
}


//
//
//
//
//
#include <bits/stdc++.h>

using namespace std;

#define topper top //WE ARE TOPPER

#define mp make_pair
#define pb push_back
#define db(x) cerr << #x << " == " <<  x << endl;
#define _ << " " <<

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<string> vs;
typedef pair<int,int> ii;
typedef stack<int> sti;

const ld EPS = 1e-9;
const int N=1e5+5;
const int MOD=1e9+7;
const int INF=0x3f3f3f3f;

int sieve[N], group[N], vis[N], inp[N];
vi divisors[N];
set<int> primes;

int main(){
	ios_base::sync_with_stdio(false);

	int n, ans=0;
	cin >> n;

	for(int i=2;i*i<=N;++i){
		for(int j=2*i;j<=N;j+=i){
			sieve[j] = 1;
		}
	}

	for(int i=2;i<=N;++i) if(!sieve[i]) primes.insert(i);

	for(int i=0;i<n;++i){
		cin >> inp[i];
		if(!vis[inp[i]]) for(auto it=primes.begin();it!=primes.end();++it) if(inp[i]%(*it)==0) divisors[inp[i]].pb(*it);
		vis[inp[i]]++;
	}

	for(int i=0;i<n;++i){
		cout << inp[i] << ": ";
		for(int k : divisors[inp[i]]) cout << k << ' ';
		cout << endl;
	}

	for(int i=0;i<=n;++i){
		for(int j=0;j<vis[inp[i]];++j){
			for(int k : divisors[inp[i]]) group[k]++;
		}
	}

	for(auto it=primes.begin(); it!=primes.end(); ++it) ans = max(ans, group[*it]);

	cout << ans << endl;
	return 0;
}


//
//
//
//
//
#include <bits/stdc++.h>

using namespace std;

#define topper top //WE ARE TOPPER

#define mp make_pair
#define pb push_back
#define db(x) cerr << #x << " == " <<  x << endl;
#define _ << " " <<

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<string> vs;
typedef pair<int,int> ii;
typedef stack<int> sti;

const ld EPS = 1e-9;
const int N=1e5+5;
const int MOD=1e9+7;
const int INF=0x3f3f3f3f;

int sieve[N];
int inp[N];
map<int, vi> group;
set<int> primes;

int main(){
	ios_base::sync_with_stdio(false);

	int n, ans=0;
	cin >> n;

	for(int i=2;i*i<=N;++i){
		if(!sieve[i]) primes.insert(i);
		for(int j=i;j<=N;j+=i){
			sieve[i+j] = 1;
		}
	}

	for(int i=0;i<n;++i){
		int u;
		cin >> u;
		for(auto it=primes.begin();it!=primes.end();++it) if(u%(*it) == 0)	group[*it].pb(u);
	}

	for(auto it=primes.begin();it!=primes.end();++it) ans = max(ans, (int)group[*it].size());
	cout << ans << endl;

	return 0;
}


//
//
//
//
//
#include <bits/stdc++.h>

using namespace std;

#define topper top //WE ARE TOPPER

#define mp make_pair
#define pb push_back
#define db(x) cerr << #x << " == " <<  x << endl;
#define _ << " " <<

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<string> vs;
typedef pair<int,int> ii;
typedef stack<int> sti;

const ld EPS = 1e-9;
const int N=1e5+5;
const int MOD=1e9+7;
const int INF=0x3f3f3f3f;

int sieve[N], group[N], vis[N], inp[N];
vi divisors[N];
set<int> primes;

int main(){
	ios_base::sync_with_stdio(false);

	int n, ans=0;
	cin >> n;

	for(int i=2;i*i<=N;++i){
		for(int j=2*i;j<=N;j+=i){
			sieve[j] = 1;
		}
	}

	for(int i=2;i<=N;++i) if(!sieve[i]) primes.insert(i);

	for(int i=0;i<n;++i){
		cin >> inp[i];
		if(!vis[inp[i]]) for(auto it=primes.begin();it!=primes.end();++it) if(inp[i]%(*it)==0) divisors[inp[i]].pb(*it);
		vis[inp[i]]++;
	}

	for(int i=0;i<=n;++i){
		for(int j=0;j<vis[inp[i]];++j){
			for(int k : divisors[inp[i]]) group[k]++;
		}
	}

	for(auto it=primes.begin(); it!=primes.end(); ++it) ans = max(ans, group[*it]);

	cout << ans << endl;
	return 0;
}


//
//
//
//
//
#include <bits/stdc++.h>

using namespace std;

#define topper top //WE ARE TOPPER

#define mp make_pair
#define pb push_back
#define db(x) cerr << #x << " == " <<  x << endl;
#define _ << " " <<

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<string> vs;
typedef pair<int,int> ii;
typedef stack<int> sti;

const ld EPS = 1e-9;
const int N=1e5+5;
const int MOD=1e9+7;
const int INF=0x3f3f3f3f;

int sieve[N], group[N], vis[N], inp[N];
vi divisors[N];
set<int> primes, numbers;

int main(){
	ios_base::sync_with_stdio(false);

	int n, ans=0;
	bool only_1 = true;
	cin >> n;

	for(int i=2;i*i<=N;++i){
		if(!sieve[i])
		for(int j=2*i;j<=N;j+=i){
			sieve[j] = 1;
			divisors[j].pb(i);
		}
	}

	for(int i=2;i<=N;++i) if(!sieve[i]) divisors[i].pb(i), primes.insert(i);

	for(int i=0;i<n;++i){
		int u;
		cin >> u;
		if(u != 1) only_1 = false;
		vis[u]++;
		numbers.insert(u);
		/*cout << u << ": ";
		for(int k : divisors[u]) cout << k << ' ';
		cout << endl;
		if(vis[u] == 1)for(auto it=primes.begin();it!=primes.end();++it) if(u%(*it)==0){
			divisors[u].pb(*it);
			while(u%(*it)==0) u/=(*it);
		}*/
	}

	for(auto it=numbers.begin();it!=numbers.end();++it){
		for(int j=0;j<vis[*it];++j){
			for(int k : divisors[*it]) group[k]++;
		}
	}
	for(auto it=primes.begin(); it!=primes.end(); ++it) ans = max(ans, group[*it]);

	cout << ((only_1) ? 1 : ans) << endl;
	return 0;
}


//
//
//
//
//
#include <bits/stdc++.h>

using namespace std;

#define topper top //WE ARE TOPPER

#define mp make_pair
#define pb push_back
#define db(x) cerr << #x << " == " <<  x << endl;
#define _ << " " <<

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<string> vs;
typedef pair<int,int> ii;
typedef stack<int> sti;

const ld EPS = 1e-9;
const int N=1e5+5;
const int MOD=1e9+7;
const int INF=0x3f3f3f3f;

int sieve[N], group[N], vis[N], inp[N];
vi divisors[N];
set<int> primes, numbers;

int main(){
	ios_base::sync_with_stdio(false);

	int n, ans=0;
	bool only_1 = true;
	cin >> n;

	for(int i=2;i*i<=N;++i){
		if(!sieve[i]){
			divisors[i].pb(i);
			for(int j=2*i;j<=N;j+=i){
				sieve[j] = 1;
				divisors[j].pb(i);
			}
		}
	}

	for(int i=2;i<=N;++i) if(!sieve[i]) primes.insert(i);

	for(int i=0;i<n;++i){
		int u;
		cin >> u;
		if(u != 1) only_1 = false;
		vis[u]++;
		numbers.insert(u);
		/*cout << u << ": ";
		for(int k : divisors[u]) cout << k << ' ';
		cout << endl;
		if(vis[u] == 1)for(auto it=primes.begin();it!=primes.end();++it) if(u%(*it)==0){
			divisors[u].pb(*it);
			while(u%(*it)==0) u/=(*it);
		}*/
	}

	for(auto it=numbers.begin();it!=numbers.end();++it){
		for(int j=0;j<vis[*it];++j){
			for(int k : divisors[*it]) group[k]++;
		}
	}
	for(auto it=primes.begin(); it!=primes.end(); ++it) ans = max(ans, group[*it]);

	cout << ((only_1) ? 1 : ans) << endl;
	return 0;
}


//
//
//
//
//
#include <bits/stdc++.h>

using namespace std;

#define topper top //WE ARE TOPPER

#define mp make_pair
#define pb push_back
#define db(x) cerr << #x << " == " <<  x << endl;
#define _ << " " <<

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<string> vs;
typedef pair<int,int> ii;
typedef stack<int> sti;

const ld EPS = 1e-9;
const int N=1e5+5;
const int MOD=1e9+7;
const int INF=0x3f3f3f3f;

int sieve[N], group[N];
vi divisors[N];
set<int> primes;

int main(){
	ios_base::sync_with_stdio(false);

	int n, ans=0;
	bool only_1 = true;
	cin >> n;

	for(int i=2;i<=N;++i){
		if(!sieve[i])
		for(int j=2*i;j<=N;j+=i){
			sieve[j] = 1;
			divisors[j].pb(i);
		}
	}

	for(int i=2;i<=N;++i) if(!sieve[i]) divisors[i].pb(i), primes.insert(i);

	for(int i=0;i<n;++i){
		int u;
		cin >> u;
		if(u != 1) only_1 = false;
		for(int k : divisors[u])	group[k]++;
	}

	for(auto it=primes.begin(); it!=primes.end(); ++it) ans = max(ans, group[*it]);

	cout << ((only_1) ? 1 : ans) << endl;
	return 0;
}


//
//
//
//
//
#include <bits/stdc++.h>

using namespace std;

#define topper top //WE ARE TOPPER

#define mp make_pair
#define pb push_back
#define db(x) cerr << #x << " == " <<  x << endl;
#define _ << " " <<

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<string> vs;
typedef pair<int,int> ii;
typedef stack<int> sti;

const ld EPS = 1e-9;
const int N=1e5+5;
const int MOD=1e9+7;
const int INF=0x3f3f3f3f;

int sieve[N], group[N], vis[N], inp[N];
vi divisors[N];
set<int> primes, numbers;

int main(){
	ios_base::sync_with_stdio(false);

	int n, ans=0;
	bool only_1 = true;
	cin >> n;

	for(int i=2;i*i<=N;++i){
		for(int j=2*i;j<=N;j+=i){
			sieve[j] = 1;
		}
	}

	for(int i=2;i<=N;++i) if(!sieve[i]) primes.insert(i);

	for(int i=0;i<n;++i){
		int u;
		cin >> u;
		if(u != 1) only_1 = false;
		if(!vis[u]) for(auto it=primes.begin();it!=primes.end();++it) if(u%(*it)==0) divisors[u].pb(*it);
		vis[u]++;
		numbers.insert(u);
	}

	for(auto it=numbers.begin();it!=numbers.end();++it){
		for(int j=0;j<vis[*it];++j){
			for(int k : divisors[*it]) group[k]++;
		}
	}

	for(auto it=primes.begin(); it!=primes.end(); ++it) ans = max(ans, group[*it]);

	cout << ((only_1) ? 1 : ans) << endl;
	return 0;
}


//
//
//
#include <bits/stdc++.h>

using namespace std;

#define topper top //XDDDDDDD

#define mp make_pair
#define pb push_back
#define db(x) cerr << #x << " == " <<  x << endl;
#define _ << " " <<

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;

const long double EPS = 1e-9;
const int N=1e5+5;
const int MOD=1e9+7;
const int INF=0x3f3f3f3f;

int sieve[N], quant[N];
vi pf[N];

int main(){
	ios_base::sync_with_stdio(false);

	for(int i=2;i<N;++i){
		if(!sieve[i]){
			pf[i].pb(i);
			for(int j=2*i;j<N;j+=i) sieve[j] = 1, pf[j].pb(i);
		}
	}

	int n;
	cin >> n;
	for(int i=0;i<n;++i){
		int x;
		cin >> x;
		for(int y : pf[x]) quant[y]++;
	}

	int ans=0;
	for(int i=0;i<N;++i) ans = max(ans, quant[i]);

	cout << ans << endl;

	return 0;
}


//
//
//
//
//
#include <bits/stdc++.h>

using namespace std;

#define topper top //WE ARE TOPPER

#define mp make_pair
#define pb push_back
#define db(x) cerr << #x << " == " <<  x << endl;
#define _ << " " <<

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<string> vs;
typedef pair<int,int> ii;
typedef stack<int> sti;

const ld EPS = 1e-9;
const int N=1e5+5;
const int MOD=1e9+7;
const int INF=0x3f3f3f3f;

int sieve[N];
int inp[N];
map<int, vi> group;
set<int> primes;

int main(){
	ios_base::sync_with_stdio(false);

	int n, ans=0;
	cin >> n;

	for(int i=2;i*i<=N;++i){
		if(!sieve[i]) primes.insert(i);
		for(int j=i;j<=N;j+=i){
			sieve[i+j] = 1;
		}
	}

	for(int i=0;i<n;++i){
		int u;
		cin >> u;
		for(auto it=primes.begin();it!=primes.end();++it) if(u%(*it) == 0)	group[*it].pb(u);
	}

	for(auto it=primes.begin();it!=primes.end();++it) ans = max(ans, (int)group[*it].size());
	cout << ans << endl;
	return 0;
}


//
//
//
//
//
#include <bits/stdc++.h>

using namespace std;

#define topper top //WE ARE TOPPER

#define mp make_pair
#define pb push_back
#define db(x) cerr << #x << " == " <<  x << endl;
#define _ << " " <<

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<string> vs;
typedef pair<int,int> ii;
typedef stack<int> sti;

const ld EPS = 1e-9;
const int N=1e5+5;
const int MOD=1e9+7;
const int INF=0x3f3f3f3f;

int sieve[N], group[N], vis[N], inp[N];
vi divisors[N];
set<int> primes, numbers;

int main(){
	ios_base::sync_with_stdio(false);

	int n, ans=0;
	bool only_1 = true;
	cin >> n;

	for(int i=2;i*i<=N;++i){
		for(int j=2*i;j<=N;j+=i){
			sieve[j] = 1;
		}
	}

	for(int i=2;i<=N;++i) if(!sieve[i]) primes.insert(i);

	for(int i=0;i<n;++i){
		int u;
		cin >> u;
		if(u != 1) only_1 = false;
		vis[u]++;
		numbers.insert(u);
		if(vis[u] == 1)for(auto it=primes.begin();it!=primes.end();++it) if(u%(*it)==0){
			divisors[u].pb(*it);
			while(u%(*it)==0) u/=(*it);
		}
	}

	for(auto it=numbers.begin();it!=numbers.end();++it){
		for(int j=0;j<vis[*it];++j){
			for(int k : divisors[*it]) group[k]++;
		}
	}
	for(auto it=primes.begin(); it!=primes.end(); ++it) ans = max(ans, group[*it]);

	cout << ((only_1) ? 1 : ans) << endl;
	return 0;
}


//
//
//
//
//
#include <bits/stdc++.h>

using namespace std;

#define topper top //WE ARE TOPPER

#define mp make_pair
#define pb push_back
#define db(x) cerr << #x << " == " <<  x << endl;
#define _ << " " <<

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<string> vs;
typedef pair<int,int> ii;
typedef stack<int> sti;

const ld EPS = 1e-9;
const int N=1e5+5;
const int MOD=1e9+7;
const int INF=0x3f3f3f3f;

int sieve[N], group[N];
vi divisors[N];
set<int> primes;

int main(){
	ios_base::sync_with_stdio(false);

	int n, ans=0;
	bool only_1 = true;
	cin >> n;

	for(int i=2;i*i<=N;++i){
		if(!sieve[i])
		for(int j=2*i;j<=N;j+=i){
			sieve[j] = 1;
			divisors[j].pb(i);
			if(i*i != j) divisors[j].pb(j/i);
		}
	}

	for(int i=2;i<=N;++i) if(!sieve[i]) divisors[i].pb(i), primes.insert(i);

	for(int i=0;i<n;++i){
		int u;
		cin >> u;
		if(u != 1) only_1 = false;
		for(int k : divisors[u]) group[k]++;
	}

	for(auto it=primes.begin(); it!=primes.end(); ++it) ans = max(ans, group[*it]);

	cout << ((only_1) ? 1 : ans) << endl;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define scanfd1(x) scanf("%d", &x)
#define scanfd2(x,y) scanf("%d %d", &x, &y)
#define scanfd3(x,y,z) scanf("%d %d %d", &x, &y, &z)
#define scanfd4(x,y,z,w) scanf("%d %d %d %d", &x, &y, &z, &w)

#define scanfll1(x) scanf("%lld", &x)
#define scanfll2(x,y) scanf("%lld %lld", &x, &y)
#define scanfll3(x,y,z) scanf("%lld %lld %lld", &x, &y, &z)
#define scanfll4(x,y,z,w) scanf("%lld %lld %lld %lld", &x, &y, &z, &w)

#define fr(i,n) for(int i=0;i<(n);i++)
#define frr(i,a,b) for(int i=(a);i<=(b);i++)
#define frrs(i,a,b) for(int i=(a);i>=(b);i--)
#define VAR(a,b) __typeof(b) a=b
#define frit(it,c) for(VAR(it,(c).begin());it!=(c).end();it++)

#define ll long long int

#define pb push_back

#define all(a) a.begin(),a.end()

#define fi first
#define se second
typedef pair<int,int> pii;

#define PI acos(-1)
#define MOD 1000000007

bool testando = 0;
#define coutt if(testando) cout

const int ROOT = sqrt(1e5) + 10;

int main(){
	int n;
	cin >> n;

	vector<int> v(n);

	fr(i,n) scanfd1(v[i]);

	vector<int> div(1e5+10,0);
	div[0] = 1;

	fr(i,n){
		frr(j,2,ROOT-1){
			if(j<=v[i] and v[i]%j==0) div[j]++;
		}
		if(v[i]>=ROOT) div[v[i]]++;
	}

	cout << *max_element(all(div)) << endl;

	return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define scanfd1(x) scanf("%d", &x)
#define scanfd2(x,y) scanf("%d %d", &x, &y)
#define scanfd3(x,y,z) scanf("%d %d %d", &x, &y, &z)
#define scanfd4(x,y,z,w) scanf("%d %d %d %d", &x, &y, &z, &w)

#define scanfll1(x) scanf("%lld", &x)
#define scanfll2(x,y) scanf("%lld %lld", &x, &y)
#define scanfll3(x,y,z) scanf("%lld %lld %lld", &x, &y, &z)
#define scanfll4(x,y,z,w) scanf("%lld %lld %lld %lld", &x, &y, &z, &w)

#define fr(i,n) for(int i=0;i<(n);i++)
#define frr(i,a,b) for(int i=(a);i<=(b);i++)
#define frrs(i,a,b) for(int i=(a);i>=(b);i--)
#define VAR(a,b) __typeof(b) a=b
#define frit(it,c) for(VAR(it,(c).begin());it!=(c).end();it++)

#define ll long long int

#define pb push_back

#define all(a) a.begin(),a.end()

#define fi first
#define se second
typedef pair<int,int> pii;

#define PI acos(-1)
#define MOD 1000000007

bool testando = 0;
#define coutt if(testando) cout

const int ROOT = sqrt(1e5) + 10;

int main(){
	int n;
	cin >> n;

	vector<int> v(n);

	fr(i,n) scanfd1(v[i]);

	vector<int> div(ROOT,0);

	fr(i,n){
		frr(j,2,ROOT){
			if(v[i]%j==0) div[j]++;
		}
	}

	cout << *max_element(all(div)) << endl;

	return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define scanfd1(x) scanf("%d", &x)
#define scanfd2(x,y) scanf("%d %d", &x, &y)
#define scanfd3(x,y,z) scanf("%d %d %d", &x, &y, &z)
#define scanfd4(x,y,z,w) scanf("%d %d %d %d", &x, &y, &z, &w)

#define scanfll1(x) scanf("%lld", &x)
#define scanfll2(x,y) scanf("%lld %lld", &x, &y)
#define scanfll3(x,y,z) scanf("%lld %lld %lld", &x, &y, &z)
#define scanfll4(x,y,z,w) scanf("%lld %lld %lld %lld", &x, &y, &z, &w)

#define fr(i,n) for(int i=0;i<(n);i++)
#define frr(i,a,b) for(int i=(a);i<=(b);i++)
#define frrs(i,a,b) for(int i=(a);i>=(b);i--)
#define VAR(a,b) __typeof(b) a=b
#define frit(it,c) for(VAR(it,(c).begin());it!=(c).end();it++)

#define ll long long int

#define pb push_back

#define all(a) a.begin(),a.end()

#define fi first
#define se second
typedef pair<int,int> pii;

#define PI acos(-1)
#define MOD 1000000007

bool testando = 0;
#define coutt if(testando) cout

const int ROOT = sqrt(1e5) + 10;

int main(){
	int n;
	cin >> n;

	vector<int> v(n);

	fr(i,n) scanfd1(v[i]);

	vector<int> div(1e5+10,0);
	//cout << "ROOT = " << ROOT << endl;
	div[0] = 1;

	fr(i,n){
		frr(j,2,ROOT-1){
			if(v[i]%j==0) div[j]++;
			while(v[i]%j==0) v[i]/=j;
		}
		if(v[i]>1) div[v[i]]++;
	}

	cout << *max_element(all(div)) << endl;

	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int N;
unordered_map<int, int> factors;
const int ROOT = sqrt(1e5)+10;
int main()
{
	ios_base::sync_with_stdio(false);
	cin >> N;

	while(N--)
	{
		int strength;
		cin >> strength;

		int root = sqrt(strength);
		//for(int i = 2; i <= root; i++)
		for(int i = 2; i <= ROOT; i++)
		{
			if(strength%i == 0)
				factors[i]++;

			while(strength%i ==
					0) strength
				/= i;
		}

		if(strength > 1) factors[strength]++;
	}

	int ans = 1;
	for(auto it = factors.begin(); it != factors.end(); it++)
	{
		ans = max(ans, (*it).second);
	}

	cout << ans << endl;

	return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define scanfd1(x) scanf("%d", &x)
#define scanfd2(x,y) scanf("%d %d", &x, &y)
#define scanfd3(x,y,z) scanf("%d %d %d", &x, &y, &z)
#define scanfd4(x,y,z,w) scanf("%d %d %d %d", &x, &y, &z, &w)

#define scanfll1(x) scanf("%lld", &x)
#define scanfll2(x,y) scanf("%lld %lld", &x, &y)
#define scanfll3(x,y,z) scanf("%lld %lld %lld", &x, &y, &z)
#define scanfll4(x,y,z,w) scanf("%lld %lld %lld %lld", &x, &y, &z, &w)

#define fr(i,n) for(int i=0;i<(n);i++)
#define frr(i,a,b) for(int i=(a);i<=(b);i++)
#define frrs(i,a,b) for(int i=(a);i>=(b);i--)
#define VAR(a,b) __typeof(b) a=b
#define frit(it,c) for(VAR(it,(c).begin());it!=(c).end();it++)

#define ll long long int

#define pb push_back

#define all(a) a.begin(),a.end()

#define fi first
#define se second
typedef pair<int,int> pii;

#define PI acos(-1)
#define MOD 1000000007

bool testando = 0;
#define coutt if(testando) cout

const int ROOT = sqrt(1e5) + 10;

int main(){
	int n;
	cin >> n;

	vector<int> v(n);

	fr(i,n) scanfd1(v[i]);

	vector<int> div(1e5+10,0);
	div[0] = 1;

	fr(i,n){
		frr(j,2,ROOT-1){
			if(v[i]%j==0) div[j]++;
		}
		if(v[i]>=ROOT) div[v[i]]++;
	}

	cout << *max_element(all(div)) << endl;

	return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define scanfd1(x) scanf("%d", &x)
#define scanfd2(x,y) scanf("%d %d", &x, &y)
#define scanfd3(x,y,z) scanf("%d %d %d", &x, &y, &z)
#define scanfd4(x,y,z,w) scanf("%d %d %d %d", &x, &y, &z, &w)

#define scanfll1(x) scanf("%lld", &x)
#define scanfll2(x,y) scanf("%lld %lld", &x, &y)
#define scanfll3(x,y,z) scanf("%lld %lld %lld", &x, &y, &z)
#define scanfll4(x,y,z,w) scanf("%lld %lld %lld %lld", &x, &y, &z, &w)

#define fr(i,n) for(int i=0;i<(n);i++)
#define frr(i,a,b) for(int i=(a);i<=(b);i++)
#define frrs(i,a,b) for(int i=(a);i>=(b);i--)
#define VAR(a,b) __typeof(b) a=b
#define frit(it,c) for(VAR(it,(c).begin());it!=(c).end();it++)

#define ll long long int

#define pb push_back

#define all(a) a.begin(),a.end()

#define fi first
#define se second
typedef pair<int,int> pii;

#define PI acos(-1)
#define MOD 1000000007

bool testando = 0;
#define coutt if(testando) cout

const int ROOT = sqrt(1e5) + 10;

int main(){
	int n;
	cin >> n;

	vector<int> v(n);

	fr(i,n) scanfd1(v[i]);

	vector<int> div(ROOT,0);

	fr(i,n){
		frr(j,1,ROOT-1){
			if(v[i]%j==0) div[j]++;
		}
	}

	cout << *max_element(all(div)) << endl;

	return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define scanfd1(x) scanf("%d", &x)
#define scanfd2(x,y) scanf("%d %d", &x, &y)
#define scanfd3(x,y,z) scanf("%d %d %d", &x, &y, &z)
#define scanfd4(x,y,z,w) scanf("%d %d %d %d", &x, &y, &z, &w)

#define scanfll1(x) scanf("%lld", &x)
#define scanfll2(x,y) scanf("%lld %lld", &x, &y)
#define scanfll3(x,y,z) scanf("%lld %lld %lld", &x, &y, &z)
#define scanfll4(x,y,z,w) scanf("%lld %lld %lld %lld", &x, &y, &z, &w)

#define fr(i,n) for(int i=0;i<(n);i++)
#define frr(i,a,b) for(int i=(a);i<=(b);i++)
#define frrs(i,a,b) for(int i=(a);i>=(b);i--)
#define VAR(a,b) __typeof(b) a=b
#define frit(it,c) for(VAR(it,(c).begin());it!=(c).end();it++)

#define ll long long int

#define pb push_back

#define all(a) a.begin(),a.end()

#define fi first
#define se second
typedef pair<int,int> pii;

#define PI acos(-1)
#define MOD 1000000007

bool testando = 0;
#define coutt if(testando) cout

const int ROOT = sqrt(1e5) + 10;

int main(){
	int n;
	cin >> n;

	vector<int> v(n);

	fr(i,n) scanfd1(v[i]);

	vector<int> div(ROOT,0);
	div[0] = 1;

	fr(i,n){
		frr(j,2,ROOT-1){
			if(v[i]%j==0) div[j]++;
		}
	}

	cout << *max_element(all(div)) << endl;

	return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define scanfd1(x) scanf("%d", &x)
#define scanfd2(x,y) scanf("%d %d", &x, &y)
#define scanfd3(x,y,z) scanf("%d %d %d", &x, &y, &z)
#define scanfd4(x,y,z,w) scanf("%d %d %d %d", &x, &y, &z, &w)

#define scanfll1(x) scanf("%lld", &x)
#define scanfll2(x,y) scanf("%lld %lld", &x, &y)
#define scanfll3(x,y,z) scanf("%lld %lld %lld", &x, &y, &z)
#define scanfll4(x,y,z,w) scanf("%lld %lld %lld %lld", &x, &y, &z, &w)

#define fr(i,n) for(int i=0;i<(n);i++)
#define frr(i,a,b) for(int i=(a);i<=(b);i++)
#define frrs(i,a,b) for(int i=(a);i>=(b);i--)
#define VAR(a,b) __typeof(b) a=b
#define frit(it,c) for(VAR(it,(c).begin());it!=(c).end();it++)

#define ll long long int

#define pb push_back

#define all(a) a.begin(),a.end()

#define fi first
#define se second
typedef pair<int,int> pii;

#define PI acos(-1)
#define MOD 1000000007

bool testando = 0;
#define coutt if(testando) cout

const int ROOT = sqrt(1e5) + 10;

int main(){
	int n;
	cin >> n;

	vector<int> v(n);

	fr(i,n) scanfd1(v[i]);

	vector<int> div(ROOT,0);

	fr(i,n){
		frr(j,2,ROOT-1){
			if(v[i]%j==0) div[j]++;
		}
	}

	cout << *max_element(all(div)) << endl;

	return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define scanfd1(x) scanf("%d", &x)
#define scanfd2(x,y) scanf("%d %d", &x, &y)
#define scanfd3(x,y,z) scanf("%d %d %d", &x, &y, &z)
#define scanfd4(x,y,z,w) scanf("%d %d %d %d", &x, &y, &z, &w)

#define scanfll1(x) scanf("%lld", &x)
#define scanfll2(x,y) scanf("%lld %lld", &x, &y)
#define scanfll3(x,y,z) scanf("%lld %lld %lld", &x, &y, &z)
#define scanfll4(x,y,z,w) scanf("%lld %lld %lld %lld", &x, &y, &z, &w)

#define fr(i,n) for(int i=0;i<(n);i++)
#define frr(i,a,b) for(int i=(a);i<=(b);i++)
#define frrs(i,a,b) for(int i=(a);i>=(b);i--)
#define VAR(a,b) __typeof(b) a=b
#define frit(it,c) for(VAR(it,(c).begin());it!=(c).end();it++)

#define ll long long int

#define pb push_back

#define all(a) a.begin(),a.end()

#define fi first
#define se second
typedef pair<int,int> pii;

#define PI acos(-1)
#define MOD 1000000007

bool testando = 0;
#define coutt if(testando) cout

const int ROOT = sqrt(1e5) + 10;

int main(){
	int n;
	cin >> n;

	vector<int> v(n);

	fr(i,n) scanfd1(v[i]);

	vector<int> div(1e5+10,0);
	//cout << "ROOT = " << ROOT << endl;
	div[0] = 1;

	fr(i,n){
		frr(j,2,ROOT-1){
			if(j<=v[i] and v[i]%j==0) div[j]++;
		}
		if(v[i]>=ROOT) div[v[i]]++;
	}

	cout << *max_element(all(div)) << endl;

	return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define scanfd1(x) scanf("%d", &x)
#define scanfd2(x,y) scanf("%d %d", &x, &y)
#define scanfd3(x,y,z) scanf("%d %d %d", &x, &y, &z)
#define scanfd4(x,y,z,w) scanf("%d %d %d %d", &x, &y, &z, &w)

#define scanfll1(x) scanf("%lld", &x)
#define scanfll2(x,y) scanf("%lld %lld", &x, &y)
#define scanfll3(x,y,z) scanf("%lld %lld %lld", &x, &y, &z)
#define scanfll4(x,y,z,w) scanf("%lld %lld %lld %lld", &x, &y, &z, &w)

#define fr(i,n) for(int i=0;i<(n);i++)
#define frr(i,a,b) for(int i=(a);i<=(b);i++)
#define frrs(i,a,b) for(int i=(a);i>=(b);i--)
#define VAR(a,b) __typeof(b) a=b
#define frit(it,c) for(VAR(it,(c).begin());it!=(c).end();it++)

#define ll long long int

#define pb push_back

#define all(a) a.begin(),a.end()

#define fi first
#define se second
typedef pair<int,int> pii;

#define PI acos(-1)
#define MOD 1000000007

bool testando = 0;
#define coutt if(testando) cout

const int ROOT = sqrt(1e5) + 10;

int main(){
	int n;
	cin >> n;

	vector<int> v(n);

	fr(i,n) scanfd1(v[i]);

	vector<int> div(1e5+10,0);
	div[0] = 1;

	fr(i,n){
		frr(j,2,ROOT-1){
			if(v[i]%j==0) div[j]++;
		}
		div[v[i]]++;
	}

	cout << *max_element(all(div)) << endl;

	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#include<unordered_map>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define vi vector<int>
#define vii vector<pii >
#define pii pair<int,int>
#define pi 3.14159265358979
//#define foreach(i,t) for(typeof(t.begin()) i =t.begin();i!=t.end();i++)  //Own terminal
#define foreach(i,t) for(auto i =t.begin();i!=t.end();i++) //Codeforces
#define pii pair<int,int>
#define pdn(n) printf("%d\n",n)
#define sl(n) scanf("%lld",&n)
#define sd(n) scanf("%d",&n)
#define pn printf("\n")
#define  omap unordered_map
#define PI 3.14159265
#define Inf 1e9
#define mod 1000000007
#define precise(n,k) fixed<<setprecision(k)<<n
#define fequal(a,b) (fabs(a - b)<(1e-9))
//fflush(stdout);
//cout<<flush;

vi primes;
int sieve[100005];
void create()
{
 	for(int i=2;i<=100000;i++)
 	{
 		if(sieve[i]!=0) continue;
 		for(int j=2*i;j<=100000;j+=i)
 		{
 			sieve[j]=1;
 		}
 	}
 	for(int i=2;i<=100000;i++)
 	{
 		if(sieve[i]==0)
 			primes.pb(i);
 	}
 }

int arr[100010];
typedef long long ll;
typedef long double lf;

int main()
{

	create();
	int n;
	cin>>n;

	for(int i=1;i<=n;i++)
	{
		cin>>arr[i];
	}

	if(n==1)
	{
		cout<<1<<endl;
		return 0;
	}

	int max_val=1;
	sort(arr+1,arr+n+1);
	foreach(it,primes)
	{

		int pr=*it;
		if(pr>arr[n])
			break;
		int coun=0;
		for(int i=1;i<=n;i++)
		{
			if(arr[i]%pr==0)
				coun++;
		}
		//cout<<coun<<" for "<<pr<<endl;
		max_val=max(coun,max_val);

	}
	cout<<max_val<<endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#include<unordered_map>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define vi vector<int>
#define vii vector<pii >
#define pii pair<int,int>
#define pi 3.14159265358979
//#define foreach(i,t) for(typeof(t.begin()) i =t.begin();i!=t.end();i++)  //Own terminal
#define foreach(i,t) for(auto i =t.begin();i!=t.end();i++) //Codeforces
#define pii pair<int,int>
#define pdn(n) printf("%d\n",n)
#define sl(n) scanf("%lld",&n)
#define sd(n) scanf("%d",&n)
#define pn printf("\n")
#define  omap unordered_map
#define PI 3.14159265
#define Inf 1e9
#define mod 1000000007
#define precise(n,k) fixed<<setprecision(k)<<n
#define fequal(a,b) (fabs(a - b)<(1e-9))
//fflush(stdout);
//cout<<flush;

vi primes;
int sieve[100005];
void create()
{
 	for(int i=2;i<=100000;i++)
 	{
 		if(sieve[i]!=0) continue;
 		for(int j=2*i;j<=100000;j+=i)
 		{
 			sieve[j]=1;
 		}
 	}
 	for(int i=2;i<=100000;i++)
 	{
 		if(sieve[i]==0)
 			primes.pb(i);
 	}
 }

int arr[100010];
typedef long long ll;
typedef long double lf;

int main()
{

	create();
	int n;
	cin>>n;

	for(int i=1;i<=n;i++)
	{
		cin>>arr[i];
	}

	if(n==1)
	{
		cout<<1<<endl;
		return 0;
	}

	int max_val=1;
	foreach(it,primes)
	{

		int pr=*it;
		int coun=0;
		for(int i=1;i<=n;i++)
		{
			if(arr[i]%pr==0)
				coun++;
		}
		//cout<<coun<<" for "<<pr<<endl;
		max_val=max(coun,max_val);

	}
	cout<<max_val<<endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#include<unordered_map>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define vi vector<int>
#define vii vector<pii >
#define pii pair<int,int>
#define pi 3.14159265358979
//#define foreach(i,t) for(typeof(t.begin()) i =t.begin();i!=t.end();i++)  //Own terminal
#define foreach(i,t) for(auto i =t.begin();i!=t.end();i++) //Codeforces
#define pii pair<int,int>
#define pdn(n) printf("%d\n",n)
#define sl(n) scanf("%lld",&n)
#define sd(n) scanf("%d",&n)
#define pn printf("\n")
#define  omap unordered_map
#define PI 3.14159265
#define Inf 1e9
#define mod 1000000007
#define precise(n,k) fixed<<setprecision(k)<<n
#define fequal(a,b) (fabs(a - b)<(1e-9))
//fflush(stdout);
//cout<<flush;
vi primes;
int sieve[1001];

void create()
{
 	for(int i=2;i<=1001;i++)
 	{
 		for(int j=2*i;j<=1001;j+=i)
 		{
 			sieve[j]=1;
 		}
 	}
 	for(int i=2;i<=1001;i++)
 	{
 		if(sieve[i]==0)
 			primes.pb(i);
 	}
 }

int arr[100010];
typedef long long ll;
typedef long double lf;

int main()
{

	create();
	int n;
	cin>>n;

	for(int i=1;i<=n;i++)
	{
		cin>>arr[i];
	}

	if(n==1)
	{
		cout<<1<<endl;
		return 0;
	}

	int max_val=0;
	sort(arr,arr+n);
	foreach(it,primes)
	{

		int pr=*it;
		if(arr[n]<pr)
		 	break;
		int coun=0;
		for(int i=1;i<=n;i++)
		{

			if(arr[i]%pr==0)
				coun++;
		}
		//cout<<coun<<" for "<<pr<<endl;
		max_val=max(coun,max_val);

	}
	cout<<max_val<<endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
map<int,int> vals;
bool sieve[100100];
typedef long long ll;
int main()
{
	int n;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		int no;
		cin>>no;
		vals[no]++;
	}
	ll ans=1;

	for(int i=2;i<=100001;i++)
	{

		if(sieve[i]) continue;
		ll curr=0;
		for(int j=i;j<=100001;j+=i)
		{
			sieve[j]=1;
			curr+=vals[j];
		}
		ans=max(curr,ans);
	}
	cout<<ans<<endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#include<unordered_map>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define vi vector<int>
#define vii vector<pii >
#define pii pair<int,int>
#define pi 3.14159265358979
//#define foreach(i,t) for(typeof(t.begin()) i =t.begin();i!=t.end();i++)  //Own terminal
#define foreach(i,t) for(auto i =t.begin();i!=t.end();i++) //Codeforces
#define pii pair<int,int>
#define pdn(n) printf("%d\n",n)
#define sl(n) scanf("%lld",&n)
#define sd(n) scanf("%d",&n)
#define pn printf("\n")
#define  omap unordered_map
#define PI 3.14159265
#define Inf 1e9
#define mod 1000000007
#define precise(n,k) fixed<<setprecision(k)<<n
#define fequal(a,b) (fabs(a - b)<(1e-9))
//fflush(stdout);
//cout<<flush;

vi primes;
int sieve[1005];
void create()
{
 	for(int i=2;i<=1001;i++)
 	{
 		for(int j=2*i;j<=1001;j+=i)
 		{
 			sieve[j]=1;
 		}
 	}
 	for(int i=2;i<=1001;i++)
 	{
 		if(sieve[i]==0)
 			primes.pb(i);
 	}
 }

int arr[100010];
typedef long long ll;
typedef long double lf;

int main()
{

	create();
	int n;
	cin>>n;

	for(int i=1;i<=n;i++)
	{
		cin>>arr[i];
	}

	if(n==1)
	{
		cout<<1<<endl;
		return 0;
	}

	int max_val=1;
	foreach(it,primes)
	{

		int pr=*it;
		int coun=0;
		for(int i=1;i<=n;i++)
		{
			if(arr[i]%pr==0)
				coun++;
		}
		//cout<<coun<<" for "<<pr<<endl;
		max_val=max(coun,max_val);

	}
	cout<<max_val<<endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#include<unordered_map>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define vi vector<int>
#define vii vector<pii >
#define pii pair<int,int>
#define pi 3.14159265358979
//#define foreach(i,t) for(typeof(t.begin()) i =t.begin();i!=t.end();i++)  //Own terminal
#define foreach(i,t) for(auto i =t.begin();i!=t.end();i++) //Codeforces
#define pii pair<int,int>
#define pdn(n) printf("%d\n",n)
#define sl(n) scanf("%lld",&n)
#define sd(n) scanf("%d",&n)
#define pn printf("\n")
#define  omap unordered_map
#define PI 3.14159265
#define Inf 1e9
#define mod 1000000007
#define precise(n,k) fixed<<setprecision(k)<<n
#define fequal(a,b) (fabs(a - b)<(1e-9))
//fflush(stdout);
//cout<<flush;

vi primes;
int sieve[100005];
void create()
{
 	for(int i=2;i<=100000;i++)
 	{
 		for(int j=2*i;j<=100000;j+=i)
 		{
 			sieve[j]=1;
 		}
 	}
 	for(int i=2;i<=100000;i++)
 	{
 		if(sieve[i]==0)
 			primes.pb(i);
 	}
 }

int arr[100010];
typedef long long ll;
typedef long double lf;

int main()
{

	create();
	int n;
	cin>>n;

	for(int i=1;i<=n;i++)
	{
		cin>>arr[i];
	}

	if(n==1)
	{
		cout<<1<<endl;
		return 0;
	}

	int max_val=1;
	foreach(it,primes)
	{

		int pr=*it;
		int coun=0;
		for(int i=1;i<=n;i++)
		{
			if(arr[i]%pr==0)
				coun++;
		}
		//cout<<coun<<" for "<<pr<<endl;
		max_val=max(coun,max_val);

	}
	cout<<max_val<<endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#include<unordered_map>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define vi vector<int>
#define vii vector<pii >
#define pii pair<int,int>
#define pi 3.14159265358979
//#define foreach(i,t) for(typeof(t.begin()) i =t.begin();i!=t.end();i++)  //Own terminal
#define foreach(i,t) for(auto i =t.begin();i!=t.end();i++) //Codeforces
#define pii pair<int,int>
#define pdn(n) printf("%d\n",n)
#define sl(n) scanf("%lld",&n)
#define sd(n) scanf("%d",&n)
#define pn printf("\n")
#define  omap unordered_map
#define PI 3.14159265
#define Inf 1e9
#define mod 1000000007
#define precise(n,k) fixed<<setprecision(k)<<n
#define fequal(a,b) (fabs(a - b)<(1e-9))

int max_val=1;
int sieve[100005];map<int,int> lis;
void create()
{
 	for(int i=2;i<=100000;i++)
 	{
 		if(sieve[i]!=0) continue;
 		int coun=0;
 		//cout<<"for "<<i<<endl;
 		for(int j=i;j<=100000;j+=i)
 		{
 			// cout<<j<<"-->";
 			// char ch=cin.get();
 			if(j!=1)
 				sieve[j]=1;
 			coun+=lis[j];
 		}
 		max_val=max(coun,max_val);
 	}
 }

typedef long long ll;
typedef long double lf;

int main()
{

	int n;
	cin>>n;

	for(int i=1;i<=n;i++)
	{
		int a;cin>>a;
		lis[a]++;

	}

	create();
	cout<<max_val<<endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#include<unordered_map>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define vi vector<int>
#define vii vector<pii >
#define pii pair<int,int>
#define pi 3.14159265358979
#define foreach(i,t) for(typeof(t.begin()) i =t.begin();i!=t.end();i++)  //Own terminal
//#define foreach(i,t) for(auto i =t.begin();i!=t.end();i++) //Codeforces
#define pii pair<int,int>
#define pdn(n) printf("%d\n",n)
#define sl(n) scanf("%lld",&n)
#define sd(n) scanf("%d",&n)
#define pn printf("\n")
#define  omap unordered_map
#define PI 3.14159265
#define Inf 1e9
#define mod 1000000007
#define precise(n,k) fixed<<setprecision(k)<<n
#define fequal(a,b) (fabs(a - b)<(1e-9))
//fflush(stdout);
//cout<<flush;
vi primes;
int sieve[1001];

void create()
{
 	for(int i=2;i<=1001;i++)
 	{
 		for(int j=2*i;j<=1001;j+=i)
 		{
 			sieve[j]=1;
 		}
 	}
 	for(int i=2;i<=1001;i++)
 	{
 		if(sieve[i]==0)
 			primes.pb(i);
 	}
 }

int arr[100010];
typedef long long ll;
typedef long double lf;

int main()
{

	create();
	int n;
	cin>>n;

	for(int i=1;i<=n;i++)
	{
		cin>>arr[i];
	}

	if(n==1)
	{
		cout<<1<<endl;
		return 0;
	}

	int max_val=0;
	sort(arr,arr+n);
	foreach(it,primes)
	{

		int pr=*it;
		if(arr[n]<pr)
		 	break;
		int coun=0;
		for(int i=1;i<=n;i++)
		{

			if(arr[i]%pr==0)
				coun++;
		}
		//cout<<coun<<" for "<<pr<<endl;
		max_val=max(coun,max_val);

	}
	cout<<max_val<<endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#include<unordered_map>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define vi vector<int>
#define vii vector<pii >
#define pii pair<int,int>
#define pi 3.14159265358979
//#define foreach(i,t) for(typeof(t.begin()) i =t.begin();i!=t.end();i++)  //Own terminal
#define foreach(i,t) for(auto i =t.begin();i!=t.end();i++) //Codeforces
#define pii pair<int,int>
#define pdn(n) printf("%d\n",n)
#define sl(n) scanf("%lld",&n)
#define sd(n) scanf("%d",&n)
#define pn printf("\n")
#define  omap unordered_map
#define PI 3.14159265
#define Inf 1e9
#define mod 1000000007
#define precise(n,k) fixed<<setprecision(k)<<n
#define fequal(a,b) (fabs(a - b)<(1e-9))
//fflush(stdout);
//cout<<flush;

vi primes;
int sieve[1005];
void create()
{
 	for(int i=2;i<=1001;i++)
 	{
 		for(int j=2*i;j<=1001;j+=i)
 		{
 			sieve[j]=1;
 		}
 	}
 	for(int i=2;i<=1001;i++)
 	{
 		if(sieve[i]==0)
 			primes.pb(i);
 	}
 }

int arr[100010];
typedef long long ll;
typedef long double lf;

int main()
{

	create();
	int n;
	cin>>n;

	for(int i=1;i<=n;i++)
	{
		cin>>arr[i];
	}

	if(n==1)
	{
		cout<<1<<endl;
		return 0;
	}

	int max_val=0;
	foreach(it,primes)
	{

		int pr=*it;
		int coun=0;
		for(int i=1;i<=n;i++)
		{
			if(arr[i]%pr==0)
				coun++;
		}
		//cout<<coun<<" for "<<pr<<endl;
		max_val=max(coun,max_val);

	}
	cout<<max_val<<endl;
	return 0;
}


import java.io.*;
import java.util.*;
public class Main
{

    final int p=(int)(1e5+1);
    final int mod=(int)(1e9+7);
    final int maxn=(int)(1e5);
    long fact[];

    Main()
    {
        fact=new long[maxn+1];
        fact[0]=1;
        for(int i=1;i<=maxn;i++)
            fact[i]=(fact[i-1]*i)%mod;
    }

    private void solve()throws IOException
    {
        int n=nextInt();
        int m=nextInt();
        ArrayList<Integer> list=new ArrayList<>();
        long hash[]=new long[m+1];
        long pow=1;
        for(int i=0;i<n;i++)
        {
            int g=nextInt();
            list.clear();
            for(int j=1;j<=g;j++)
            {
                list.add(nextInt());
            }
            Collections.sort(list);
            int count=1;
            for(int j=0;j<list.size();j++)
            {
                if(j==list.size()-1 || list.get(j)!=list.get(j+1))
                {
                    hash[list.get(j)]=(hash[list.get(j)]+(count*pow)%mod)%mod;
                    count=1;
                }
                else
                    count++;

            }
            pow=(pow*p)%mod;
        }
        Arrays.sort(hash,1,m+1);
        long ans=1;
        int count=1;
        for(int i=1;i<=m;i++)
        {
            if(i==m || hash[i]!=hash[i+1])
            {
                ans=(ans*fact[count])%mod;
                count=1;
            }
            else
                count++;
        }
        out.println(ans);
    }

    ///////////////////////////////////////////////////////////

    public void run(){
        try{
            br=new BufferedReader(new InputStreamReader(System.in));
            st=null;
            out=new PrintWriter(System.out);

            solve();

            // int t=nextInt();
            // for(int i=1;i<=t;i++){
            //     // out.print("Case #"+i+": ");
            //     solve();
            // }

            br.close();
            out.close();
        }catch(Exception e){
            e.printStackTrace();
            System.exit(1);
        }
    }
    public static void main(String args[])throws IOException{
        new Main().run();
    }

    BufferedReader br;
    StringTokenizer st;
    PrintWriter out;
    String nextToken()throws IOException{
        while(st==null || !st.hasMoreTokens())
        st=new StringTokenizer(br.readLine());
        return st.nextToken();
    }
    String nextLine()throws IOException{
        return br.readLine();
    }
    int nextInt()throws IOException{
        return Integer.parseInt(nextToken());
    }
    long nextLong()throws IOException{
        return Long.parseLong(nextToken());
    }
    double nextDouble()throws IOException{
        return Double.parseDouble(nextToken());
    }
}


import java.io.*;
import java.util.*;
public class Main
{

	final int p=(int)(1e5+1);
	final long mod=(long)(1e9+7);
	final long mod2=999999937l;
	final int maxn=(int)(1e6);
	long fact[];

	Main()
	{
		fact=new long[maxn+1];
		fact[0]=1;
		for(int i=1;i<=maxn;i++)
			fact[i]=(fact[i-1]*i)%mod;
	}

	private void solve()throws IOException
	{
		int n=nextInt();
		int m=nextInt();
		ArrayList<Integer> list=new ArrayList<>();
		long hash[]=new long[m+1];
		long hash2[]=new long[m+1];
		long pow=1,pow2=1;
		for(int i=0;i<n;i++)
		{
			int g=nextInt();
			list.clear();
			for(int j=1;j<=g;j++)
			{
				list.add(nextInt());
			}
			Collections.sort(list);
			int count=1;
			for(int j=0;j<list.size();j++)
			{
				if(j==list.size()-1 || list.get(j)!=list.get(j+1))
				{
					hash[list.get(j)]=(hash[list.get(j)]+(count*pow)%mod)%mod;
					hash2[list.get(j)]=(hash2[list.get(j)]+(count*pow2)%mod2)%mod2;
					count=1;
				}
				else
					count++;
			}
			pow=(pow*p)%mod;
			pow2=(pow2*p)%mod2;
		}
		HashMap<String,Integer> map=new HashMap<>();
		for(int i=1;i<=m;i++)
			map.put(hash[i]+" "+hash2[i],map.getOrDefault(hash[i]+" "+hash2[i],0)+1);
		long ans=1;
		int count=1;
		for(int i:map.values())
			ans=(ans*fact[i])%mod;
		out.println(ans);
	}

	///////////////////////////////////////////////////////////

	public void run(){
		try{
			br=new BufferedReader(new InputStreamReader(System.in));
			st=null;
			out=new PrintWriter(System.out);

			solve();

			br.close();
			out.close();
		}catch(Exception e){
			e.printStackTrace();
			System.exit(1);
		}
	}
	public static void main(String args[])throws IOException{
		new Main().run();
	}

	BufferedReader br;
	StringTokenizer st;
	PrintWriter out;
	String nextToken()throws IOException{
		while(st==null || !st.hasMoreTokens())
		st=new StringTokenizer(br.readLine());
		return st.nextToken();
	}
	String nextLine()throws IOException{
		return br.readLine();
	}
	int nextInt()throws IOException{
		return Integer.parseInt(nextToken());
	}
	long nextLong()throws IOException{
		return Long.parseLong(nextToken());
	}
	double nextDouble()throws IOException{
		return Double.parseDouble(nextToken());
	}
}


import java.io.*;
import java.util.*;
public class Main
{

    final int p=(int)(1e5+1);
    final int mod=(int)(1e9+7);
    final int maxn=(int)(1e6);
    long fact[];

    Main()
    {
        fact=new long[maxn+1];
        fact[0]=1;
        for(int i=1;i<=maxn;i++)
            fact[i]=(fact[i-1]*i)%mod;
    }

    private void solve()throws IOException
    {
        int n=nextInt();
        int m=nextInt();
        ArrayList<Integer> list=new ArrayList<>();
        long hash[]=new long[m+1];
        long pow=1;
        for(int i=0;i<n;i++)
        {
            int g=nextInt();
            list.clear();
            for(int j=1;j<=g;j++)
            {
                list.add(nextInt());
            }
            Collections.sort(list);
            int count=1;
            for(int j=0;j<list.size();j++)
            {
                if(j==list.size()-1 || list.get(j)!=list.get(j+1))
                {
                    hash[list.get(j)]=(hash[list.get(j)]+(count*pow)%mod)%mod;
                    count=1;
                }
                else
                    count++;

            }
            pow=(pow*p)%mod;
        }
        Arrays.sort(hash,1,m+1);
        long ans=1;
        int count=1;
        for(int i=1;i<=m;i++)
        {
            if(i==m || hash[i]!=hash[i+1])
            {
                ans=(ans*fact[count])%mod;
                count=1;
            }
            else
                count++;
        }
        out.println(ans);
    }

    ///////////////////////////////////////////////////////////

    public void run(){
        try{
            br=new BufferedReader(new InputStreamReader(System.in));
            st=null;
            out=new PrintWriter(System.out);

            solve();

            // int t=nextInt();
            // for(int i=1;i<=t;i++){
            //     // out.print("Case #"+i+": ");
            //     solve();
            // }

            br.close();
            out.close();
        }catch(Exception e){
            e.printStackTrace();
            System.exit(1);
        }
    }
    public static void main(String args[])throws IOException{
        new Main().run();
    }

    BufferedReader br;
    StringTokenizer st;
    PrintWriter out;
    String nextToken()throws IOException{
        while(st==null || !st.hasMoreTokens())
        st=new StringTokenizer(br.readLine());
        return st.nextToken();
    }
    String nextLine()throws IOException{
        return br.readLine();
    }
    int nextInt()throws IOException{
        return Integer.parseInt(nextToken());
    }
    long nextLong()throws IOException{
        return Long.parseLong(nextToken());
    }
    double nextDouble()throws IOException{
        return Double.parseDouble(nextToken());
    }
}


import java.io.*;
import java.util.*;
public class Main
{

	final int p=(int)(1e5+1);
	final long mod=(long)(1e9+7);
	final long mod2=999999937l;
	final int maxn=(int)(1e6);
	long fact[];

	Main()
	{
		fact=new long[maxn+1];
		fact[0]=1;
		for(int i=1;i<=maxn;i++)
			fact[i]=(fact[i-1]*i)%mod;
	}

	private void solve()throws IOException
	{
		int n=nextInt();
		int m=nextInt();
		ArrayList<Integer> list=new ArrayList<>();
		long hash[]=new long[m+1];
		long hash2[]=new long[m+1];
		long pow=1,pow2=1;
		for(int i=0;i<n;i++)
		{
			int g=nextInt();
			list.clear();
			for(int j=1;j<=g;j++)
			{
				list.add(nextInt());
			}
			Collections.sort(list);
			int count=1;
			for(int j=0;j<list.size();j++)
			{
				if(j==list.size()-1 || list.get(j)!=list.get(j+1))
				{
					hash[list.get(j)]=(hash[list.get(j)]+(count*pow)%mod)%mod;
					hash2[list.get(j)]=(hash2[list.get(j)]+(count*pow2)%mod2)%mod2;
					count=1;
				}
				else
					count++;
			}
			pow=(pow*p)%mod;
			pow2=(pow2*p)%mod2;
		}
		Arrays.sort(hash,1,m+1);
		Arrays.sort(hash2,1,m+1);
		long ans=1;
		int count=1;
		for(int i=1;i<=m;i++)
		{
			if(i==m || hash[i]!=hash[i+1] || hash2[i]!=hash2[i+1])
			{
				ans=(ans*fact[count])%mod;
				count=1;
			}
			else
				count++;
		}
		out.println(ans);
	}

	///////////////////////////////////////////////////////////

	public void run(){
		try{
			br=new BufferedReader(new InputStreamReader(System.in));
			st=null;
			out=new PrintWriter(System.out);

			solve();

			br.close();
			out.close();
		}catch(Exception e){
			e.printStackTrace();
			System.exit(1);
		}
	}
	public static void main(String args[])throws IOException{
		new Main().run();
	}

	BufferedReader br;
	StringTokenizer st;
	PrintWriter out;
	String nextToken()throws IOException{
		while(st==null || !st.hasMoreTokens())
		st=new StringTokenizer(br.readLine());
		return st.nextToken();
	}
	String nextLine()throws IOException{
		return br.readLine();
	}
	int nextInt()throws IOException{
		return Integer.parseInt(nextToken());
	}
	long nextLong()throws IOException{
		return Long.parseLong(nextToken());
	}
	double nextDouble()throws IOException{
		return Double.parseDouble(nextToken());
	}
}


/*
http://codeforces.com/blog/entry/49743
*/
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>

using namespace std;

const long long MOD = 1e9+7;
const int N = 1e6+5;
vector<int> G[N];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie();
    int n,m,k,x;
    cin >> n >> m;
    for(int i = 1;i <= n;i++)
    {
        cin>>k;
        while(k--)
        {
            cin>>x;
            G[x].push_back(i);
        }
    }

    sort(G+1,G+1+m);
    long long cnt = 1,res = 1;
    for(int i = 1;i <= m-1;i++)
    {
        if(G[i] == G[i+1])
        {
            cnt++;
            res = res * cnt % MOD;
        }
        else
            cnt = 1;
    }
    cout<<res<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define int long long

int32_t main(){
	int n, m; cin >> n >> m;
	vector<multiset<int>> v(m);
	vector<int> fact(m+1);
	fact[0]=1;
	for(int i=1; i<=m; ++i) fact[i] = i * fact[i-1] % 1000000007;
	for(int i=0; i<n; ++i){
		int g; cin >> g;
		for(int j=0; j<g; ++j){
			int k; cin >> k;
			v[k-1].insert(i);
		}
	}
	sort(v.begin(), v.end());
	int ans=1;
	int i=1, mul=1;
	while(i<m){
		while(v[i] == v[i-1]) ++i, ++mul;
		ans = ans * fact[mul] % 1000000007;
		mul = 1;
		++i;
	}
	ans = ans * mul % 1000000007;
	cout << ans << endl;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

ll arr[2002][2002];
ll d1[4030],d2[4030],sol[2];
pair<int,int> v[2];

void check(int c,int i,int j,ll val){
	if(val>sol[c]){
		sol[c]=val;
		v[c].first=i;
		v[c].second=j;
	}
}

int main(){
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			cin>>arr[i][j];
			d1[i+j]+=arr[i][j];
			d2[i-j+n]+=arr[i][j];
		}
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			check((i+j)&1,i,j,d1[i+j]+d2[i-j+n]-arr[i][j]);
		}
	}
	cout<<sol[0]+sol[1]<<"\n";
	if(v[0]>v[1]){
		swap(v[0],v[1]);
	}
	cout<<v[0].first<<" "<<v[0].second<<" ";
	cout<<v[1].first<<" "<<v[1].second<<"\n";
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define fastio() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define PSET(x,y) fixed<<setprecision(y)<<x
#define pb push_back
#define pf push_front
#define mp make_pair
#define pii pair<int,int>
#define pli pair<int,int>
#define pint pair<int,int>
#define pid pair<int,double>
#define vi vector<int>
#define ff first
#define ss second
#define ll long long
#define ull unsigned long long
#define SIZE 200010
#define MOD 1000000007
#define BIG 999999937

int main()
{

//	freopen("input.txt", "r", stdin);
	int n;
	cin>>n;
//	ll** board=new ll*[n];
//	for(int i=0;i<n;i++)
//	{
//		board[i]=new ll[n];
//	}
	ll board[n][n];
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<n;j++)
		{
			cin>>board[i][j];
		}
	}
//	int* prim=new int[2*n+1];
//	int* sec=new int[2*n+1];
	ll prim[2*n];
	ll sec[2*n];

	for(int i=0;i<2*n;i++)
	{
		prim[i]=sec[i]=0;
	}
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<n;j++)
		{
			prim[i+j]+=board[i][j];
			sec[n-(i-j)-1]+=board[i][j];
//			cout<<"prim["<<i+j<<"="<<prim[i+j]<<endl;
//			cout<<"sec["<<n-(i-j)-1<<"="<<sec[n-(i-j)-1]<<endl;
		}
	}

	pair<ll,ll> odd,even;
//	odd.first=INT_MIN;
//	odd.second=INT_MIN;
//	even.first=INT_MIN;
//	even.second=INT_MIN;

	ll maxo=INT_MIN;
	ll maxe=INT_MIN;

//	for(int i=0;i<4;i++)
//	{
//		cout<<"prim["<<i<<"="<<prim[i]<<endl;
//		cout<<"sec["<<i<<"="<<sec[i]<<endl;
//	}

	for(int i=0;i<n;i++)
	{
		for(int j=0;j<n;j++)
		{
			if((i+j)&1)
			{
				if(maxe<prim[i+j]+sec[n-(i-j)-1]-board[i][j])
				{
					even.first=i;
					even.second=j;
					maxe=prim[i+j]+sec[n-(i-j)-1]-board[i][j];
					//cout<<"maxe"<<maxe<<endl;
				}
			}
			else
			{
				if(maxo<prim[i+j]+sec[n-(i-j)-1]-board[i][j])
				{
					odd.first=i;
					odd.second=j;
					maxo=prim[i+j]+sec[n-(i-j)-1]-board[i][j];
				//	cout<<"maxo"<<maxo<<endl;
				}
			}
		}
	}

	cout<<maxo+maxe<<endl;
	cout<<even.first+1<<" "<<even.second+1<<" "<<odd.first+1<<" "<<odd.second+1<<endl;

//	for(int i=0;i<n;i++)
//	{
//		int j=0;
//		int row=i;
//		int sum=0;
//		while(row>=0 && row<n && j<n && j>=0)
//		{
//			sum+=board[row][j];
//			row++;
//			j--;
//		}
//		prim[i]=sum;
//	}
//	for(int )

	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define fastio() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define PSET(x,y) fixed<<setprecision(y)<<x
#define pb push_back
#define pf push_front
#define mp make_pair
#define pii pair<int,int>
#define pli pair<int,int>
#define pint pair<int,int>
#define pid pair<int,double>
#define vi vector<int>
#define ff first
#define ss second
#define ll long long
#define ull unsigned long long
#define SIZE 200010
#define MOD 1000000007
#define BIG 999999937

int main()
{

//	freopen("input.txt", "r", stdin);
	int n;
	cin>>n;
	ll** board=new ll*[n];
	for(int i=0;i<n;i++)
	{
		board[i]=new ll[n];
	}
//	ll board[2014][2014];
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<n;j++)
		{
			cin>>board[i][j];
		}
	}
//	int* prim=new int[2*n+1];
//	int* sec=new int[2*n+1];
	ll prim[2*n];
	ll sec[2*n];

	for(int i=0;i<2*n;i++)
	{
		prim[i]=sec[i]=0;
	}
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<n;j++)
		{
			prim[i+j]+=board[i][j];
			sec[i-j+n]+=board[i][j];
//			cout<<"prim["<<i+j<<"="<<prim[i+j]<<endl;
//			cout<<"sec["<<n-(i-j)-1<<"="<<sec[n-(i-j)-1]<<endl;
		}
	}

	pair<ll,ll> odd,even;
//	odd.first=INT_MIN;
//	odd.second=INT_MIN;
//	even.first=INT_MIN;
//	even.second=INT_MIN;

	ll maxo=INT_MIN;
	ll maxe=INT_MIN;

//	for(int i=0;i<4;i++)
//	{
//		cout<<"prim["<<i<<"="<<prim[i]<<endl;
//		cout<<"sec["<<i<<"="<<sec[i]<<endl;
//	}

	for(int i=0;i<n;i++)
	{
		for(int j=0;j<n;j++)
		{
			if((i+j)&1)
			{
				if(maxe<prim[i+j]+sec[i-j+n]-board[i][j])
				{
					even.first=i;
					even.second=j;
					maxe=prim[i+j]+sec[i-j+n]-board[i][j];
					//cout<<"maxe"<<maxe<<endl;
				}
			}
			else
			{
				if(maxo<prim[i+j]+sec[i-j+n]-board[i][j])
				{
					odd.first=i;
					odd.second=j;
					maxo=prim[i+j]+sec[i-j+n]-board[i][j];
				//	cout<<"maxo"<<maxo<<endl;
				}
			}
		}
	}

	cout<<maxo+maxe<<endl;
	cout<<even.first+1<<" "<<even.second+1<<" "<<odd.first+1<<" "<<odd.second+1<<endl;

//	for(int i=0;i<n;i++)
//	{
//		int j=0;
//		int row=i;
//		int sum=0;
//		while(row>=0 && row<n && j<n && j>=0)
//		{
//			sum+=board[row][j];
//			row++;
//			j--;
//		}
//		prim[i]=sum;
//	}
//	for(int )

	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define fastio() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define PSET(x,y) fixed<<setprecision(y)<<x
#define pb push_back
#define pf push_front
#define mp make_pair
#define pii pair<int,int>
#define pli pair<int,int>
#define pint pair<int,int>
#define pid pair<int,double>
#define vi vector<int>
#define ff first
#define ss second
#define ll long long
#define ull unsigned long long
#define SIZE 200010
#define MOD 1000000007
#define BIG 999999937

int main()
{

//	freopen("input.txt", "r", stdin);
	int n;
	cin>>n;
//	ll** board=new ll*[n];
//	for(int i=0;i<n;i++)
//	{
//		board[i]=new ll[n];
//	}
	ll board[2014][2014];
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<n;j++)
		{
			cin>>board[i][j];
		}
	}
//	int* prim=new int[2*n+1];
//	int* sec=new int[2*n+1];
	ll prim[2*n];
	ll sec[2*n];

	for(int i=0;i<2*n;i++)
	{
		prim[i]=sec[i]=0;
	}
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<n;j++)
		{
			prim[i+j]+=board[i][j];
			sec[n-(i-j)-1]+=board[i][j];
//			cout<<"prim["<<i+j<<"="<<prim[i+j]<<endl;
//			cout<<"sec["<<n-(i-j)-1<<"="<<sec[n-(i-j)-1]<<endl;
		}
	}

	pair<ll,ll> odd,even;
//	odd.first=INT_MIN;
//	odd.second=INT_MIN;
//	even.first=INT_MIN;
//	even.second=INT_MIN;

	ll maxo=INT_MIN;
	ll maxe=INT_MIN;

//	for(int i=0;i<4;i++)
//	{
//		cout<<"prim["<<i<<"="<<prim[i]<<endl;
//		cout<<"sec["<<i<<"="<<sec[i]<<endl;
//	}

	for(int i=0;i<n;i++)
	{
		for(int j=0;j<n;j++)
		{
			if((i+j)&1)
			{
				if(maxe<prim[i+j]+sec[n-(i-j)-1]-board[i][j])
				{
					even.first=i;
					even.second=j;
					maxe=prim[i+j]+sec[n-(i-j)-1]-board[i][j];
					//cout<<"maxe"<<maxe<<endl;
				}
			}
			else
			{
				if(maxo<prim[i+j]+sec[n-(i-j)-1]-board[i][j])
				{
					odd.first=i;
					odd.second=j;
					maxo=prim[i+j]+sec[n-(i-j)-1]-board[i][j];
				//	cout<<"maxo"<<maxo<<endl;
				}
			}
		}
	}

	cout<<maxo+maxe<<endl;
	cout<<even.first+1<<" "<<even.second+1<<" "<<odd.first+1<<" "<<odd.second+1<<endl;

//	for(int i=0;i<n;i++)
//	{
//		int j=0;
//		int row=i;
//		int sum=0;
//		while(row>=0 && row<n && j<n && j>=0)
//		{
//			sum+=board[row][j];
//			row++;
//			j--;
//		}
//		prim[i]=sum;
//	}
//	for(int )

	return 0;
}