#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define MODADD(ADD_X,ADD_Y)  (ADD_X+ADD_Y)%MOD
#define MODSUB(SUB_X,SUB_Y)  ((SUB_X-SUB_Y)+MOD)%MOD
#define MODMUL(MUL_X,MUL_Y)  (MUL_X*MUL_Y)%MOD
#define LCM(LCM_X,LCM_Y) (LCM_X/__gcd(LCM_X,LCM_Y))*LCM_Y
template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
int dx[]= {1,0,-1,0,1,-1,1,-1};
int dy[]= {0,1,0,-1,1,-1,-1,1};
int arr[MAX];
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    int n,mx=0,ans;
    cin>>n;
    for(int i=1; i<=n; i++)
        cin>>arr[i];
    for(int i=2; i<=1000; i++)
    {
        int cnt=0;
        for(int j=1; j<=n; j++)
        {
            if(arr[j]%i==0)
                cnt++;
        }
        if(cnt>mx){
            mx=cnt;
            ans=i;
        }
}
cout<<ans<<endl;


return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;

int main(){
    int n; 
    cin >> n;
    int a[n];
    rep(i,n) cin >>a[i];
    int max=0;
    int ans=0;
    for(int i=2;i<1000;i++){
        int cnt =0;
        for(int j=0;j<n;j++){
            if(a[j]%i == 0) cnt++;
            if(max<cnt){
                max=cnt;
                ans=i;
            }
        }
        
    }
    cout << ans << endl;
}