#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

#define MP make_pair
#define EACH(i,c) for(auto i: c)
#define SORT(c) sort((c).begin(),(c).end())

#define ALL(a)  (a).begin(),(a).end()

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int N;
	cin >> N;
	VI A(N);
	REP(i, N) cin >> A[i];

	int a = 0, b;
	FOR(i, 2, 1001){
		int c = 0;
		REP(j, N) if(A[j] % i == 0) c++;
		if(a < c){
			a = c;
			b = i;
		}
	}
	cerr << a << endl;

	cout << b << endl;

	return 0;
}

#include<bits/stdc++.h>
using namespace std;
using lli = long long int;
int main()
{
    int n;
    cin >> n;
    int arr[n];
    for(int i=0;i<n;i++)
        cin >> arr[i];
    int ans=INT_MIN, res;
    for(int k=2; k<=1000; k++)
    {
        int cnt=0;
        for(int i=0;i<n;i++)
        {
            if(!(arr[i]%k))
                cnt++;
        }
        if(cnt>ans)
        {
            ans=cnt;
            res=k;
        }
    }
    cout << res;
}
