#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;
long long a[1000005],x,ANS,ans[100005];
int o,y,i,n,j,now;
map <long long,int> mp;
int cmp(long long i,long long j) {return i>j;}
int main()
{
    scanf("%d",&n);
    for (i=1; i<=n; i++) scanf("%I64d",&a[i]);
    for (i=1; i<=16; i++)
    {
        y=(rand()*10+rand()%10)%n+1; mp.clear(); now=o=0;
        for (j=1; j<=n; j++)
        {
            x=__gcd(a[j],a[y]);
            if (mp[x]==0) ans[++o]=x; mp[x]++;
        }
        sort(ans+1,ans+o+1,cmp);
        for (j=1; j<=o; j++)
        {
            now+=mp[ans[j]];
            if (now>=n/2) ANS=max(ANS,ans[j]);
        }
    }
    cout<<ANS;
    return 0;
}


#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;
long long ANS,A[1000005],a[1000005];
int n,x,i,j,o,O,k;
int cmp(long long i,long long j) {return i<j;}
struct node {long long x;int y;} b[1000005];
int main()
{
    scanf("%d",&n);
    for (i=1; i<=n; i++) scanf("%I64d",&A[i]);
    x=1;
    for (i=1; i<=16; i++)
    {
        x=x*117%n+1; o=0;
        for (j=1; j<=n; j++) if (j!=x) a[++o]=__gcd(A[x],A[j]);
        sort(a+1,a+o+1,cmp); O=0;
        for (j=1; j<=o; j++)
          if (a[j]!=a[j-1]) {b[++O].x=a[j]; b[O].y=1; }else b[O].y++;
        for (j=O; j>=1; j--)
        {
            if (b[j].y>=(n-1)/2) ANS=max(ANS,b[j].x);
            for (k=j-1; k>=1; k--) if (b[j].x%b[k].x==0) b[k].y+=b[j].y;
        }
    }
    cout<<ANS;
    return 0;
}


#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;
long long a[1000005],x,ANS,ans[100005];
int o,y,i,n,j,now,k;
map <long long,int> mp;
struct node {long long x;int y,z;} t[1000005];
int cmp(node i,node j) {return i.x>j.x;}
int main()
{
    scanf("%d",&n);
    for (i=1; i<=n; i++) scanf("%I64d",&a[i]);
    for (i=1; i<=14; i++)
    {
        y=(rand()*10+rand()%10)%n+1; mp.clear(); now=o=0;
        for (j=1; j<=n; j++)
        {
            x=__gcd(a[j],a[y]);
            if (mp[x]==0) ans[++o]=x; mp[x]++;
        }
        for (j=1; j<=o; j++) t[j].x=ans[j],t[j].y=mp[ans[j]],t[j].z=0;
        sort(t+1,t+o+1,cmp);
        for (j=1; j<=o; j++)
        {
            if (t[j].y+t[j].z>n/2-1+n%2) {ANS=max(ANS,t[j].x); break;}
            for (k=j+1; k<=o; k++) if (t[j].x%t[k].x==0) t[k].z+=t[j].y;
        }
    }
    cout<<ANS;
    return 0;
}


#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;
long long a[1000005],x,ANS,ans[100005];
int o,y,i,n,j,now,k;
map <long long,int> mp;
struct node {long long x;int y,z;} t[1000005];
int cmp(node i,node j) {return i.x>j.x;}
int main()
{
    scanf("%d",&n);
    for (i=1; i<=n; i++) scanf("%I64d",&a[i]);
    y=1;
    for (i=1; i<=13; i++)
    {
        y=y*111%n+1; mp.clear(); now=o=0;
        for (j=1; j<=n; j++)
        {
            x=__gcd(a[j],a[y]);
            if (mp[x]==0) ans[++o]=x; mp[x]++;
        }
        for (j=1; j<=o; j++) t[j].x=ans[j],t[j].y=mp[ans[j]],t[j].z=0;
        sort(t+1,t+o+1,cmp);
        for (j=1; j<=o; j++)
        {
            if (t[j].y+t[j].z>n/2-1+n%2) {ANS=max(ANS,t[j].x); break;}
            for (k=j+1; k<=o; k++) if (t[j].x%t[k].x==0) t[k].z+=t[j].y;
        }
    }
    cout<<ANS;
    return 0;
}


#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;
long long ANS,A[1000005],a[1000005];
int n,x,i,j,o,O,k,p[1000005];
int cmp(long long i,long long j) {return i<j;}
struct node {long long x;int y,z;} b[1000005];
int main()
{
    scanf("%d",&n);
    for (i=1; i<=n; i++) scanf("%I64d",&A[i]);
    x=1;
    for (i=1; i<=12; i++)
    {
        x=x*117%n+1; o=0; while (p[x]) {x=x%n+1;} p[x]=1;
        for (j=1; j<=n; j++) if (j!=x) a[++o]=__gcd(A[x],A[j]);
        sort(a+1,a+o+1,cmp); O=0;
        for (j=1; j<=o; j++)
          if (a[j]!=a[j-1]) {b[++O].x=a[j]; b[O].y=1; b[O].z=0;}else b[O].y++;
        for (j=O; j>=1; j--)
        {
            if (b[j].y+b[j].z>=(n-1)/2) ANS=max(ANS,b[j].x);
            for (k=j-1; k>=1; k--) if (b[j].x%b[k].x==0) {b[k].z+=b[j].y;break;}
        }
    }
    cout<<ANS;
    return 0;
}


#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <cstdlib>
#include <map>
using namespace std;

#define FOR(it, c) for(__typeof((c).begin()) it = (c).begin(); it != (c).end(); it++)
#define SZ(c) ((int)(c).size())

typedef long long LL;

const int N = 1000006;
LL a[N];
int n;

vector<LL> S;
int C[40][10005];
int R[40][10005];
LL best=0;

void go(LL p[], int x, int f, int lev, LL now) {
	int cnt=0;
	for(int i=0;i<SZ(S);i++) cnt += C[lev][i];
	if(cnt < n/2) return;
	best = max(best, now);
	while(x<f) {
		for(int i=0;i<SZ(S);i++)
			C[lev+1][i] = (R[x][i]? C[lev][i]: 0);
		go(p, x+1, f, lev+1, now*p[x]);
		x++;
	}
	return;
}

LL solve(LL L) {
	map<LL, int> d;
	for(int i=0;i<n;i++) d[__gcd(L, a[i])]++;
	int m = SZ(d);
	LL p[60]={}, t = L;
	int f=0;
	for(LL k=2;k*k<=t;k++) {
		if(t%k==0) {
			LL w = k;
			p[f++] = w;
			t/=k;
			while(t%k==0) { w *= k; p[f++] = w; t/=k; }
		}
	}
	if(t>1) p[f++] = t;
	vector<pair<LL, int> > r(d.begin(), d.end());
	S = vector<LL>();
	FOR(it, r) S.push_back(it->first);
	for(int i=0;i<m;i++) C[0][i] = r[i].second;
	for(int i=0;i<f;i++) for(int j=0;j<m;j++) R[i][j] = (S[j]%p[i]==0);
	best = 0;
	go(p,0,f,0,1);
	return best;
}

int main(void) {
	LL g = 1;
	srand(0);
	scanf("%d", &n);
	for(int i=0;i<n;i++) scanf("%I64d", &a[i]);
	for(int t=1;t<=5;t++) {
		int x = rand()%n;
		LL v = solve(a[x]);
		g = max(g, v);
	}
	printf("%I64d\n", g);
	return 0;
}


#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <cstdlib>
#include <map>
using namespace std;

#define FOR(it, c) for(__typeof((c).begin()) it = (c).begin(); it != (c).end(); it++)
#define SZ(c) ((int)(c).size())

typedef long long LL;

const int N = 1000006;
LL a[N];
int n, m;

int C[40][10005];
int R[40][10005];
LL best=0;

void go(LL p[], LL q[], int x, int f, int lev, LL now) {
	int cnt=0;
	for(int i=0;i<m;i++) cnt += C[lev][i];
	if(cnt < (n+1)/2) return;
	best = max(best, now);
	while(x<f) {
		for(int i=0;i<m;i++)
			C[lev+1][i] = (R[x][i]? C[lev][i]: 0);
		go(p, q, x+1, f, lev+1, now*q[x]);
		while(x<f && q[x+1]==q[x]) x++;
		x++;
	}
	return;
}

LL solve(LL L) {
	map<LL, int> d;
	for(int i=0;i<n;i++) d[__gcd(L, a[i])]++;
	m = SZ(d);
	LL p[60]={}, q[60]={}, t = L;
	int f=0;
	for(LL k=2;k*k<=t;k++) {
		if(t%k==0) {
			LL w = k;
			p[f] = w;
			q[f] = k;
			f++;
			t/=k;
			while(t%k==0) { w *= k; q[f] = k; p[f++] = w; t/=k; }
		}
	}
	if(t>1) { q[f] = t; p[f++] = t; }
	vector<pair<LL, int> > r(d.begin(), d.end());
	for(int i=0;i<m;i++) C[0][i] = r[i].second;
	for(int i=0;i<f;i++) for(int j=0;j<m;j++) R[i][j] = (r[j].first%p[i]==0);
	best = 0;
	go(p,q,0,f,0,1);
	return best;
}

inline int RND(int s) {
	return (rand()%1000*1000000+rand()%1000*1000+rand()%1000)%s;
}

int main(void) {
	LL g = 1;
	srand(0);
	scanf("%d", &n);
	for(int i=0;i<n;i++) scanf("%I64d", &a[i]);
	for(int t=1;t<=5;t++) {
		int x = RND(n);
		LL v = solve(a[x]);
		g = max(g, v);
	}
	printf("%I64d\n", g);
	return 0;
}


#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <cstdlib>
#include <map>
using namespace std;

#define FOR(it, c) for(__typeof((c).begin()) it = (c).begin(); it != (c).end(); it++)
#define SZ(c) ((int)(c).size())

typedef long long LL;

const int N = 1000006;
LL a[N];
int n;

vector<LL> S;
int C[40][10005];
LL best=0;

void go(LL *p, int f, int lev, LL now) {
	int cnt=0;
	for(int i=0;i<SZ(S);i++) cnt += C[lev][i];
	if(cnt < n/2) return;
	best = max(best, now);
	while(f--){
		for(int i=0;i<SZ(S);i++)
			C[lev+1][i] = (S[i]%(*p) == 0? C[lev][i]: 0);
		go(p+1, f, lev+1, now*(*p));
		p++;
	}
	return;
}

LL solve(LL L) {
	map<LL, int> d;
	for(int i=0;i<n;i++) d[__gcd(L, a[i])]++;
	int m = SZ(d);
	LL p[60]={}, t = L;
	int f=0;
	for(LL k=2;k*k<=t;k++) {
		if(t%k==0) {
			LL w = k;
			p[f++] = w;
			t/=k;
			while(t%k==0) { w *= k; p[f++] = w; t/=k; }
		}
	}
	if(t>1) p[f++] = t;
	vector<pair<LL, int> > r(d.begin(), d.end());
	S = vector<LL>();
	FOR(it, r) S.push_back(it->first);
	for(int i=0;i<m;i++) C[0][i] = r[i].second;
	best = 0;
	go(p,f,0,1);
	return best;
}

int main(void) {
	LL g = 1;
	srand(0);
	scanf("%d", &n);
	for(int i=0;i<n;i++) scanf("%I64d", &a[i]);
	for(int t=1;t<=5;t++) {
		int x = rand()%n;
		LL v = solve(a[x]);
		g = max(g, v);
	}
	printf("%I64d\n", g);
	return 0;
}


#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <cstdlib>
#include <map>
using namespace std;

#define FOR(it, c) for(__typeof((c).begin()) it = (c).begin(); it != (c).end(); it++)
#define SZ(c) ((int)(c).size())

typedef long long LL;

const int N = 1000006;
LL a[N];
int n;

vector<LL> S;
int C[40][10005];
int R[40][10005];
LL best=0;

void go(LL p[], int x, int f, int lev, LL now) {
	int cnt=0;
	for(int i=0;i<SZ(S);i++) cnt += C[lev][i];
	if(cnt < n/2) return;
	best = max(best, now);
	while(x<f) {
		for(int i=0;i<SZ(S);i++)
			C[lev+1][i] = (R[x][i]? C[lev][i]: 0);
		go(p, x+1, f, lev+1, now*p[x]);
		x++;
	}
	return;
}

LL solve(LL L) {
	map<LL, int> d;
	for(int i=0;i<n;i++) d[__gcd(L, a[i])]++;
	int m = SZ(d);
	LL p[60]={}, t = L;
	int f=0;
	for(LL k=2;k*k<=t;k++) {
		if(t%k==0) {
			LL w = k;
			p[f++] = w;
			t/=k;
			while(t%k==0) { w *= k; p[f++] = w; t/=k; }
		}
	}
	if(t>1) p[f++] = t;
	vector<pair<LL, int> > r(d.begin(), d.end());
	S = vector<LL>();
	FOR(it, r) S.push_back(it->first);
	for(int i=0;i<m;i++) C[0][i] = r[i].second;
	for(int i=0;i<f;i++) for(int j=0;j<m;j++) R[i][j] = (S[j]%p[i]==0);
	best = 0;
	go(p,0,f,0,1);
	return best;
}

int main(void) {
	LL g = 1;
	srand(0);
	scanf("%d", &n);
	for(int i=0;i<n;i++) scanf("%I64d", &a[i]);
	for(int t=1;t<=8;t++) {
		int x = rand()%n;
		LL v = solve(a[x]);
		g = max(g, v);
	}
	printf("%I64d\n", g);
	return 0;
}


#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <cstdlib>
#include <map>
using namespace std;

#define FOR(it, c) for(__typeof((c).begin()) it = (c).begin(); it != (c).end(); it++)
#define SZ(c) ((int)(c).size())

typedef long long LL;

const int N = 1000006;
LL a[N];
int n, m;

int C[40][10005];
int R[40][10005];
LL best=0;

void go(LL p[], LL q[], int x, int f, int lev, LL now) {
	int cnt=0;
	for(int i=0;i<m;i++) cnt += C[lev][i];
	if(cnt < n/2) return;
	best = max(best, now);
	while(x<f) {
		for(int i=0;i<m;i++)
			C[lev+1][i] = (R[x][i]? C[lev][i]: 0);
		go(p, q, x+1, f, lev+1, now*q[x]);
		while(x<f && q[x+1]==q[x]) x++;
		x++;
	}
	return;
}

LL solve(LL L) {
	map<LL, int> d;
	for(int i=0;i<n;i++) d[__gcd(L, a[i])]++;
	m = SZ(d);
	LL p[60]={}, q[60]={}, t = L;
	int f=0;
	for(LL k=2;k*k<=t;k++) {
		if(t%k==0) {
			LL w = k;
			p[f] = w;
			q[f] = k;
			f++;
			t/=k;
			while(t%k==0) { w *= k; q[f] = k; p[f++] = w; t/=k; }
		}
	}
	if(t>1) { q[f] = t; p[f++] = t; }
	vector<pair<LL, int> > r(d.begin(), d.end());
	for(int i=0;i<m;i++) C[0][i] = r[i].second;
	for(int i=0;i<f;i++) for(int j=0;j<m;j++) R[i][j] = (r[j].first%p[i]==0);
	best = 0;
	go(p,q,0,f,0,1);
	return best;
}

int main(void) {
	LL g = 1;
	srand(0);
	scanf("%d", &n);
	for(int i=0;i<n;i++) scanf("%I64d", &a[i]);
	for(int t=1;t<=5;t++) {
		int x = rand()%n;
		LL v = solve(a[x]);
		g = max(g, v);
	}
	printf("%I64d\n", g);
	return 0;
}


#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <cstdlib>
#include <map>
using namespace std;

#define FOR(it, c) for(__typeof((c).begin()) it = (c).begin(); it != (c).end(); it++)
#define SZ(c) ((int)(c).size())

typedef long long LL;

const int N = 1000006;
LL a[N];
int n, m;

int C[40][10005];
int R[40][10005];
LL best=0;

void go(LL p[], LL q[], int x, int f, int lev, LL now) {
	int cnt=0;
	for(int i=0;i<m;i++) cnt += C[lev][i];
	if(cnt < (n+1)/2) return;
	best = max(best, now);
	while(x<f) {
		for(int i=0;i<m;i++)
			C[lev+1][i] = (R[x][i]? C[lev][i]: 0);
		go(p, q, x+1, f, lev+1, now*q[x]);
		while(x<f && q[x+1]==q[x]) x++;
		x++;
	}
	return;
}

LL solve(LL L) {
	map<LL, int> d;
	for(int i=0;i<n;i++) d[__gcd(L, a[i])]++;
	m = SZ(d);
	LL p[60]={}, q[60]={}, t = L;
	int f=0;
	for(LL k=2;k*k<=t;k++) {
		if(t%k==0) {
			LL w = k;
			p[f] = w;
			q[f] = k;
			f++;
			t/=k;
			while(t%k==0) { w *= k; q[f] = k; p[f++] = w; t/=k; }
		}
	}
	if(t>1) { q[f] = t; p[f++] = t; }
	vector<pair<LL, int> > r(d.begin(), d.end());
	for(int i=0;i<m;i++) C[0][i] = r[i].second;
	for(int i=0;i<f;i++) for(int j=0;j<m;j++) R[i][j] = (r[j].first%p[i]==0);
	best = 0;
	go(p,q,0,f,0,1);
	return best;
}

int main(void) {
	LL g = 1;
	srand(0);
	scanf("%d", &n);
	for(int i=0;i<n;i++) scanf("%I64d", &a[i]);
	for(int t=1;t<=5;t++) {
		int x = rand()%n;
		LL v = solve(a[x]);
		g = max(g, v);
	}
	printf("%I64d\n", g);
	return 0;
}


#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <cstdlib>
#include <map>
using namespace std;

#define FOR(it, c) for(__typeof((c).begin()) it = (c).begin(); it != (c).end(); it++)
#define SZ(c) ((int)(c).size())

typedef long long LL;

const int N = 1000006;
LL a[N];
int n, m;

int C[40][10005];
int R[40][10005];
LL best=0;

void go(LL p[], LL q[], int x, int f, int lev, LL now) {
	int cnt=0;
	for(int i=0;i<m;i++) cnt += C[lev][i];
	if(cnt < (n+1)/2) return;
	best = max(best, now);
	while(x<f) {
		for(int i=0;i<m;i++)
			C[lev+1][i] = (R[x][i]? C[lev][i]: 0);
		go(p, q, x+1, f, lev+1, now*q[x]);
		while(x<f && q[x+1]==q[x]) x++;
		x++;
	}
	return;
}

LL solve(LL L) {
	map<LL, int> d;
	for(int i=0;i<n;i++) d[__gcd(L, a[i])]++;
	m = SZ(d);
	LL p[60]={}, q[60]={}, t = L;
	int f=0;
	for(LL k=2;k*k<=t;k++) {
		if(t%k==0) {
			LL w = k;
			p[f] = w;
			q[f] = k;
			f++;
			t/=k;
			while(t%k==0) { w *= k; q[f] = k; p[f++] = w; t/=k; }
		}
	}
	if(t>1) { q[f] = t; p[f++] = t; }
	vector<pair<LL, int> > r(d.begin(), d.end());
	for(int i=0;i<m;i++) C[0][i] = r[i].second;
	for(int i=0;i<f;i++) for(int j=0;j<m;j++) R[i][j] = (r[j].first%p[i]==0);
	best = 0;
	go(p,q,0,f,0,1);
	return best;
}

inline int RND(int s) {
	return (rand()%1000*1000000+rand()%1000*1000+rand()%1000)%s;
}

int main(void) {
	LL g = 1;
	srand(0);
	scanf("%d", &n);
	for(int i=0;i<n;i++) scanf("%I64d", &a[i]);
	for(int t=1;t<=10;t++) {
		int x = RND(n);
		LL v = solve(a[x]);
		g = max(g, v);
	}
	printf("%I64d\n", g);
	return 0;
}


#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <cstdlib>
#include <map>
using namespace std;

#define FOR(it, c) for(__typeof((c).begin()) it = (c).begin(); it != (c).end(); it++)
#define SZ(c) ((int)(c).size())

typedef long long LL;

const int N = 1000006;
LL a[N];
int n;

vector<LL> S;
int C[40][10005];
int R[40][10005];
LL best=0;

void go(LL p[], LL q[], int x, int f, int lev, LL now) {
	int cnt=0;
	for(int i=0;i<SZ(S);i++) cnt += C[lev][i];
	if(cnt < n/2) return;
	best = max(best, now);
	while(x<f) {
		for(int i=0;i<SZ(S);i++)
			C[lev+1][i] = (R[x][i]? C[lev][i]: 0);
		go(p, q, x+1, f, lev+1, now*q[x]);
		x++;
	}
	return;
}

LL solve(LL L) {
	map<LL, int> d;
	for(int i=0;i<n;i++) d[__gcd(L, a[i])]++;
	int m = SZ(d);
	LL p[60]={}, q[60]={}, t = L;
	int f=0;
	for(LL k=2;k*k<=t;k++) {
		if(t%k==0) {
			LL w = k;
			p[f] = w;
			q[f] = k;
			f++;
			t/=k;
			while(t%k==0) { w *= k; q[f] = k; p[f++] = w; t/=k; }
		}
	}
	if(t>1) p[f++] = t;
	vector<pair<LL, int> > r(d.begin(), d.end());
	S = vector<LL>();
	FOR(it, r) S.push_back(it->first);
	for(int i=0;i<m;i++) C[0][i] = r[i].second;
	for(int i=0;i<f;i++) for(int j=0;j<m;j++) R[i][j] = (S[j]%p[i]==0);
	best = 0;
	go(p,q,0,f,0,1);
	return best;
}

int main(void) {
	LL g = 1;
	srand(0);
	scanf("%d", &n);
	for(int i=0;i<n;i++) scanf("%I64d", &a[i]);
	for(int t=1;t<=5;t++) {
		int x = rand()%n;
		LL v = solve(a[x]);
		g = max(g, v);
	}
	printf("%I64d\n", g);
	return 0;
}


#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <cstdlib>
#include <map>
using namespace std;

#define FOR(it, c) for(__typeof((c).begin()) it = (c).begin(); it != (c).end(); it++)
#define SZ(c) ((int)(c).size())

typedef long long LL;

const int N = 1000006;
LL a[N];
int n;

vector<LL> S;
int C[40][10005];
int R[40][10005];
LL best=0;

void go(LL p[], LL q[], int x, int f, int lev, LL now) {
	int cnt=0;
	for(int i=0;i<SZ(S);i++) cnt += C[lev][i];
	if(cnt < n/2) return;
	best = max(best, now);
	while(x<f) {
		for(int i=0;i<SZ(S);i++)
			C[lev+1][i] = (R[x][i]? C[lev][i]: 0);
		go(p, q, x+1, f, lev+1, now*q[x]);
		x++;
	}
	return;
}

LL solve(LL L) {
	map<LL, int> d;
	for(int i=0;i<n;i++) d[__gcd(L, a[i])]++;
	int m = SZ(d);
	LL p[60]={}, q[60]={}, t = L;
	int f=0;
	for(LL k=2;k*k<=t;k++) {
		if(t%k==0) {
			LL w = k;
			p[f] = w;
			q[f] = k;
			f++;
			t/=k;
			while(t%k==0) { w *= k; q[f] = k; p[f++] = w; t/=k; }
		}
	}
	if(t>1) { q[f] = t; p[f++] = t; }
	vector<pair<LL, int> > r(d.begin(), d.end());
	S = vector<LL>();
	FOR(it, r) S.push_back(it->first);
	for(int i=0;i<m;i++) C[0][i] = r[i].second;
	for(int i=0;i<f;i++) for(int j=0;j<m;j++) R[i][j] = (S[j]%p[i]==0);
	best = 0;
	go(p,q,0,f,0,1);
	return best;
}

int main(void) {
	LL g = 1;
	srand(0);
	scanf("%d", &n);
	for(int i=0;i<n;i++) scanf("%I64d", &a[i]);
	for(int t=1;t<=5;t++) {
		int x = rand()%n;
		LL v = solve(a[x]);
		g = max(g, v);
	}
	printf("%I64d\n", g);
	return 0;
}


/*******************\
|* # By longbiau # *|
\*******************/

// #include C {
#include<cstring>
#include<cassert>
#include<cstdio>
#include<cctype>
#include<cmath>
// }

// #include C++ {
#include<functional>
#include<algorithm>
#include<iostream>
#include<vector>
#include<string>
#include<bitset>
#include<queue>
#include<deque>
#include<stack>
#include<list>
#include<map>
#include<set>
// }
using namespace std;
// #typedef {
typedef long long int64;
typedef unsigned long long uint64;
typedef pair <int, int> PII;
typedef pair <int64, int64> PLL;
typedef pair <char, char> PCC;
typedef pair <double, double> PDD;
// }
#ifndef ONLINE_JUDGE
// #parameter{
#define TYPE decltype
/////////////////////////////////////////////////////////////
#else
/////////////////////////////////////////////////////////////
#define TYPE __typeof
// }
#endif
// #define {
#define MP make_pair
#define PB push_back
#define SZ(a) ((int)(a).size())
#define X first
#define Y second
#define L(x) ((x)<<1)
#define R(x) ((x)<<1 | 1)
#define max3(x, y, z) (max(max((x), (y)), (z)))
#define min3(x, y, z) (min(min((x), (y)), (z)))
#define BIT(x, i) (((x) >> (i)) & 1)
#define FOR(it, c) for( TYPE((c).begin()) it = (c).begin(); it != (c).end(); it++)
/////////////////////////////////////////////////////////////
const double PI = 2.0*acos(0.0);
const double EPS = 1e-6;

#define GREATER(x, y) ((x) > (y) + EPS)
#define GREATER_EQUAL(x, y) ((x) > (y) - EPS)
#define LESS(x, y) ((x) < (y) - EPS)
#define LESS_EQUAL(x, y) ((x) < (y) + EPS)
#define EQUAL(x, y) (abs((x) - (y)) < EPS)

#define MAX_N 1000005
#define MAXX 0x3f
#define MAX 3000005
#define UPPER 2147483647LL
#define INF (1<<29)
#define NONE -1
#define NIL 0
// }

/////////////////////////////////////////////////////////////
int64 a[MAX_N];
int64 gcd(int64 a, int64 b){
    for(int64 tmp=a%b; tmp>0; tmp=a%b){
        a = b;
        b = tmp;
    }
    return b;
}
int64 dvs[MAX_N];
int64 cnt[MAX_N];
/////////////////////////////////////////////////////////////
int main(){
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif

    int n;
    scanf("%d", &n);
    for(int i=0; i<n; i++)
        scanf("%I64d", a+i);
    const int HALF = (n+1)>>1;
    int64 res = 0LL;
    for(int t=0; t<12; t++){
        int ndvs = 0, ncnt = 0;
        int64 x = a[(int64)rand()*rand()%n];
        for(int64 i=1; i*i<=x; i++){
            if(x%i == 0){
                dvs[ndvs++] = i;
                if(i*i < x)
                    dvs[ndvs++] = x/i;
            }
        }
        sort(dvs, dvs+ndvs);
        memset(cnt, 0, sizeof(int64)*ndvs);
        for(int i=0; i<n; i++)
            cnt[lower_bound(dvs, dvs+ndvs, gcd(a[i], x))-dvs]++;
        for(int i=0; i<ndvs; i++){
            for(int j=i+1; j<ndvs; j++)
                if(dvs[j]%dvs[i] == 0)
                    cnt[i] += cnt[j];
            if(cnt[i] >= HALF)
                res = max(res, dvs[i]);
        }
    }
    printf("%I64d\n", res);
    return 0;
}


/*******************\
|* # By longbiau # *|
\*******************/

// #include C {
#include<cstring>
#include<cassert>
#include<cstdio>
#include<cctype>
#include<cmath>
// }

// #include C++ {
#include<functional>
#include<algorithm>
#include<iostream>
#include<vector>
#include<string>
#include<bitset>
#include<queue>
#include<deque>
#include<stack>
#include<list>
#include<map>
#include<set>
// }
using namespace std;
// #typedef {
typedef long long int64;
typedef unsigned long long uint64;
typedef pair <int, int> PII;
typedef pair <int64, int64> PLL;
typedef pair <char, char> PCC;
typedef pair <double, double> PDD;
// }
#ifndef ONLINE_JUDGE
// #parameter{
#define TYPE decltype
/////////////////////////////////////////////////////////////
#else
/////////////////////////////////////////////////////////////
#define TYPE __typeof
// }
#endif
// #define {
#define MP make_pair
#define PB push_back
#define SZ(a) ((int)(a).size())
#define X first
#define Y second
#define L(x) ((x)<<1)
#define R(x) ((x)<<1 | 1)
#define max3(x, y, z) (max(max((x), (y)), (z)))
#define min3(x, y, z) (min(min((x), (y)), (z)))
#define BIT(x, i) (((x) >> (i)) & 1)
#define FOR(it, c) for( TYPE((c).begin()) it = (c).begin(); it != (c).end(); it++)
/////////////////////////////////////////////////////////////
const double PI = 2.0*acos(0.0);
const double EPS = 1e-6;

#define GREATER(x, y) ((x) > (y) + EPS)
#define GREATER_EQUAL(x, y) ((x) > (y) - EPS)
#define LESS(x, y) ((x) < (y) - EPS)
#define LESS_EQUAL(x, y) ((x) < (y) + EPS)
#define EQUAL(x, y) (abs((x) - (y)) < EPS)

#define MAX_N 1000005
#define MAXX 0x3f
#define MAX 3000005
#define UPPER 2147483647LL
#define INF (1<<29)
#define NONE -1
#define NIL 0
// }

/////////////////////////////////////////////////////////////
int64 a[MAX_N];
int64 gcd(int64 a, int64 b){
    for(int64 tmp=a%b; tmp>0; tmp=a%b){
        a = b;
        b = tmp;
    }
    return b;
}
int64 dvs[MAX_N];
int64 cnt[MAX_N];
/////////////////////////////////////////////////////////////
int main(){
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif

    int n;
    scanf("%d", &n);
    for(int i=0; i<n; i++)
        scanf("%d", a+i);
    const int HALF = (n+1)>>1;
    int64 res = 0LL;
    for(int t=0; t<10; t++){
        int ndvs = 0, ncnt = 0;
        int64 x = a[(int64)rand()*rand()%n];
        for(int64 i=1; i*i<=x; i++){
            if(x%i == 0){
                dvs[ndvs++] = i;
                if(i*i < x)
                    dvs[ndvs++] = x/i;
            }
        }
        sort(dvs, dvs+ndvs);
        fill(cnt, cnt+ndvs, 0);
        for(int i=0; i<n; i++)
            cnt[lower_bound(dvs, dvs+ndvs, gcd(a[i], x))-dvs]++;
        for(int i=0; i<ndvs; i++){
            for(int j=i+1; j<ndvs; j++)
                if(dvs[j]%dvs[i] == 0)
                    cnt[i] += cnt[j];
            if(cnt[i] >= HALF)
                res = max(res, dvs[i]);
        }
    }
    printf("%I64d\n", res);
    return 0;
}


/*******************\
|* # By longbiau # *|
\*******************/

// #include C {
#include<cstring>
#include<cassert>
#include<cstdio>
#include<cctype>
#include<cmath>
// }

// #include C++ {
#include<functional>
#include<algorithm>
#include<iostream>
#include<vector>
#include<string>
#include<bitset>
#include<queue>
#include<deque>
#include<stack>
#include<list>
#include<map>
#include<set>
// }
using namespace std;
// #typedef {
typedef long long int64;
typedef unsigned long long uint64;
typedef pair <int, int> PII;
typedef pair <int64, int64> PLL;
typedef pair <char, char> PCC;
typedef pair <double, double> PDD;
// }
#ifndef ONLINE_JUDGE
// #parameter{
#define TYPE decltype
/////////////////////////////////////////////////////////////
#else
/////////////////////////////////////////////////////////////
#define TYPE __typeof
// }
#endif
// #define {
#define MP make_pair
#define PB push_back
#define SZ(a) ((int)(a).size())
#define X first
#define Y second
#define L(x) ((x)<<1)
#define R(x) ((x)<<1 | 1)
#define max3(x, y, z) (max(max((x), (y)), (z)))
#define min3(x, y, z) (min(min((x), (y)), (z)))
#define BIT(x, i) (((x) >> (i)) & 1)
#define FOR(it, c) for( TYPE((c).begin()) it = (c).begin(); it != (c).end(); it++)
/////////////////////////////////////////////////////////////
const double PI = 2.0*acos(0.0);
const double EPS = 1e-6;

#define GREATER(x, y) ((x) > (y) + EPS)
#define GREATER_EQUAL(x, y) ((x) > (y) - EPS)
#define LESS(x, y) ((x) < (y) - EPS)
#define LESS_EQUAL(x, y) ((x) < (y) + EPS)
#define EQUAL(x, y) (abs((x) - (y)) < EPS)

#define MAX_N 1000005
#define MAXX 0x3f
#define MAX 3000005
#define UPPER 2147483647LL
#define INF (1<<29)
#define NONE -1
#define NIL 0
// }

/////////////////////////////////////////////////////////////
int64 a[MAX_N];
int64 gcd(int64 a, int64 b){
    for(int64 tmp=a%b; tmp>0; tmp=a%b){
        a = b;
        b = tmp;
    }
    return b;
}
int64 dvs[MAX_N];
int64 cnt[MAX_N];
/////////////////////////////////////////////////////////////
int main(){
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif

    int n;
    scanf("%d", &n);
    for(int i=0; i<n; i++)
        scanf("%I64d", a+i);
    const int HALF = (n+1)>>1;
    int64 res = 0LL;
    for(int t=0; t<12; t++){
        int ndvs = 0, ncnt = 0;
        int64 x = a[(int64)rand()*rand()%n];
        for(int64 i=1; i*i<=x; i++){
            if(x%i == 0){
                dvs[ndvs++] = i;
                if(i*i < x)
                    dvs[ndvs++] = x/i;
            }
        }
        sort(dvs, dvs+ndvs);
        fill(cnt, cnt+ndvs, 0);
        for(int i=0; i<n; i++)
            cnt[lower_bound(dvs, dvs+ndvs, gcd(a[i], x))-dvs]++;
        for(int i=0; i<ndvs; i++){
            for(int j=i+1; j<ndvs; j++)
                if(dvs[j]%dvs[i] == 0)
                    cnt[i] += cnt[j];
            if(cnt[i] >= HALF)
                res = max(res, dvs[i]);
        }
    }
    printf("%I64d\n", res);
    return 0;
}


/*******************\
|* # By longbiau # *|
\*******************/

// #include C {
#include<cstring>
#include<cassert>
#include<cstdio>
#include<cctype>
#include<cmath>
// }

// #include C++ {
#include<functional>
#include<algorithm>
#include<iostream>
#include<vector>
#include<string>
#include<bitset>
#include<queue>
#include<deque>
#include<stack>
#include<list>
#include<map>
#include<set>
// }
using namespace std;
// #typedef {
typedef long long int64;
typedef unsigned long long uint64;
typedef pair <int, int> PII;
typedef pair <int64, int64> PLL;
typedef pair <char, char> PCC;
typedef pair <double, double> PDD;
// }
#ifndef ONLINE_JUDGE
// #parameter{
#define TYPE decltype
/////////////////////////////////////////////////////////////
#else
/////////////////////////////////////////////////////////////
#define TYPE __typeof
// }
#endif
// #define {
#define MP make_pair
#define PB push_back
#define SZ(a) ((int)(a).size())
#define X first
#define Y second
#define L(x) ((x)<<1)
#define R(x) ((x)<<1 | 1)
#define max3(x, y, z) (max(max((x), (y)), (z)))
#define min3(x, y, z) (min(min((x), (y)), (z)))
#define BIT(x, i) (((x) >> (i)) & 1)
#define FOR(it, c) for( TYPE((c).begin()) it = (c).begin(); it != (c).end(); it++)
/////////////////////////////////////////////////////////////
const double PI = 2.0*acos(0.0);
const double EPS = 1e-6;

#define GREATER(x, y) ((x) > (y) + EPS)
#define GREATER_EQUAL(x, y) ((x) > (y) - EPS)
#define LESS(x, y) ((x) < (y) - EPS)
#define LESS_EQUAL(x, y) ((x) < (y) + EPS)
#define EQUAL(x, y) (abs((x) - (y)) < EPS)

#define MAX_N 1000005
#define MAXX 0x3f
#define MAX 3000005
#define UPPER 2147483647LL
#define INF (1<<29)
#define NONE -1
#define NIL 0
// }

/////////////////////////////////////////////////////////////
int64 a[MAX_N];
int64 gcd(int64 a, int64 b){
    for(int64 tmp=a%b; tmp>0; tmp=a%b){
        a = b;
        b = tmp;
    }
    return b;
}
/////////////////////////////////////////////////////////////
int main(){
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif

    int n;
    scanf("%d", &n);
    for(int i=0; i<n; i++)
        scanf("%d", a+i);
    const int HALF = (n+1)>>1;
    int64 res = 0LL;
    for(int t=0; t<12; t++){
        int64 x = a[(int64)rand()*rand()%n];
        vector <int64> divisor;
        for(int i=1; i*i<=x; i++){
            if(x%i == 0){
                divisor.PB(i);
                if(i*i < x)
                    divisor.PB(x/i);
            }
        }
        vector <int64> cnt(SZ(divisor));
        sort(divisor.begin(), divisor.end());
        fill(cnt.begin(), cnt.end(), 0);

        for(int i=0; i<n; i++)
            cnt[lower_bound(divisor.begin(), divisor.end(), gcd(a[i], x))-divisor.begin()]++;
        for(int i=0; i<SZ(divisor); i++){
            for(int j=i+1; j<SZ(divisor); j++)
                if(divisor[j]%divisor[i] == 0)
                    cnt[i] += cnt[j];
            if(cnt[i] >= HALF)
                res = max(res, divisor[i]);
        }
    }
    printf("%I64d\n", res);
    return 0;
}


/*******************\
|* # By longbiau # *|
\*******************/

// #include C {
#include<cstring>
#include<cassert>
#include<cstdio>
#include<cctype>
#include<cmath>
// }

// #include C++ {
#include<functional>
#include<algorithm>
#include<iostream>
#include<vector>
#include<string>
#include<bitset>
#include<queue>
#include<deque>
#include<stack>
#include<list>
#include<map>
#include<set>
// }
using namespace std;
// #typedef {
typedef long long int64;
typedef unsigned long long uint64;
typedef pair <int, int> PII;
typedef pair <int64, int64> PLL;
typedef pair <char, char> PCC;
typedef pair <double, double> PDD;
// }
#ifndef ONLINE_JUDGE
// #parameter{
#define TYPE decltype
/////////////////////////////////////////////////////////////
#else
/////////////////////////////////////////////////////////////
#define TYPE __typeof
// }
#endif
// #define {
#define MP make_pair
#define PB push_back
#define SZ(a) ((int)(a).size())
#define X first
#define Y second
#define L(x) ((x)<<1)
#define R(x) ((x)<<1 | 1)
#define max3(x, y, z) (max(max((x), (y)), (z)))
#define min3(x, y, z) (min(min((x), (y)), (z)))
#define BIT(x, i) (((x) >> (i)) & 1)
#define FOR(it, c) for( TYPE((c).begin()) it = (c).begin(); it != (c).end(); it++)
/////////////////////////////////////////////////////////////
const double PI = 2.0*acos(0.0);
const double EPS = 1e-6;

#define GREATER(x, y) ((x) > (y) + EPS)
#define GREATER_EQUAL(x, y) ((x) > (y) - EPS)
#define LESS(x, y) ((x) < (y) - EPS)
#define LESS_EQUAL(x, y) ((x) < (y) + EPS)
#define EQUAL(x, y) (abs((x) - (y)) < EPS)

#define MAX_N 1000005
#define MAXX 0x3f
#define MAX 3000005
#define UPPER 2147483647LL
#define INF (1<<29)
#define NONE -1
#define NIL 0
// }

/////////////////////////////////////////////////////////////
int64 a[MAX_N];
int64 gcd(int64 a, int64 b){
    for(int64 tmp=a%b; tmp>0; tmp=a%b){
        a = b;
        b = tmp;
    }
    return b;
}
/////////////////////////////////////////////////////////////
int main(){
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif

    int n;
    scanf("%d", &n);
    for(int i=0; i<n; i++)
        scanf("%I64d", a+i);
    const int64 HALF = (n+1LL)>>1;
    int64 res = 0LL;
    for(int t=0; t<12; t++){
        int64 x = a[(int64)rand()*rand()%n];
        vector <int64> divisor;
        for(int64 i=1; i*i<=x; i++){
            if(x%i == 0){
                divisor.PB(i);
                if(i*i < x)
                    divisor.PB(x/i);
            }
        }
        vector <int64> cnt(SZ(divisor));
        sort(divisor.begin(), divisor.end());
        fill(cnt.begin(), cnt.end(), 0);

        for(int i=0; i<n; i++)
            cnt[lower_bound(divisor.begin(), divisor.end(), gcd(a[i], x))-divisor.begin()]++;
        for(int i=0; i<SZ(divisor); i++){
            for(int j=i+1; j<SZ(divisor); j++)
                if(divisor[j]%divisor[i] == 0)
                    cnt[i] += cnt[j];
            if(cnt[i] >= HALF)
                res = max(res, divisor[i]);
        }
    }
    printf("%I64d\n", res);
    return 0;
}


/*******************\
|* # By longbiau # *|
\*******************/

// #include C {
#include<cstring>
#include<cassert>
#include<cstdio>
#include<cctype>
#include<cmath>
// }

// #include C++ {
#include<functional>
#include<algorithm>
#include<iostream>
#include<vector>
#include<string>
#include<bitset>
#include<queue>
#include<deque>
#include<stack>
#include<list>
#include<map>
#include<set>
// }
using namespace std;
// #typedef {
typedef long long int64;
typedef unsigned long long uint64;
typedef pair <int, int> PII;
typedef pair <int64, int64> PLL;
typedef pair <char, char> PCC;
typedef pair <double, double> PDD;
// }
#ifndef ONLINE_JUDGE
// #parameter{
#define TYPE decltype
/////////////////////////////////////////////////////////////
#else
/////////////////////////////////////////////////////////////
#define TYPE __typeof
// }
#endif
// #define {
#define MP make_pair
#define PB push_back
#define SZ(a) ((int)(a).size())
#define X first
#define Y second
#define L(x) ((x)<<1)
#define R(x) ((x)<<1 | 1)
#define max3(x, y, z) (max(max((x), (y)), (z)))
#define min3(x, y, z) (min(min((x), (y)), (z)))
#define BIT(x, i) (((x) >> (i)) & 1)
#define FOR(it, c) for( TYPE((c).begin()) it = (c).begin(); it != (c).end(); it++)
/////////////////////////////////////////////////////////////
const double PI = 2.0*acos(0.0);
const double EPS = 1e-6;

#define GREATER(x, y) ((x) > (y) + EPS)
#define GREATER_EQUAL(x, y) ((x) > (y) - EPS)
#define LESS(x, y) ((x) < (y) - EPS)
#define LESS_EQUAL(x, y) ((x) < (y) + EPS)
#define EQUAL(x, y) (abs((x) - (y)) < EPS)

#define MAX_N 1000005
#define MAXX 0x3f
#define MAX 3000005
#define UPPER 2147483647LL
#define INF (1<<29)
#define NONE -1
#define NIL 0
// }

/////////////////////////////////////////////////////////////
int64 a[MAX_N];
int64 gcd(int64 a, int64 b){
    for(int64 tmp=a%b; tmp>0; tmp=a%b){
        a = b;
        b = tmp;
    }
    return b;
}
/////////////////////////////////////////////////////////////
int main(){
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif

    int n;
    scanf("%d", &n);
    for(int i=0; i<n; i++)
        scanf("%I64d", a+i);
    const int64 HALF = (n+1LL)>>1;
    int64 res = 0LL;
    for(int t=0; t<11; t++){
        int64 x = a[(int64)rand()*rand()%n];
        vector <int64> divisor;
        for(int64 i=1; i*i<=x; i++){
            if(x%i == 0){
                divisor.PB(i);
                if(i*i < x)
                    divisor.PB(x/i);
            }
        }
        vector <int64> cnt(SZ(divisor));
        sort(divisor.begin(), divisor.end());
        fill(cnt.begin(), cnt.end(), 0);

        for(int i=0; i<n; i++)
            cnt[lower_bound(divisor.begin(), divisor.end(), gcd(a[i], x))-divisor.begin()]++;
        for(int i=0; i<SZ(divisor); i++){
            for(int j=i+1; j<SZ(divisor); j++)
                if(divisor[j]%divisor[i] == 0)
                    cnt[i] += cnt[j];
            if(cnt[i] >= HALF)
                res = max(res, divisor[i]);
        }
    }
    printf("%I64d\n", res);
    return 0;
}


/*******************\
|* # By longbiau # *|
\*******************/

// #include C {
#include<cstring>
#include<cassert>
#include<cstdio>
#include<cctype>
#include<cmath>
// }

// #include C++ {
#include<functional>
#include<algorithm>
#include<iostream>
#include<vector>
#include<string>
#include<bitset>
#include<queue>
#include<deque>
#include<stack>
#include<list>
#include<map>
#include<set>
// }
using namespace std;
// #typedef {
typedef long long int64;
typedef unsigned long long uint64;
typedef pair <int, int> PII;
typedef pair <int64, int64> PLL;
typedef pair <char, char> PCC;
typedef pair <double, double> PDD;
// }
#ifndef ONLINE_JUDGE
// #parameter{
#define TYPE decltype
/////////////////////////////////////////////////////////////
#else
/////////////////////////////////////////////////////////////
#define TYPE __typeof
// }
#endif
// #define {
#define MP make_pair
#define PB push_back
#define SZ(a) ((int)(a).size())
#define X first
#define Y second
#define L(x) ((x)<<1)
#define R(x) ((x)<<1 | 1)
#define max3(x, y, z) (max(max((x), (y)), (z)))
#define min3(x, y, z) (min(min((x), (y)), (z)))
#define BIT(x, i) (((x) >> (i)) & 1)
#define FOR(it, c) for( TYPE((c).begin()) it = (c).begin(); it != (c).end(); it++)
/////////////////////////////////////////////////////////////
const double PI = 2.0*acos(0.0);
const double EPS = 1e-6;

#define GREATER(x, y) ((x) > (y) + EPS)
#define GREATER_EQUAL(x, y) ((x) > (y) - EPS)
#define LESS(x, y) ((x) < (y) - EPS)
#define LESS_EQUAL(x, y) ((x) < (y) + EPS)
#define EQUAL(x, y) (abs((x) - (y)) < EPS)

#define MAX_N 1000005
#define MAXX 0x3f
#define MAX 3000005
#define UPPER 2147483647LL
#define INF (1<<29)
#define NONE -1
#define NIL 0
// }

/////////////////////////////////////////////////////////////
int64 a[MAX_N];
int64 gcd(int64 a, int64 b){
    for(int64 tmp=a%b; tmp>0; tmp=a%b){
        a = b;
        b = tmp;
    }
    return b;
}
int64 dvs[MAX_N];
int64 cnt[MAX_N];
/////////////////////////////////////////////////////////////
int main(){
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif

    int n;
    scanf("%d", &n);
    for(int i=0; i<n; i++)
        scanf("%d", a+i);
    const int HALF = (n+1)>>1;
    int64 res = 0LL;
    for(int t=0; t<12; t++){
        int ndvs = 0, ncnt = 0;
        int64 x = a[(int64)rand()*rand()%n];
        for(int64 i=1; i*i<=x; i++){
            if(x%i == 0){
                dvs[ndvs++] = i;
                if(i*i < x)
                    dvs[ndvs++] = x/i;
            }
        }
        sort(dvs, dvs+ndvs);
        fill(cnt, cnt+ndvs, 0);
        for(int i=0; i<n; i++)
            cnt[lower_bound(dvs, dvs+ndvs, gcd(a[i], x))-dvs]++;
        for(int i=0; i<ndvs; i++){
            for(int j=i+1; j<ndvs; j++)
                if(dvs[j]%dvs[i] == 0)
                    cnt[i] += cnt[j];
            if(cnt[i] >= HALF)
                res = max(res, dvs[i]);
        }
    }
    printf("%I64d\n", res);
    return 0;
}


/*******************\
|* # By longbiau # *|
\*******************/

// #include C {
#include<cstring>
#include<cassert>
#include<cstdio>
#include<cctype>
#include<cmath>
// }

// #include C++ {
#include<functional>
#include<algorithm>
#include<iostream>
#include<vector>
#include<string>
#include<bitset>
#include<queue>
#include<deque>
#include<stack>
#include<list>
#include<map>
#include<set>
// }
using namespace std;
// #typedef {
typedef long long int64;
typedef unsigned long long uint64;
typedef pair <int, int> PII;
typedef pair <int64, int64> PLL;
typedef pair <char, char> PCC;
typedef pair <double, double> PDD;
// }
#ifndef ONLINE_JUDGE
// #parameter{
#define TYPE decltype
/////////////////////////////////////////////////////////////
#else
/////////////////////////////////////////////////////////////
#define TYPE __typeof
// }
#endif
// #define {
#define MP make_pair
#define PB push_back
#define SZ(a) ((int)(a).size())
#define X first
#define Y second
#define L(x) ((x)<<1)
#define R(x) ((x)<<1 | 1)
#define max3(x, y, z) (max(max((x), (y)), (z)))
#define min3(x, y, z) (min(min((x), (y)), (z)))
#define BIT(x, i) (((x) >> (i)) & 1)
#define FOR(it, c) for( TYPE((c).begin()) it = (c).begin(); it != (c).end(); it++)
/////////////////////////////////////////////////////////////
const double PI = 2.0*acos(0.0);
const double EPS = 1e-6;

#define GREATER(x, y) ((x) > (y) + EPS)
#define GREATER_EQUAL(x, y) ((x) > (y) - EPS)
#define LESS(x, y) ((x) < (y) - EPS)
#define LESS_EQUAL(x, y) ((x) < (y) + EPS)
#define EQUAL(x, y) (abs((x) - (y)) < EPS)

#define MAX_N 1000005
#define MAXX 0x3f
#define MAX 3000005
#define UPPER 2147483647LL
#define INF (1<<29)
#define NONE -1
#define NIL 0
// }

/////////////////////////////////////////////////////////////
int64 a[MAX_N];
int64 gcd(int64 a, int64 b){
    for(int64 tmp=a%b; tmp>0; tmp=a%b){
        a = b;
        b = tmp;
    }
    return b;
}
int64 dvs[MAX_N];
int64 cnt[MAX_N];
/////////////////////////////////////////////////////////////
int main(){
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif

    int n;
    scanf("%d", &n);
    for(int i=0; i<n; i++)
        scanf("%I64d", a+i);
    const int HALF = (n+1)>>1;
    int64 res = 0LL;
    for(int t=0; t<8; t++){
        int ndvs = 0, ncnt = 0;
        int64 x = a[(int64)rand()*rand()%n];
        for(int64 i=1; i*i<=x; i++){
            if(x%i == 0){
                dvs[ndvs++] = i;
                if(i*i < x)
                    dvs[ndvs++] = x/i;
            }
        }
        sort(dvs, dvs+ndvs);
        fill(cnt, cnt+ndvs, 0);
        for(int i=0; i<n; i++)
            cnt[lower_bound(dvs, dvs+ndvs, gcd(a[i], x))-dvs]++;
        for(int i=0; i<ndvs; i++){
            for(int j=i+1; j<ndvs; j++)
                if(dvs[j]%dvs[i] == 0)
                    cnt[i] += cnt[j];
            if(cnt[i] >= HALF)
                res = max(res, dvs[i]);
        }
    }
    printf("%I64d\n", res);
    return 0;
}


/*******************\
|* # By longbiau # *|
\*******************/

// #include C {
#include<cstring>
#include<cassert>
#include<cstdio>
#include<cctype>
#include<cmath>
// }

// #include C++ {
#include<functional>
#include<algorithm>
#include<iostream>
#include<vector>
#include<string>
#include<bitset>
#include<queue>
#include<deque>
#include<stack>
#include<list>
#include<map>
#include<set>
// }
using namespace std;
// #typedef {
typedef long long int64;
typedef unsigned long long uint64;
typedef pair <int, int> PII;
typedef pair <int64, int64> PLL;
typedef pair <char, char> PCC;
typedef pair <double, double> PDD;
// }
#ifndef ONLINE_JUDGE
// #parameter{
#define TYPE decltype
/////////////////////////////////////////////////////////////
#else
/////////////////////////////////////////////////////////////
#define TYPE __typeof
// }
#endif
// #define {
#define MP make_pair
#define PB push_back
#define SZ(a) ((int)(a).size())
#define X first
#define Y second
#define L(x) ((x)<<1)
#define R(x) ((x)<<1 | 1)
#define max3(x, y, z) (max(max((x), (y)), (z)))
#define min3(x, y, z) (min(min((x), (y)), (z)))
#define BIT(x, i) (((x) >> (i)) & 1)
#define FOR(it, c) for( TYPE((c).begin()) it = (c).begin(); it != (c).end(); it++)
/////////////////////////////////////////////////////////////
const double PI = 2.0*acos(0.0);
const double EPS = 1e-6;

#define GREATER(x, y) ((x) > (y) + EPS)
#define GREATER_EQUAL(x, y) ((x) > (y) - EPS)
#define LESS(x, y) ((x) < (y) - EPS)
#define LESS_EQUAL(x, y) ((x) < (y) + EPS)
#define EQUAL(x, y) (abs((x) - (y)) < EPS)

#define MAX_N 1000005
#define MAXX 0x3f
#define MAX 3000005
#define UPPER 2147483647LL
#define INF (1<<29)
#define NONE -1
#define NIL 0
// }

/////////////////////////////////////////////////////////////
int64 a[MAX_N];
int64 gcd(int64 a, int64 b){
    for(int64 tmp=a%b; tmp>0; tmp=a%b){
        a = b;
        b = tmp;
    }
    return b;
}
int64 dvs[MAX_N];
int64 cnt[MAX_N];
/////////////////////////////////////////////////////////////
int main(){
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif

    int n;
    scanf("%d", &n);
    for(int i=0; i<n; i++)
        scanf("%d", a+i);
    const int HALF = (n+1)>>1;
    int64 res = 0LL;
    for(int t=0; t<10; t++){
        int ndvs = 0, ncnt = 0;
        int64 x = a[(int64)rand()*rand()%n];
        for(int i=1; i*i<=x; i++){
            if(x%i == 0){
                dvs[ndvs++] = i;
                if(i*i < x)
                    dvs[ndvs++] = x/i;
            }
        }
        sort(dvs, dvs+ndvs);
        memset(cnt, 0, sizeof(int64)*(ndvs));
        for(int i=0; i<n; i++)
            cnt[lower_bound(dvs, dvs+ndvs, gcd(a[i], x))-dvs]++;
        for(int i=0; i<ndvs; i++){
            for(int j=i+1; j<ndvs; j++)
                if(dvs[j]%dvs[i] == 0)
                    cnt[i] += cnt[j];
            if(cnt[i] >= HALF)
                res = max(res, dvs[i]);
        }
    }
    printf("%I64d\n", res);
    return 0;
}


#include <bits/stdc++.h>

using namespace std ;

const int maxn = 1e6 + 10 ; // maximum number of numbers
const int maxk = 7e3 + 10 ; // maximum number of divisors
const int maxp = 9 ;       // maximum number of random numbers
long long a[maxn] , divi[maxk] ;
int n , c[maxk] , cnt_div ;

int main()
{
	//ios_base::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0) ;
	srand(110) ;
	long long ans = 0 ;
	cin >> n ;
	for(int i = 0 ; i < n ; i++){
		//cin >> a[i] ;
		scanf("%I64D" , &a[i]) ;
	}
	sort(a , a + n) ;
	for(int pc = 0 ; pc < min(maxp , n) ; pc++){
		long long x = a[pc] ;
		cnt_div = 0 ;
		for(int j = 1 ; (long long)j * j <= x ; j++){
			if(x % j == 0){
				divi[cnt_div++] = j ;
				if((long long)j * j != x)
					divi[cnt_div++] = x / j ;
			}
		}
		sort(divi , divi + cnt_div) ; memset(c , 0 , sizeof c) ;
		for(int j = 0 ; j < n ; j++){
			long long GCD = __gcd(x , a[j]) ;
			int idx = lower_bound(divi , divi + cnt_div , GCD) - divi ;
			c[idx]++ ;
		}
		for(int i = 0 ; i < cnt_div ; i++){
			int cnt = 0 ;
			for(int j = i ; j < cnt_div ; j++)
				if(divi[j] % divi[i] == 0)
					cnt += c[j] ;
			if(2 * cnt >= n)
				ans = max(divi[i] , ans) ;
		}
	}
	cout << ans << endl ;
	return 0 ;
}


#include <bits/stdc++.h>

using namespace std ;

const int maxn = 1e6 + 10 ; // maximum number of numbers
const int maxk = 7e3 + 10 ; // maximum number of divisors
const int maxp = 9 ;       // maximum number of random numbers
long long a[maxn] , divi[maxk] ;
int n , c[maxk] , cnt_div ;

int main()
{
	//ios_base::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0) ;
	srand(110) ;
	long long ans = 0 ;
	cin >> n ;
	for(int i = 0 ; i < n ; i++){
		//cin >> a[i] ;
		scanf("%I64D" , &a[i]) ;
		b[i] = a[i] ;
	}
	sort(a , a + n) ;
	for(int pc = 0 ; pc < min(maxp , n) ; pc++){
		long long x = a[pc] ;
		cnt_div = 0 ;
		for(int j = 1 ; (long long)j * j <= x ; j++){
			if(x % j == 0){
				divi[cnt_div++] = j ;
				if((long long)j * j != x)
					divi[cnt_div++] = x / j ;
			}
		}
		sort(divi , divi + cnt_div) ; memset(c , 0 , sizeof c) ;
		for(int j = 0 ; j < n ; j++){
			long long GCD = __gcd(x , a[j]) ;
			int idx = lower_bound(divi , divi + cnt_div , GCD) - divi ;
			c[idx]++ ;
		}
		for(int i = 0 ; i < cnt_div ; i++){
			int cnt = 0 ;
			for(int j = i ; j < cnt_div ; j++)
				if(divi[j] % divi[i] == 0)
					cnt += c[j] ;
			if(2 * cnt >= n)
				ans = max(divi[i] , ans) ;
		}
	}
	cout << ans << endl ;
	return 0 ;
}


#include <bits/stdc++.h>

using namespace std ;

const int maxn = 1e6 + 10 ; // maximum number of numbers
const int maxk = 7e3 + 10 ; // maximum number of divisors
const int maxp = 10 ;       // maximum number of random numbers
long long a[maxn] , divi[maxk] ;
int n , c[maxk] , cnt_div ;

int main()
{
	long long ans = 0 ;
	ios_base::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0) ;
	cin >> n ;
	for(int i = 0 ; i < n ; i++)
		cin >> a[i] ;
	random_shuffle(a , a + n) ;
	for(int pc = 0 ; pc < min(maxp , n) ; pc++){
		long long x = a[pc] ;
		cnt_div = 0 ;
		for(int j = 1 ; (long long)j * j <= x ; j++){
			if(x % j == 0){
				divi[cnt_div++] = j ;
				if((long long)j * j != x)
					divi[cnt_div++] = x / j ;
			}
		}
		sort(divi , divi + cnt_div) ; memset(c , 0 , sizeof c) ;
		for(int j = 0 ; j < n ; j++){
			long long GCD = __gcd(x , a[j]) ;
			int idx = lower_bound(divi , divi + cnt_div , GCD) - divi ;
			c[idx]++ ;
		}
		for(int i = 0 ; i < cnt_div ; i++){
			int cnt = 0 ;
			for(int j = i ; j < cnt_div ; j++)
				if(divi[j] % divi[i] == 0)
					cnt += c[j] ;
			if(2 * cnt >= n)
				ans = max(divi[i] , ans) ;
		}
	}
	cout << ans << endl ;
	return 0 ;
}


#include <bits/stdc++.h>

using namespace std ;

const int maxn = 1e6 + 10 ; // maximum number of numbers
const int maxk = 7e3 + 10 ; // maximum number of divisors
const int maxp = 9 ;       // maximum number of random numbers
long long a[maxn] , divi[maxk] ;
int n , c[maxk] , cnt_div ;

int main()
{
	long long ans = 0 ;
	ios_base::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0) ;
	cin >> n ;
	for(int i = 0 ; i < n ; i++)
		cin >> a[i] ;
	random_shuffle(a , a + n) ;
	for(int pc = 0 ; pc < min(maxp , n) ; pc++){
		long long x = a[pc] ;
		cnt_div = 0 ;
		for(int j = 1 ; (long long)j * j <= x ; j++){
			if(x % j == 0){
				divi[cnt_div++] = j ;
				if((long long)j * j != x)
					divi[cnt_div++] = x / j ;
			}
		}
		sort(divi , divi + cnt_div) ; memset(c , 0 , sizeof c) ;
		for(int j = 0 ; j < n ; j++){
			long long GCD = __gcd(x , a[j]) ;
			int idx = lower_bound(divi , divi + cnt_div , GCD) - divi ;
			c[idx]++ ;
		}
		for(int i = 0 ; i < cnt_div ; i++){
			int cnt = 0 ;
			for(int j = i ; j < cnt_div ; j++)
				if(divi[j] % divi[i] == 0)
					cnt += c[j] ;
			if(2 * cnt >= n)
				ans = max(divi[i] , ans) ;
		}
	}
	cout << ans << endl ;
	return 0 ;
}


#include <bits/stdc++.h>

using namespace std ;

const int maxn = 1e6 + 10 ; // maximum number of numbers
const int maxk = 7e3 + 10 ; // maximum number of divisors
const int maxp = 13 ;       // maximum number of random numbers
long long a[maxn] , divi[maxk] ;
int n , c[maxk] , cnt_div ;

int main()
{
	long long ans = 0 ;
	ios_base::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0) ;
	cin >> n ;
	for(int i = 0 ; i < n ; i++)
		cin >> a[i] ;
	random_shuffle(a , a + n) ;
	for(int pc = 0 ; pc < min(maxp , n) ; pc++){
		long long x = a[pc] ;
		cnt_div = 0 ;
		for(int j = 1 ; (long long)j * j <= x ; j++){
			if(x % j == 0){
				divi[cnt_div++] = j ;
				if((long long)j * j != x)
					divi[cnt_div++] = x / j ;
			}
		}
		sort(divi , divi + cnt_div) ; memset(c , 0 , sizeof c) ;
		for(int j = 0 ; j < n ; j++){
			long long GCD = __gcd(x , a[j]) ;
			int idx = lower_bound(divi , divi + cnt_div , GCD) - divi ;
			c[idx]++ ;
		}
		for(int i = 0 ; i < cnt_div ; i++){
			int cnt = 0 ;
			for(int j = i ; j < cnt_div ; j++)
				if(divi[j] % divi[i] == 0)
					cnt += c[j] ;
			if(2 * cnt >= n)
				ans = max(divi[i] , ans) ;
		}
	}
	cout << ans << endl ;
	return 0 ;
}


#include <bits/stdc++.h>

using namespace std ;

const int maxn = 1e6 + 10 ; // maximum number of numbers
const int maxk = 7e3 + 10 ; // maximum number of divisors
const int maxp = 10 ;       // maximum number of random numbers
long long a[maxn] , b[maxn] , divi[maxk] ;
int n , c[maxk] , cnt_div ;

int main()
{
	//ios_base::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0) ;
	long long ans = 0 ;
	cin >> n ;
	for(int i = 0 ; i < n ; i++){
		//cin >> a[i] ;
		scanf("%I64D" , &a[i]) ;
		b[i] = a[i] ;
	}
	sort(b , b + n) ; unique(b , b + n) ; random_shuffle(b , b + n) ;
	for(int pc = 0 ; pc < min(maxp , n) ; pc++){
		long long x = b[pc] ;
		cnt_div = 0 ;
		for(int j = 1 ; (long long)j * j <= x ; j++){
			if(x % j == 0){
				divi[cnt_div++] = j ;
				if((long long)j * j != x)
					divi[cnt_div++] = x / j ;
			}
		}
		sort(divi , divi + cnt_div) ; memset(c , 0 , sizeof c) ;
		for(int j = 0 ; j < n ; j++){
			long long GCD = __gcd(x , a[j]) ;
			int idx = lower_bound(divi , divi + cnt_div , GCD) - divi ;
			c[idx]++ ;
		}
		for(int i = 0 ; i < cnt_div ; i++){
			int cnt = 0 ;
			for(int j = i ; j < cnt_div ; j++)
				if(divi[j] % divi[i] == 0)
					cnt += c[j] ;
			if(2 * cnt >= n)
				ans = max(divi[i] , ans) ;
		}
	}
	cout << ans << endl ;
	return 0 ;
}


#include <bits/stdc++.h>

using namespace std ;

#define PB  push_back

const int maxn = 1e6 + 10 ; // maximum number of numbers
const int maxk = 2e4 + 10 ; // maximum number of divisors
const int maxp = 13 ;       // maximum number of random numbers
int n ;
long long a[maxn] , divi[maxk] ;
int c[maxk] , cnt_div ;

int main()
{
	long long ans = 0 ;
	ios_base::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0) ;
	cin >> n ;
	for(int i = 0 ; i < n ; i++)
		cin >> a[i] ;
	random_shuffle(a , a + n) ;
	for(int pc = 0 ; pc < min(maxp , n) ; pc++){
		long long x = a[pc] ;
		cnt_div = 0 ;
		for(int j = 1 ; (long long)j * j <= x ; j++){
			if(x % j == 0){
				divi[cnt_div++] = j ;
				if((long long)j * j != x)
					divi[cnt_div++] = x / j ;
			}
		}
		sort(divi , divi + cnt_div) ;
		for(int j = 0 ; j < n ; j++){
			long long GCD = __gcd(x , a[j]) ;
			int idx = lower_bound(divi , divi + cnt_div , GCD) - divi ;
			c[idx]++ ;
		}
		for(int i = 0 ; i < cnt_div ; i++){
			int cnt = 0 ;
			for(int j = i ; j < cnt_div ; j++)
				if(divi[j] % divi[i] == 0)
					cnt += c[j] ;
			if(2 * cnt >= n)
				ans = max(divi[i] , ans) ;
		}
	}
	cout << ans << endl ;
	return 0 ;
}


#include <bits/stdc++.h>

using namespace std ;

const int maxn = 1e6 + 10 ; // maximum number of numbers
const int maxk = 7e3 + 10 ; // maximum number of divisors
const int maxp = 9 ;       // maximum number of random numbers
long long a[maxn] , b[maxn] , divi[maxk] ;
int n , c[maxk] , cnt_div ;

int main()
{
	//ios_base::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0) ;
	long long ans = 0 ;
	cin >> n ;
	for(int i = 0 ; i < n ; i++){
		//cin >> a[i] ;
		scanf("%I64D" , &a[i]) ;
		b[i] = a[i] ;
	}
	sort(b , b + n) ;
	int z = unique(b , b + n) - b ;
	random_shuffle(b , b + z) ;
	for(int pc = 0 ; pc < min(maxp , z) ; pc++){
		long long x = b[pc] ;
		cnt_div = 0 ;
		for(int j = 1 ; (long long)j * j <= x ; j++){
			if(x % j == 0){
				divi[cnt_div++] = j ;
				if((long long)j * j != x)
					divi[cnt_div++] = x / j ;
			}
		}
		sort(divi , divi + cnt_div) ; memset(c , 0 , sizeof c) ;
		for(int j = 0 ; j < n ; j++){
			long long GCD = __gcd(x , a[j]) ;
			int idx = lower_bound(divi , divi + cnt_div , GCD) - divi ;
			c[idx]++ ;
		}
		for(int i = 0 ; i < cnt_div ; i++){
			int cnt = 0 ;
			for(int j = i ; j < cnt_div ; j++)
				if(divi[j] % divi[i] == 0)
					cnt += c[j] ;
			if(2 * cnt >= n)
				ans = max(divi[i] , ans) ;
		}
	}
	cout << ans << endl ;
	return 0 ;
}


#include <bits/stdc++.h>

using namespace std ;

#define PB  push_back

const int maxn = 1e6 + 10 ; // maximum number of numbers
const int maxk = 7e3 + 10 ; // maximum number of divisors
const int maxp = 13 ;       // maximum number of random numbers
long long a[maxn] , divi[maxk] ;
int n , c[maxk] , cnt_div ;

int main()
{
	long long ans = 0 ;
	ios_base::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0) ;
	cin >> n ;
	for(int i = 0 ; i < n ; i++)
		cin >> a[i] ;
	random_shuffle(a , a + n) ;
	for(int pc = 0 ; pc < min(maxp , n) ; pc++){
		long long x = a[pc] ;
		cnt_div = 0 ;
		for(int j = 1 ; (long long)j * j <= x ; j++){
			if(x % j == 0){
				divi[cnt_div++] = j ;
				if((long long)j * j != x)
					divi[cnt_div++] = x / j ;
			}
		}
		sort(divi , divi + cnt_div) ;
		for(int j = 0 ; j < n ; j++){
			long long GCD = __gcd(x , a[j]) ;
			int idx = lower_bound(divi , divi + cnt_div , GCD) - divi - 1 ;
			c[idx]++ ;
		}
		for(int i = 0 ; i < cnt_div ; i++){
			int cnt = 0 ;
			for(int j = i ; j < cnt_div ; j++)
				if(divi[j] % divi[i] == 0)
					cnt += c[j] ;
			if(2 * cnt >= n)
				ans = max(divi[i] , ans) ;
		}
	}
	cout << ans << endl ;
	return 0 ;
}


#include <bits/stdc++.h>

using namespace std ;

const int maxn = 1e6 + 10 ; // maximum number of numbers
const int maxk = 7e3 + 10 ; // maximum number of divisors
const int maxp = 9 ;       // maximum number of random numbers
long long a[maxn] , divi[maxk] ;
int n , c[maxk] , cnt_div ;

int main()
{
	//ios_base::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0) ;
	long long ans = 0 ;
	cin >> n ;
	for(int i = 0 ; i < n ; i++){
		//cin >> a[i] ;
		scanf("%I64D" , &a[i]) ;
	}
	random_shuffle(a , a + n) ;
	for(int pc = 0 ; pc < min(maxp , n) ; pc++){
		long long x = a[pc] ;
		cnt_div = 0 ;
		for(int j = 1 ; (long long)j * j <= x ; j++){
			if(x % j == 0){
				divi[cnt_div++] = j ;
				if((long long)j * j != x)
					divi[cnt_div++] = x / j ;
			}
		}
		sort(divi , divi + cnt_div) ; memset(c , 0 , sizeof c) ;
		for(int j = 0 ; j < n ; j++){
			long long GCD = __gcd(x , a[j]) ;
			int idx = lower_bound(divi , divi + cnt_div , GCD) - divi ;
			c[idx]++ ;
		}
		for(int i = 0 ; i < cnt_div ; i++){
			int cnt = 0 ;
			for(int j = i ; j < cnt_div ; j++)
				if(divi[j] % divi[i] == 0)
					cnt += c[j] ;
			if(2 * cnt >= n)
				ans = max(divi[i] , ans) ;
		}
	}
	cout << ans << endl ;
	return 0 ;
}


#include <bits/stdc++.h>

using namespace std ;

const int maxn = 1e6 + 10 ; // maximum number of numbers
const int maxk = 7e3 + 10 ; // maximum number of divisors
const int maxp = 9 ;       // maximum number of random numbers
long long a[maxn] , divi[maxk] ;
int n , c[maxk] , cnt_div ;

int main()
{
	//ios_base::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0) ;
	srand(110) ;
	long long ans = 0 ;
	cin >> n ;
	for(int i = 0 ; i < n ; i++){
		//cin >> a[i] ;
		scanf("%I64D" , &a[i]) ;
	}
	random_shuffle(a , a + n) ;
	for(int pc = 0 ; pc < min(maxp , n) ; pc++){
		long long x = a[pc] ;
		cnt_div = 0 ;
		for(int j = 1 ; (long long)j * j <= x ; j++){
			if(x % j == 0){
				divi[cnt_div++] = j ;
				if((long long)j * j != x)
					divi[cnt_div++] = x / j ;
			}
		}
		sort(divi , divi + cnt_div) ; memset(c , 0 , sizeof c) ;
		for(int j = 0 ; j < n ; j++){
			long long GCD = __gcd(x , a[j]) ;
			int idx = lower_bound(divi , divi + cnt_div , GCD) - divi ;
			c[idx]++ ;
		}
		for(int i = 0 ; i < cnt_div ; i++){
			int cnt = 0 ;
			for(int j = i ; j < cnt_div ; j++)
				if(divi[j] % divi[i] == 0)
					cnt += c[j] ;
			if(2 * cnt >= n)
				ans = max(divi[i] , ans) ;
		}
	}
	cout << ans << endl ;
	return 0 ;
}


#include <bits/stdc++.h>

using namespace std ;

#define PB  push_back

const int maxn = 1e6 + 10 ; // maximum number of numbers
const int maxk = 2e4 + 10 ; // maximum number of divisors
const int maxp = 13 ;       // maximum number of random numbers
long long a[maxn] , divi[maxk] ;
int c[maxk] , cnt_div ;

int main()
{
	long long ans = 0 ;
	ios_base::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0) ;
	int n ;
	cin >> n ;
	for(int i = 0 ; i < n ; i++)
		cin >> a[i] ;
	random_shuffle(a , a + n) ;
	for(int pc = 0 ; pc < min(maxp , n) ; pc++){
		cnt_div = 0 ;
		long long x = a[pc] ;
		for(int j = 2 ; (long long)j * j <= x ; j++){
			if(x % j == 0){
				divi[cnt_div++] = j ;
				if((long long)j * j != x)
					divi[cnt_div++] = x / j ;
			}
		}
		sort(divi , divi + cnt_div) ;
		for(int j = 0 ; j < n ; j++){
			long long GCD = __gcd(x , a[j]) ;
			int idx = lower_bound(divi , divi + cnt_div , GCD) - divi ;
			c[idx]++ ;
		}
		for(int i = 0 ; i < cnt_div ; i++){
			int cnt = 0 ;
			for(int j = i ; j < cnt_div ; j++)
				if(divi[j] % divi[i] == 0)
					cnt += c[j] ;
			if(2 * cnt >= n)
				ans = max(divi[i] , ans) ;
		}
	}
	cout << ans << endl ;
	return 0 ;
}


#include <bits/stdc++.h>

using namespace std ;

const int maxn = 1e6 + 10 ; // maximum number of numbers
const int maxk = 7e3 + 10 ; // maximum number of divisors
const int maxp = 9 ;       // maximum number of random numbers
long long a[maxn] , b[maxn] , divi[maxk] ;
int n , c[maxk] , cnt_div ;

int main()
{
	//ios_base::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0) ;
	long long ans = 0 ;
	cin >> n ;
	for(int i = 0 ; i < n ; i++){
		//cin >> a[i] ;
		scanf("%I64D" , &a[i]) ;
		b[i] = a[i] ;
	}
	sort(b , b + n) ; unique(b , b + n) ; random_shuffle(b , b + n) ;
	for(int pc = 0 ; pc < min(maxp , n) ; pc++){
		long long x = b[pc] ;
		cnt_div = 0 ;
		for(int j = 1 ; (long long)j * j <= x ; j++){
			if(x % j == 0){
				divi[cnt_div++] = j ;
				if((long long)j * j != x)
					divi[cnt_div++] = x / j ;
			}
		}
		sort(divi , divi + cnt_div) ; memset(c , 0 , sizeof c) ;
		for(int j = 0 ; j < n ; j++){
			long long GCD = __gcd(x , a[j]) ;
			int idx = lower_bound(divi , divi + cnt_div , GCD) - divi ;
			c[idx]++ ;
		}
		for(int i = 0 ; i < cnt_div ; i++){
			int cnt = 0 ;
			for(int j = i ; j < cnt_div ; j++)
				if(divi[j] % divi[i] == 0)
					cnt += c[j] ;
			if(2 * cnt >= n)
				ans = max(divi[i] , ans) ;
		}
	}
	cout << ans << endl ;
	return 0 ;
}


#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <set>
#include <map>
#include <stack>
#include <ctime>

using namespace std;

long long gcd(long long a, long long b) {
    return (b == 0 ? a : gcd(b, a % b));
}

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    clock_t st = clock();
    int n;
    scanf("%d", &n);
    vector<long long> a(n);
    for (int i = 0; i < n; i++)
        scanf("%I64d", &a[i]);
    long long ans = -1;
    for (int t = 0; t < 10 && (double(clock() - st) / CLOCKS_PER_SEC < 2.5); t++) {
        int k = rand() % n;
        map<long long, int> m;
        vector<long long> d;
        int u;
        for (u = 1; u * u <= a[k]; u++)
            if (a[k] % u == 0)
                d.push_back(u);
        u--;
        if (u * u == a[k])
            u--;
        for (; u > 0; u--)
            if (a[k] % u == 0)
                d.push_back(a[k] / u);
        vector<int> c(d.size());
        for (int i = 0; i < n; i++) {
            long long x = gcd(a[k], a[i]);
            int ind = (int)(lower_bound(d.begin(), d.end(), x) - d.begin());
            c[ind]++;
        }
        for (int i = 0; i < (int)d.size(); i++) {
            int w = 0;
            for (int j = i; j < (int)d.size(); j++)
                if (d[j] % d[i] == 0)
                    w += c[j];
            if (w >= (n + 1) / 2 && d[i] > ans)
                ans = d[i];
        }
    }
    cout << ans << endl;
    return 0;
}


#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <set>
#include <map>
#include <stack>
#include <ctime>

using namespace std;

long long gcd(long long a, long long b) {
    return (b == 0 ? a : gcd(b, a % b));
}

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int n;
    scanf("%d", &n);
    vector<long long> a(n);
    for (int i = 0; i < n; i++)
        scanf("%I64d", &a[i]);
    long long ans = -1;
    for (int t = 0; t < 20 && clock() <= 3 * CLOCKS_PER_SEC; t++) {
        int k = rand() % n;
        vector<long long> d;
        int u;
        for (u = 1; u * u <= a[k]; u++)
            if (a[k] % u == 0)
                d.push_back(u);
        u--;
        if (u * u == a[k])
            u--;
        for (; u > 0; u--)
            if (a[k] % u == 0)
                d.push_back(a[k] / u);
        vector<int> c(d.size());
        for (int i = 0; i < n; i++) {
            long long x = gcd(a[k], a[i]);
            int ind = (int)(lower_bound(d.begin(), d.end(), x) - d.begin());
            c[ind]++;
        }
        for (int i = 0; i < (int)d.size(); i++) {
            int w = 0;
            for (int j = i; j < (int)d.size(); j++)
                if (d[j] % d[i] == 0)
                    w += c[j];
            if (w >= (n + 1) / 2 && d[i] > ans)
                ans = d[i];
        }
    }
    cout << ans << endl;
    return 0;
}


#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <set>
#include <map>
#include <stack>
#include <ctime>

using namespace std;

long long gcd(long long a, long long b) {
    return (b == 0 ? a : gcd(b, a % b));
}

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int n;
    scanf("%d", &n);
    vector<long long> a(n);
    for (int i = 0; i < n; i++)
        scanf("%I64d", &a[i]);
    long long ans = -1;
    for (int t = 0; t < 20 && clock() <= 3 * CLOCKS_PER_SEC; t++) {
        int k = (rand() + rand()) % n;
        vector<long long> d;
        long long u;
        for (u = 1; u * u <= a[k]; u++)
            if (a[k] % u == 0)
                d.push_back(u);
        u--;
        if (u * u == a[k])
            u--;
        for (; u > 0; u--)
            if (a[k] % u == 0)
                d.push_back(a[k] / u);
        vector<int> c(d.size());
        for (int i = 0; i < n; i++) {
            long long x = gcd(a[k], a[i]);
            int ind = (int)(lower_bound(d.begin(), d.end(), x) - d.begin());
            c[ind]++;
        }
        for (int i = 0; i < (int)d.size(); i++) {
            int w = 0;
            for (int j = i; j < (int)d.size(); j++)
                if (d[j] % d[i] == 0)
                    w += c[j];
            if (w >= (n + 1) / 2 && d[i] > ans)
                ans = d[i];
        }
    }
    cout << ans << endl;
    return 0;
}


#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <set>
#include <map>
#include <stack>
#include <ctime>

using namespace std;

long long gcd(long long a, long long b) {
    return (b == 0 ? a : gcd(b, a % b));
}

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    clock_t st = clock();
    int n;
    scanf("%d", &n);
    vector<long long> a(n);
    for (int i = 0; i < n; i++)
        scanf("%I64d", &a[i]);
    long long ans = -1;
    for (int t = 0; t < 10 && (double(clock() - st) / CLOCKS_PER_SEC < 2); t++) {
        int k = rand() % n;
        map<long long, int> m;
        vector<long long> d;
        int u;
        for (u = 1; u * u <= a[k]; u++)
            if (a[k] % u == 0)
                d.push_back(t);
        u--;
        if (u * u == a[k])
            u--;
        for (; u > 0; u--)
            if (a[k] % u == 0)
                d.push_back(a[k] / u);
        vector<int> c(d.size());
        for (int i = 0; i < n; i++) {
            long long x = gcd(a[k], a[i]);
            int ind = (int)(lower_bound(d.begin(), d.end(), x) - d.begin());
            c[ind]++;
        }
        for (int i = 0; i < (int)d.size(); i++) {
            int w = 0;
            for (int j = i; j < (int)d.size(); j++)
                if (d[j] % d[i] == 0)
                    w += c[j];
            if (w >= (n + 1) / 2 && d[i] > ans)
                ans = d[i];
        }
    }
    cout << ans << endl;
    return 0;
}


#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <set>
#include <map>
#include <stack>

using namespace std;

long long gcd(long long a, long long b) {
    return (b == 0 ? a : gcd(b, a % b));
}

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int n;
    scanf("%d", &n);
    vector<long long> a(n);
    for (int i = 0; i < n; i++)
        scanf("%I64d", &a[i]);
    long long ans = -1;
    for (int t = 0; t < 10; t++) {
        int k = rand() % n;
        map<long long, int> m;
        vector<long long> d;
        for (int i = 1; i * i <= a[k]; i++)
            if (a[k] % i == 0) {
                m[a[k] / i] = 0;
                m[i] = 0;
                d.push_back(i);
                if (i * i != a[k])
                    d.push_back(a[k] / i);
            }
        for (int i = 0; i < n; i++)
            m[gcd(a[k], a[i])]++;
        for (int i = 0; i < (int)d.size(); i++) {
            int w = 0;
            for (int j = 0; j < (int)d.size(); j++)
                if (d[j] % d[i] == 0)
                    w += m[d[j]];
            if (w >= (n + 1) / 2 && d[i] > ans)
                ans = d[i];
        }
    }
    cout << ans << endl;
    return 0;
}


#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <set>
#include <map>
#include <stack>

using namespace std;

long long gcd(long long a, long long b) {
    return (b == 0 ? a : gcd(b, a % b));
}

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int n;
    scanf("%d", &n);
    vector<long long> a(n);
    for (int i = 0; i < n; i++)
        scanf("%I64d", &a[i]);
    long long ans = -1;
    for (int t = 0; t < 7; t++) {
        int k = rand() % n;
        map<long long, int> m;
        vector<long long> d;
        for (int i = 1; i * i <= a[k]; i++)
            if (a[k] % i == 0) {
                m[a[k] / i] = 0;
                m[i] = 0;
                d.push_back(i);
                if (i * i != a[k])
                    d.push_back(a[k] / i);
            }
        for (int i = 0; i < n; i++)
            m[gcd(a[k], a[i])]++;
        for (int i = 0; i < (int)d.size(); i++) {
            int w = 0;
            for (int j = 0; j < (int)d.size(); j++)
                if (d[j] % d[i] == 0)
                    w += m[d[j]];
            if (w >= (n + 1) / 2 && d[i] > ans)
                ans = d[i];
        }
    }
    cout << ans << endl;
    return 0;
}


#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <set>
#include <map>
#include <stack>

using namespace std;

long long gcd(long long a, long long b) {
    return (b == 0 ? a : gcd(b, a % b));
}

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    clock_t st = clock();
    int n;
    scanf("%d", &n);
    vector<long long> a(n);
    for (int i = 0; i < n; i++)
        scanf("%I64d", &a[i]);
    long long ans = -1;
    for (int t = 0; t < 10 && (double(clock() - st) / CLOCKS_PER_SEC < 3); t++) {
        int k = rand() % n;
        map<long long, int> m;
        vector<long long> d;
        vector<int> c;
        for (int i = 1; i * i <= a[k]; i++)
            if (a[k] % i == 0) {
                d.push_back(i);
                c.push_back(0);
                if (i * i != a[k]) {
                    d.push_back(a[k] / i);
                    c.push_back(0);
                }
            }
        sort(d.begin(), d.end());
        for (int i = 0; i < n; i++) {
            long long x = gcd(a[k], a[i]);
            int l = 0, r = (int)d.size();
            while (r - l > 1) {
                int m = (l + r) / 2;
                if (d[m] <= x)
                    l = m;
                else
                    r = m;
            }
            c[l]++;
        }
        for (int i = 0; i < (int)d.size(); i++) {
            int w = 0;
            for (int j = 0; j < (int)d.size(); j++)
                if (d[j] % d[i] == 0)
                    w += c[j];
            if (w >= (n + 1) / 2 && d[i] > ans)
                ans = d[i];
        }
    }
    cout << ans << endl;
    return 0;
}


#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <set>
#include <map>
#include <stack>
#include <ctime>

using namespace std;

long long gcd(long long a, long long b) {
    return (b == 0 ? a : gcd(b, a % b));
}

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int n;
    scanf("%d", &n);
    vector<long long> a(n);
    for (int i = 0; i < n; i++)
        scanf("%I64d", &a[i]);
    long long ans = -1;
    random_shuffle(a.begin(), a.end());
    for (int t = 0; t < 100 && clock() <= 3 * CLOCKS_PER_SEC; t++) {
        int k = rand() % n;
        vector<long long> d;
        long long u;
        for (u = 1; u * u <= a[k]; u++)
            if (a[k] % u == 0)
                d.push_back(u);
        u--;
        if (u * u == a[k])
            u--;
        for (; u > 0; u--)
            if (a[k] % u == 0)
                d.push_back(a[k] / u);
        vector<int> c(d.size());
        for (int i = 0; i < n; i++) {
            long long x = gcd(a[k], a[i]);
            int ind = (int)(lower_bound(d.begin(), d.end(), x) - d.begin());
            c[ind]++;
        }
        for (int i = 0; i < (int)d.size(); i++) {
            int w = 0;
            for (int j = i; j < (int)d.size(); j++)
                if (d[j] % d[i] == 0)
                    w += c[j];
            if (w >= (n + 1) / 2 && d[i] > ans)
                ans = d[i];
        }
    }
    cout << ans << endl;
    return 0;
}


#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <set>
#include <map>
#include <stack>

using namespace std;

long long gcd(long long a, long long b) {
    return (b == 0 ? a : gcd(b, a % b));
}

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int n;
    scanf("%d", &n);
    vector<long long> a(n);
    for (int i = 0; i < n; i++)
        scanf("%I64d", &a[i]);
    long long ans = -1;
    for (int t = 0; t < 8; t++) {
        int k = rand() % n;
        map<long long, int> m;
        vector<long long> d;
        vector<int> c;
        for (int i = 1; i * i <= a[k]; i++)
            if (a[k] % i == 0) {
                d.push_back(i);
                c.push_back(0);
                if (i * i != a[k]) {
                    d.push_back(a[k] / i);
                    c.push_back(0);
                }
            }
        sort(d.begin(), d.end());
        for (int i = 0; i < n; i++) {
            long long x = gcd(a[k], a[i]);
            int l = 0, r = (int)d.size();
            while (r - l > 1) {
                int m = (l + r) / 2;
                if (d[m] <= x)
                    l = m;
                else
                    r = m;
            }
            c[l]++;
        }
        for (int i = 0; i < (int)d.size(); i++) {
            int w = 0;
            for (int j = 0; j < (int)d.size(); j++)
                if (d[j] % d[i] == 0)
                    w += c[j];
            if (w >= (n + 1) / 2 && d[i] > ans)
                ans = d[i];
        }
    }
    cout << ans << endl;
    return 0;
}


#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <set>
#include <map>
#include <stack>
#include <ctime>

using namespace std;

long long gcd(long long a, long long b) {
    return (b == 0 ? a : gcd(b, a % b));
}

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int n;
    scanf("%d", &n);
    vector<long long> a(n);
    for (int i = 0; i < n; i++)
        scanf("%I64d", &a[i]);
    long long ans = -1;
    for (int t = 0; t < 20 && clock() <= 3 * CLOCKS_PER_SEC; t++) {
        int k = rand() % n;
        vector<long long> d;
        long long u;
        for (u = 1; u * u <= a[k]; u++)
            if (a[k] % u == 0)
                d.push_back(u);
        u--;
        if (u * u == a[k])
            u--;
        for (; u > 0; u--)
            if (a[k] % u == 0)
                d.push_back(a[k] / u);
        vector<int> c(d.size());
        for (int i = 0; i < n; i++) {
            long long x = gcd(a[k], a[i]);
            int ind = (int)(lower_bound(d.begin(), d.end(), x) - d.begin());
            c[ind]++;
        }
        for (int i = 0; i < (int)d.size(); i++) {
            int w = 0;
            for (int j = i; j < (int)d.size(); j++)
                if (d[j] % d[i] == 0)
                    w += c[j];
            if (w >= (n + 1) / 2 && d[i] > ans)
                ans = d[i];
        }
    }
    cout << ans << endl;
    return 0;
}


#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <set>
#include <map>
#include <stack>
#include <ctime>

using namespace std;

long long gcd(long long a, long long b) {
    return (b == 0 ? a : gcd(b, a % b));
}

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    clock_t st = clock();
    int n;
    scanf("%d", &n);
    vector<long long> a(n);
    for (int i = 0; i < n; i++)
        scanf("%I64d", &a[i]);
    long long ans = -1;
    for (int t = 0; t < 10 && (double(clock() - st) / CLOCKS_PER_SEC < 1); t++) {
        int k = rand() % n;
        map<long long, int> m;
        vector<long long> d;
        int u;
        for (u = 1; u * u <= a[k]; u++)
            if (a[k] % u == 0)
                d.push_back(u);
        u--;
        if (u * u == a[k])
            u--;
        for (; u > 0; u--)
            if (a[k] % u == 0)
                d.push_back(a[k] / u);
        vector<int> c(d.size());
        for (int i = 0; i < n; i++) {
            long long x = gcd(a[k], a[i]);
            int ind = (int)(lower_bound(d.begin(), d.end(), x) - d.begin());
            c[ind]++;
        }
        for (int i = 0; i < (int)d.size(); i++) {
            int w = 0;
            for (int j = i; j < (int)d.size(); j++)
                if (d[j] % d[i] == 0)
                    w += c[j];
            if (w >= (n + 1) / 2 && d[i] > ans)
                ans = d[i];
        }
    }
    cout << ans << endl;
    return 0;
}


#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <set>
#include <map>
#include <stack>
#include <ctime>

using namespace std;

long long gcd(long long a, long long b) {
    return (b == 0 ? a : gcd(b, a % b));
}

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    clock_t st = clock();
    int n;
    scanf("%d", &n);
    vector<long long> a(n);
    for (int i = 0; i < n; i++)
        scanf("%I64d", &a[i]);
    long long ans = -1;
    for (int t = 0; t < 10 && (double(clock() - st) / CLOCKS_PER_SEC < 2); t++) {
        int k = rand() % n;
        map<long long, int> m;
        vector<long long> d;
        vector<int> c;
        for (int i = 1; i * i <= a[k]; i++)
            if (a[k] % i == 0) {
                d.push_back(i);
                c.push_back(0);
                if (i * i != a[k]) {
                    d.push_back(a[k] / i);
                    c.push_back(0);
                }
            }
        sort(d.begin(), d.end());
        for (int i = 0; i < n; i++) {
            long long x = gcd(a[k], a[i]);
            int l = 0, r = (int)d.size();
            while (r - l > 1) {
                int m = (l + r) / 2;
                if (d[m] <= x)
                    l = m;
                else
                    r = m;
            }
            c[l]++;
        }
        for (int i = 0; i < (int)d.size(); i++) {
            int w = 0;
            for (int j = i; j < (int)d.size(); j++)
                if (d[j] % d[i] == 0)
                    w += c[j];
            if (w >= (n + 1) / 2 && d[i] > ans)
                ans = d[i];
        }
    }
    cout << ans << endl;
    return 0;
}


#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <set>
#include <map>
#include <stack>
#include <ctime>

using namespace std;

long long gcd(long long a, long long b) {
    return (b == 0 ? a : gcd(b, a % b));
}

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int n;
    scanf("%d", &n);
    vector<long long> a(n);
    for (int i = 0; i < n; i++)
        scanf("%I64d", &a[i]);
    long long ans = -1;
    for (int t = 0; t < 100 && clock() <= 3 * CLOCKS_PER_SEC; t++) {
        int k = rand() % n;
        vector<long long> d;
        long long u;
        for (u = 1; u * u <= a[k]; u++)
            if (a[k] % u == 0)
                d.push_back(u);
        u--;
        if (u * u == a[k])
            u--;
        for (; u > 0; u--)
            if (a[k] % u == 0)
                d.push_back(a[k] / u);
        vector<int> c(d.size());
        for (int i = 0; i < n; i++) {
            long long x = gcd(a[k], a[i]);
            int ind = (int)(lower_bound(d.begin(), d.end(), x) - d.begin());
            c[ind]++;
        }
        for (int i = 0; i < (int)d.size(); i++) {
            int w = 0;
            for (int j = i; j < (int)d.size(); j++)
                if (d[j] % d[i] == 0)
                    w += c[j];
            if (w >= (n + 1) / 2 && d[i] > ans)
                ans = d[i];
        }
    }
    cout << ans << endl;
    return 0;
}


#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <set>
#include <map>
#include <stack>
#include <ctime>

using namespace std;

long long gcd(long long a, long long b) {
    return (b == 0 ? a : gcd(b, a % b));
}

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    clock_t st = clock();
    int n;
    scanf("%d", &n);
    vector<long long> a(n);
    for (int i = 0; i < n; i++)
        scanf("%I64d", &a[i]);
    long long ans = -1;
    for (int t = 0; t < 10 && (double(clock() - st) / CLOCKS_PER_SEC < 3); t++) {
        int k = rand() % n;
        map<long long, int> m;
        vector<long long> d;
        vector<int> c;
        for (int i = 1; i * i <= a[k]; i++)
            if (a[k] % i == 0) {
                d.push_back(i);
                c.push_back(0);
                if (i * i != a[k]) {
                    d.push_back(a[k] / i);
                    c.push_back(0);
                }
            }
        sort(d.begin(), d.end());
        for (int i = 0; i < n; i++) {
            long long x = gcd(a[k], a[i]);
            int l = 0, r = (int)d.size();
            while (r - l > 1) {
                int m = (l + r) / 2;
                if (d[m] <= x)
                    l = m;
                else
                    r = m;
            }
            c[l]++;
        }
        for (int i = 0; i < (int)d.size(); i++) {
            int w = 0;
            for (int j = 0; j < (int)d.size(); j++)
                if (d[j] % d[i] == 0)
                    w += c[j];
            if (w >= (n + 1) / 2 && d[i] > ans)
                ans = d[i];
        }
    }
    cout << ans << endl;
    return 0;
}


#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <cmath>
#include <algorithm>
#include <sstream>
#include <stack>
#include <cstring>
#include <iomanip>
#include <ctime>
using namespace std;
#define pb push_back
#define INF 1001001001
#define FOR(i,n) for(int (i)=0;(i)<(n);++(i))
#define FORI(i,n) for(int (i)=1;(i)<=(n);++(i))
#define mp make_pair
#define pii pair<int,int>
#define ll long long
#define vi vector<int>
#define SZ(x) ((int)((x).size()))
#define fi first
#define se second
#define wez(n) int (n); scanf("%d",&(n));
#define wez2(n,m) int (n),(m); scanf("%d %d",&(n),&(m));
#define wez3(n,m,k) int (n),(m),(k); scanf("%d %d %d",&(n),&(m),&(k));
inline void pisz(int n) { printf("%d\n",n); }
template<typename T,typename TT> ostream& operator<<(ostream &s,pair<T,TT> t) {return s<<"("<<t.first<<","<<t.second<<")";}
template<typename T> ostream& operator<<(ostream &s,vector<T> t){FOR(i,SZ(t))s<<t[i]<<" ";return s; }
#define DBG(vari) cerr<<#vari<<" = "<<(vari)<<endl;
#define ALL(t) t.begin(),t.end()
#define FOREACH(i,t) for (typeof(t.begin()) i=t.begin(); i!=t.end(); i++)
#define TESTS wez(testow)while(testow--)
#define REP(i,a,b) for(int (i)=(a);(i)<=(b);++i)
#define REPD(i,a,b) for(int (i)=(a); (i)>=(b);--i)
#define REMAX(a,b) (a)=max((a),(b));
#define REMIN(a,b) (a)=min((a),(b));
#define IOS ios_base::sync_with_stdio(0);

#include <time.h>

#define N 1000007
int n;
ll t[N], best;

int main () {
   scanf("%d", &n);
   FOR(i,n) scanf("%I64d", &t[i]);
   clock_t startTime = clock();
   best = 1;
   vector<pair<ll,int> > divs;
   while (clock() - startTime < 3.0 * CLOCKS_PER_SEC) {
      const ll x = t[rand() % n];
      divs.clear();
      for (int d = 1; 1LL*d*d <= x; ++d) if (x % d == 0) {
         divs.pb(mp(d,0));
         divs.pb(mp(x/d,0));
      }
      sort(ALL(divs));
      divs.erase(unique(ALL(divs)),divs.end());

      FOR(i,n) lower_bound(ALL(divs), mp(__gcd(x,t[i]),0))->se++;
      FOR(i,SZ(divs)) FOR(j,i) if (divs[i].fi % divs[j].fi == 0) divs[j].se += divs[i].se;
      FOREACH(it,divs) if (2 * it->se >= n) REMAX(best, it->fi);
   }
   printf("%lld\n", best);
}


#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <cmath>
#include <algorithm>
#include <sstream>
#include <stack>
#include <cstring>
#include <iomanip>
#include <ctime>
using namespace std;
#define pb push_back
#define INF 1001001001
#define FOR(i,n) for(int (i)=0;(i)<(n);++(i))
#define FORI(i,n) for(int (i)=1;(i)<=(n);++(i))
#define mp make_pair
#define pii pair<int,int>
#define ll long long
#define vi vector<int>
#define SZ(x) ((int)((x).size()))
#define fi first
#define se second
#define wez(n) int (n); scanf("%d",&(n));
#define wez2(n,m) int (n),(m); scanf("%d %d",&(n),&(m));
#define wez3(n,m,k) int (n),(m),(k); scanf("%d %d %d",&(n),&(m),&(k));
inline void pisz(int n) { printf("%d\n",n); }
template<typename T,typename TT> ostream& operator<<(ostream &s,pair<T,TT> t) {return s<<"("<<t.first<<","<<t.second<<")";}
template<typename T> ostream& operator<<(ostream &s,vector<T> t){FOR(i,SZ(t))s<<t[i]<<" ";return s; }
#define DBG(vari) cerr<<#vari<<" = "<<(vari)<<endl;
#define ALL(t) t.begin(),t.end()
#define FOREACH(i,t) for (typeof(t.begin()) i=t.begin(); i!=t.end(); i++)
#define TESTS wez(testow)while(testow--)
#define REP(i,a,b) for(int (i)=(a);(i)<=(b);++i)
#define REPD(i,a,b) for(int (i)=(a); (i)>=(b);--i)
#define REMAX(a,b) (a)=max((a),(b));
#define REMIN(a,b) (a)=min((a),(b));
#define IOS ios_base::sync_with_stdio(0);

#include <sys/time.h>
double getTime(){
   timeval tv;
   gettimeofday(&tv, 0);
   return tv.tv_sec + tv.tv_usec * 1e-6;
}

vector<bool> sito (int m) { // m = max_inclusive
   vector<bool> pr(m+1,1);
   pr[0] = pr[1] = 0;
   for (int x = 2; x*x <= m; ++x) if (pr[x]) for (int y = x*x; y <= m; y += x) pr[y] = 0;
   return pr;
}

vi listaPierwszych (int m) { // m = max_inclusive
   vector<bool> pr = sito(m);
   vi ans;
   FORI(i,m) if (pr[i]) ans.pb(i);
   return ans;
}

#define N 1000007
vi pr;
int n;
ll t[N];

int main () {
   //pr = listaPierwszych(1000000);
   scanf("%d", &n);
   FOR(i,n) scanf("%I64d", &t[i]);
   srand(time(0));
   double starttime = getTime();
   ll best = 0;
   while (getTime() - starttime < 3.5) {
      ll g = 0;
      FOR(u,10) g = __gcd(g, t[rand() % n]);
      int cnt = 0;
      FOR(i,n) if (t[i] % g == 0) ++cnt;
      if (2*cnt >= n) REMAX(best,g);
   }
   printf("%lld\n", best);
}


#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <cmath>
#include <algorithm>
#include <sstream>
#include <stack>
#include <cstring>
#include <iomanip>
#include <ctime>
using namespace std;
#define pb push_back
#define INF 1001001001
#define FOR(i,n) for(int (i)=0;(i)<(n);++(i))
#define FORI(i,n) for(int (i)=1;(i)<=(n);++(i))
#define mp make_pair
#define pii pair<int,int>
#define ll long long
#define vi vector<int>
#define SZ(x) ((int)((x).size()))
#define fi first
#define se second
#define wez(n) int (n); scanf("%d",&(n));
#define wez2(n,m) int (n),(m); scanf("%d %d",&(n),&(m));
#define wez3(n,m,k) int (n),(m),(k); scanf("%d %d %d",&(n),&(m),&(k));
inline void pisz(int n) { printf("%d\n",n); }
template<typename T,typename TT> ostream& operator<<(ostream &s,pair<T,TT> t) {return s<<"("<<t.first<<","<<t.second<<")";}
template<typename T> ostream& operator<<(ostream &s,vector<T> t){FOR(i,SZ(t))s<<t[i]<<" ";return s; }
#define DBG(vari) cerr<<#vari<<" = "<<(vari)<<endl;
#define ALL(t) t.begin(),t.end()
#define FOREACH(i,t) for (typeof(t.begin()) i=t.begin(); i!=t.end(); i++)
#define TESTS wez(testow)while(testow--)
#define REP(i,a,b) for(int (i)=(a);(i)<=(b);++i)
#define REPD(i,a,b) for(int (i)=(a); (i)>=(b);--i)
#define REMAX(a,b) (a)=max((a),(b));
#define REMIN(a,b) (a)=min((a),(b));
#define IOS ios_base::sync_with_stdio(0);

#include <sys/time.h>
double getTime(){
   timeval tv;
   gettimeofday(&tv, 0);
   return tv.tv_sec + tv.tv_usec * 1e-6;
}

vector<bool> sito (int m) { // m = max_inclusive
   vector<bool> pr(m+1,1);
   pr[0] = pr[1] = 0;
   for (int x = 2; x*x <= m; ++x) if (pr[x]) for (int y = x*x; y <= m; y += x) pr[y] = 0;
   return pr;
}

vi listaPierwszych (int m) { // m = max_inclusive
   vector<bool> pr = sito(m);
   vi ans;
   FORI(i,m) if (pr[i]) ans.pb(i);
   return ans;
}

#define N 1000007
vi pr;
int n;
ll t[N];

int main () {
   //pr = listaPierwszych(1000000);
   scanf("%d", &n);
   FOR(i,n) scanf("%I64d", &t[i]);
   srand(time(0));
   double starttime = getTime();
   ll best = 0;
   while (getTime() - starttime < 3.5) {
      ll g = 0;
      FOR(u,4) g = __gcd(g, t[rand() % n]);
      int cnt = 0;
      FOR(i,n) if (t[i] % g == 0) ++cnt;
      if (2*cnt >= n) REMAX(best,g);
   }
   printf("%lld\n", best);
}


#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <cmath>
#include <algorithm>
#include <sstream>
#include <stack>
#include <cstring>
#include <iomanip>
#include <ctime>
using namespace std;
#define pb push_back
#define INF 1001001001
#define FOR(i,n) for(int (i)=0;(i)<(n);++(i))
#define FORI(i,n) for(int (i)=1;(i)<=(n);++(i))
#define mp make_pair
#define pii pair<int,int>
#define ll long long
#define vi vector<int>
#define SZ(x) ((int)((x).size()))
#define fi first
#define se second
#define wez(n) int (n); scanf("%d",&(n));
#define wez2(n,m) int (n),(m); scanf("%d %d",&(n),&(m));
#define wez3(n,m,k) int (n),(m),(k); scanf("%d %d %d",&(n),&(m),&(k));
inline void pisz(int n) { printf("%d\n",n); }
template<typename T,typename TT> ostream& operator<<(ostream &s,pair<T,TT> t) {return s<<"("<<t.first<<","<<t.second<<")";}
template<typename T> ostream& operator<<(ostream &s,vector<T> t){FOR(i,SZ(t))s<<t[i]<<" ";return s; }
#define DBG(vari) cerr<<#vari<<" = "<<(vari)<<endl;
#define ALL(t) t.begin(),t.end()
#define FOREACH(i,t) for (typeof(t.begin()) i=t.begin(); i!=t.end(); i++)
#define TESTS wez(testow)while(testow--)
#define REP(i,a,b) for(int (i)=(a);(i)<=(b);++i)
#define REPD(i,a,b) for(int (i)=(a); (i)>=(b);--i)
#define REMAX(a,b) (a)=max((a),(b));
#define REMIN(a,b) (a)=min((a),(b));
#define IOS ios_base::sync_with_stdio(0);

#include <sys/time.h>
double getTime(){
   timeval tv;
   gettimeofday(&tv, 0);
   return tv.tv_sec + tv.tv_usec * 1e-6;
}

vector<bool> sito (int m) { // m = max_inclusive
   vector<bool> pr(m+1,1);
   pr[0] = pr[1] = 0;
   for (int x = 2; x*x <= m; ++x) if (pr[x]) for (int y = x*x; y <= m; y += x) pr[y] = 0;
   return pr;
}

vi listaPierwszych (int m) { // m = max_inclusive
   vector<bool> pr = sito(m);
   vi ans;
   FORI(i,m) if (pr[i]) ans.pb(i);
   return ans;
}

#define N 1000007
vi pr;
int n;
ll t[N];

int main () {
   //pr = listaPierwszych(1000000);
   scanf("%d", &n);
   FOR(i,n) scanf("%I64d", &t[i]);
   srand(time(0));
   double starttime = getTime();
   ll best = 0;
   while (getTime() - starttime < 3.5) {
      ll g = 0;
      FOR(u,5) g = __gcd(g, t[rand() % n]);
      int cnt = 0;
      FOR(i,n) if (t[i] % g == 0) ++cnt;
      if (2*cnt >= n) REMAX(best,g);
   }
   printf("%lld\n", best);
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define FOR(i,n) for(int (i)=0;(i)<(n);++(i))
#define mp make_pair
#define ll long long
#define SZ(x) ((int)((x).size()))
#define fi first
#define se second
#define ALL(t) t.begin(),t.end()

#define N 1000007
int n;
ll t[N], best;

int main () {
   scanf("%d", &n);
   FOR(i,n) scanf("%I64d", &t[i]);
   clock_t startTime = clock();
   best = 1;
   vector<pair<ll,int> > divs;
   while (clock() - startTime < 1.4 * CLOCKS_PER_SEC) {
      const ll x = t[(rand() * RAND_MAX + rand()) % n]; // Windows on CF...
      divs.clear();
      for (int d = 1; 1LL*d*d <= x; ++d) if (x % d == 0) {
         divs.pb(mp(d,0));
         divs.pb(mp(x/d,0));
      }
      sort(ALL(divs));
      divs.erase(unique(ALL(divs)),divs.end());

      FOR(i,n) lower_bound(ALL(divs), mp(__gcd(x,t[i]),0))->se++;
      FOR(i,SZ(divs)) FOR(j,i) if (divs[i].fi % divs[j].fi == 0) divs[j].se += divs[i].se;
      for (auto it : divs) if (2 * it.se >= n) best = max(best, it.fi);
   }
   printf("%lld\n", best);
}


#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <cmath>
#include <algorithm>
#include <sstream>
#include <stack>
#include <cstring>
#include <iomanip>
#include <ctime>
using namespace std;
#define pb push_back
#define INF 1001001001
#define FOR(i,n) for(int (i)=0;(i)<(n);++(i))
#define FORI(i,n) for(int (i)=1;(i)<=(n);++(i))
#define mp make_pair
#define pii pair<int,int>
#define ll long long
#define vi vector<int>
#define SZ(x) ((int)((x).size()))
#define fi first
#define se second
#define wez(n) int (n); scanf("%d",&(n));
#define wez2(n,m) int (n),(m); scanf("%d %d",&(n),&(m));
#define wez3(n,m,k) int (n),(m),(k); scanf("%d %d %d",&(n),&(m),&(k));
inline void pisz(int n) { printf("%d\n",n); }
template<typename T,typename TT> ostream& operator<<(ostream &s,pair<T,TT> t) {return s<<"("<<t.first<<","<<t.second<<")";}
template<typename T> ostream& operator<<(ostream &s,vector<T> t){FOR(i,SZ(t))s<<t[i]<<" ";return s; }
#define DBG(vari) cerr<<#vari<<" = "<<(vari)<<endl;
#define ALL(t) t.begin(),t.end()
#define FOREACH(i,t) for (typeof(t.begin()) i=t.begin(); i!=t.end(); i++)
#define TESTS wez(testow)while(testow--)
#define REP(i,a,b) for(int (i)=(a);(i)<=(b);++i)
#define REPD(i,a,b) for(int (i)=(a); (i)>=(b);--i)
#define REMAX(a,b) (a)=max((a),(b));
#define REMIN(a,b) (a)=min((a),(b));
#define IOS ios_base::sync_with_stdio(0);

#include <sys/time.h>
double getTime(){
   timeval tv;
   gettimeofday(&tv, 0);
   return tv.tv_sec + tv.tv_usec * 1e-6;
}

vector<bool> sito (int m) { // m = max_inclusive
   vector<bool> pr(m+1,1);
   pr[0] = pr[1] = 0;
   for (int x = 2; x*x <= m; ++x) if (pr[x]) for (int y = x*x; y <= m; y += x) pr[y] = 0;
   return pr;
}

vi listaPierwszych (int m) { // m = max_inclusive
   vector<bool> pr = sito(m);
   vi ans;
   FORI(i,m) if (pr[i]) ans.pb(i);
   return ans;
}

#define N 1000007
vi pr;
int n;
ll t[N];

int main () {
   //pr = listaPierwszych(1000000);
   scanf("%d", &n);
   FOR(i,n) scanf("%I64d", &t[i]);
   srand(time(0));
   double starttime = getTime();
   ll best = 0;
   while (getTime() - starttime < 3.5) {
      ll g = 0;
      FOR(u,8) g = __gcd(g, t[rand() % n]);
      int cnt = 0;
      FOR(i,n) if (t[i] % g == 0) ++cnt;
      if (2*cnt >= n) REMAX(best,g);
   }
   printf("%lld\n", best);
}


#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <cmath>
#include <algorithm>
#include <sstream>
#include <stack>
#include <cstring>
#include <iomanip>
#include <ctime>
using namespace std;
#define pb push_back
#define INF 1001001001
#define FOR(i,n) for(int (i)=0;(i)<(n);++(i))
#define FORI(i,n) for(int (i)=1;(i)<=(n);++(i))
#define mp make_pair
#define pii pair<int,int>
#define ll long long
#define vi vector<int>
#define SZ(x) ((int)((x).size()))
#define fi first
#define se second
#define wez(n) int (n); scanf("%d",&(n));
#define wez2(n,m) int (n),(m); scanf("%d %d",&(n),&(m));
#define wez3(n,m,k) int (n),(m),(k); scanf("%d %d %d",&(n),&(m),&(k));
inline void pisz(int n) { printf("%d\n",n); }
template<typename T,typename TT> ostream& operator<<(ostream &s,pair<T,TT> t) {return s<<"("<<t.first<<","<<t.second<<")";}
template<typename T> ostream& operator<<(ostream &s,vector<T> t){FOR(i,SZ(t))s<<t[i]<<" ";return s; }
#define DBG(vari) cerr<<#vari<<" = "<<(vari)<<endl;
#define ALL(t) t.begin(),t.end()
#define FOREACH(i,t) for (typeof(t.begin()) i=t.begin(); i!=t.end(); i++)
#define TESTS wez(testow)while(testow--)
#define REP(i,a,b) for(int (i)=(a);(i)<=(b);++i)
#define REPD(i,a,b) for(int (i)=(a); (i)>=(b);--i)
#define REMAX(a,b) (a)=max((a),(b));
#define REMIN(a,b) (a)=min((a),(b));
#define IOS ios_base::sync_with_stdio(0);

#include <sys/time.h>
double getTime(){
   timeval tv;
   gettimeofday(&tv, 0);
   return tv.tv_sec + tv.tv_usec * 1e-6;
}

#define N 1000007
int n;
ll t[N], best;

int main () {
   scanf("%d", &n);
   FOR(i,n) scanf("%I64d", &t[i]);
   double starttime = getTime();
   best = 1;
   vector<pair<ll,int> > divs;
   while (getTime() - starttime < 3.5) {
      const ll x = t[(rand() * RAND_MAX + rand()) % n];
      divs.clear();
      for (int d = 1; 1LL*d*d <= x; ++d) if (x % d == 0) {
         divs.pb(mp(d,0));
         divs.pb(mp(x/d,0));
      }
      sort(ALL(divs));
      divs.erase(unique(ALL(divs)),divs.end());

      FOR(i,n) {
         ll g = __gcd(x,t[i]);
         lower_bound(ALL(divs),mp(g,0))->se++;
      }
      FOR(i,SZ(divs)) FOR(j,i) if (divs[i].fi % divs[j].fi == 0) divs[j].se += divs[i].se;
      FOREACH(it,divs) if (2 * it->se >= n) REMAX(best, it->fi);
   }
   printf("%lld\n", best);
}


#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <cmath>
#include <algorithm>
#include <sstream>
#include <stack>
#include <cstring>
#include <iomanip>
#include <ctime>
using namespace std;
#define pb push_back
#define INF 1001001001
#define FOR(i,n) for(int (i)=0;(i)<(n);++(i))
#define FORI(i,n) for(int (i)=1;(i)<=(n);++(i))
#define mp make_pair
#define pii pair<int,int>
#define ll long long
#define vi vector<int>
#define SZ(x) ((int)((x).size()))
#define fi first
#define se second
#define wez(n) int (n); scanf("%d",&(n));
#define wez2(n,m) int (n),(m); scanf("%d %d",&(n),&(m));
#define wez3(n,m,k) int (n),(m),(k); scanf("%d %d %d",&(n),&(m),&(k));
inline void pisz(int n) { printf("%d\n",n); }
template<typename T,typename TT> ostream& operator<<(ostream &s,pair<T,TT> t) {return s<<"("<<t.first<<","<<t.second<<")";}
template<typename T> ostream& operator<<(ostream &s,vector<T> t){FOR(i,SZ(t))s<<t[i]<<" ";return s; }
#define DBG(vari) cerr<<#vari<<" = "<<(vari)<<endl;
#define ALL(t) t.begin(),t.end()
#define FOREACH(i,t) for (typeof(t.begin()) i=t.begin(); i!=t.end(); i++)
#define TESTS wez(testow)while(testow--)
#define REP(i,a,b) for(int (i)=(a);(i)<=(b);++i)
#define REPD(i,a,b) for(int (i)=(a); (i)>=(b);--i)
#define REMAX(a,b) (a)=max((a),(b));
#define REMIN(a,b) (a)=min((a),(b));
#define IOS ios_base::sync_with_stdio(0);

#include <sys/time.h>
double getTime(){
   timeval tv;
   gettimeofday(&tv, 0);
   return tv.tv_sec + tv.tv_usec * 1e-6;
}

#define N 1000007
int n;
ll t[N], best;

int main () {
   scanf("%d", &n);
   FOR(i,n) scanf("%I64d", &t[i]);
   double starttime = getTime();
   best = 1;
   vector<pair<ll,int> > divs;
   while (getTime() - starttime < 3.5) {
      ll x = t[rand() % n];
      divs.clear();
      for (int d = 2; 1LL*d*d <= x; ++d) if (x % d == 0) {
         divs.pb(mp(d,0));
         if (1LL*d*d != x) divs.pb(mp(x/d,0));
      }
      sort(ALL(divs));
      divs.erase(unique(ALL(divs)),divs.end());

      FOR(i,n) {
         ll g = __gcd(x,t[i]);
         lower_bound(ALL(divs),mp(g,0))->se++;
      }
      FOR(i,SZ(divs)) FOR(j,i) if (divs[i].fi % divs[j].fi == 0) divs[j].se += divs[i].se;
      FOREACH(it,divs) if (2 * it->se >= n) REMAX(best, it->fi);
   }
   printf("%lld\n", best);
}