#include <iostream>
#include<cmath>
#include<vector>
#include<set>
#include <algorithm>
#include<map>
#include<string>
using namespace std;typedef long long ll;
#define rep(i,n) for(i=0;i<n;i++)
#define pb push_back
#define INF32 2147483647 //2.147483647×10^{9}:32bit整数のinf
#define INF64 9223372036854775807 //9.223372036854775807×10^{18}:64bit整数のinf
#define MOD 1000000007 //問題による
#define FORA(i,I) for(const auto& i:I)
//aをbで割る時の繰上げ,繰り下げ
ll myceil(ll a,ll b){return (a+(b-1))/b;}
ll myfloor(ll a,ll b){return a/b;}

ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll c,ll d){ll g=gcd(c,d);return (c/g)*d;}

int main() {
    ll i,n,k;
    vector<ll>a,b;
    cin>>n;
    for(i=1;i<=sqrt(n);i++){
        if(n%i==0){
            if(i!=n/i){
                a.pb(i);
                b.pb(n/i);
            }else{
                a.pb(i);
            }
        }
    }
    ll cnt1=a.size();
    ll cnt2=b.size();
    for(i=0;i<cnt1;i++){
        cout<<a[i]<<endl;
    }
    for(i=cnt2-1;i>=0;i--){
        cout<<b[i]<<endl;
    }
}


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

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  rep(i, N) cin >> A.at(i);
  int ans = 2, count = 0;
  rep(i, 1010) {
    if (i < 2) continue;
    int j = 0;
    rep(k, N) if (!(A.at(k) % i)) j++;
    if (j >= count) {
      ans = i;
      count = j;
    }
  }
  cout << ans << endl;
}