#include <iostream>
using namespace std;

int main()
{
    int N;
    cin >> N;
    int A[N];
    int i = 0;
    int max_num = 2;
    while (i != N)
    {
        scanf("%d", &A[i]);
        if (max_num < A[i])
        {
            max_num = A[i];
        }
        i++;
        if (i != N)
        {
            scanf(" ");
        }
    }


    int ans = -1;
    int counter = 0;
    int max_counter = 0;
    for (int k = 2; k <= max_num; k++)
    {
        for (i = 0; i < N; i++)
        {
            if (A[i] % k == 0)
            {
                counter++;
            }

        }
        if (max_counter <= counter)
        {
            max_counter = counter;
            ans = k;
        }

        counter = 0;
    }

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

#include <bits/stdc++.h>
using namespace std;
#define int long long
const int maxn=200005;
inline int read() {
	register int r=0,f=1;
	register char ch=getchar();
	while(ch<'0' || ch>'9') {
		if(ch=='-') f=-1;
		ch=getchar();
	}
	while(ch>='0' && ch<='9') {
		r=(r<<1)+(r<<3)+(ch^48);
		ch=getchar();
	}
	return r*f;
}
int n;
int a[maxn];
int tong[maxn],tot;
int ans;
int fa[maxn];

struct nod{
	int x,y;
	nod(){}
	nod(int a,int b) {x=a,y=b;}
}edge[maxn];
int find(int x) {
	return fa[x]==x ? x : fa[x]=find(fa[x]);
}
void merge(int x,int y) {
	fa[find(x)]=find(y);
	return;
}


inline void k() {
	for(int i=1;i<=tot;++i) {
		int x=edge[i].x,y=edge[i].y;
		int fx=find(x);
		int fy=find(y);
		if(fx!=fy) {
			merge(fx,fy);
			++ans;
		}
	}
	cout<<ans<<endl;
	return;
}

signed main()
{
	n=read();
	
	for(int i=1;i<=n;++i) a[i]=read();
	for(int i=0;i<maxn;++i) fa[i]=i;
	for(int i=1;i<=n+1-i;++i) 
	if(a[i]!=a[n+1-i]) edge[++tot]=nod(a[i],a[n+1-i]);
	k();
	return 0;
}