#include<bits/stdc++.h>
using namespace std;
int n,a[102],maxn,ans,w;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;++i)
		scanf("%d",&a[i]),maxn=max(maxn,a[i]);
	for(int i=2;i<=maxn;++i){
		int cnt=0;
		for(int j=1;j<=n;++j)
			if(__gcd(a[j],i)==i)
				++cnt;
		if(cnt>ans)
			ans=cnt,w=i;
	}
	printf("%d\n",w);
}
#include <cstdio>
#include <cstring>
#include <map>
#include <iostream>
#include <queue>
#include <string>
#include <memory.h>
#include <set>
#include <ctime>
#include <stack>
#include <cmath>
#include <vector>
#include <algorithm>
#include <limits>
#include <climits>
#include <list>
#include <ctime>
#define null NULL
using namespace std;
clock_t BEGIN, END;
typedef pair<int, int> pai;

int main(){
    int a[1000];
    int n;
    cin >> n;
    for(int i = 0; i < n; i ++)
        cin >> a[i];
    int m = 0, ans = -1;
    for(int t = 2; t < 1009; t ++){
        int coun = 0;
        for(int i = 0; i < n; i ++){
            if(a[i] % t == 0) coun ++;
        }
        if(coun >= m) ans = t, m = coun;
    }
    if(m == 0) cout << -1;
    else cout << ans;
    return 0;
}

