#include <iostream>
#include <climits>


using namespace std;

int main()
{
	int N;
	cin >> N;
	int A[100];
	int A_max = 0;
	for (int i = 0; i < N; ++i) {
		cin >> A[i];
		A_max = max(A[i], A_max);
	}
	
	int max = 0;
	int ans;

	for (int k = 2; k <= A_max; ++k) {
		int count = 0;
		for (int i = 0; i < N; ++i) {
			if (A[i] % k == 0)++count;
		}
		if (count > max) {
			ans = k;
			max = count;
		}
	}
	
	cout << ans << endl;

}
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main()
{
    ll N;
    cin >> N;

    ll p[N];
    for(ll i = 0; i < N; i++){
        cin >> p[i];
    }

    ll ans = 0;
    ll t[210000];

    for(ll i = 0; i < N; i++){
        t[p[i]]++;
        while (t[ans])
        {
            ans++;
        }
        
        cout << ans << endl;
    }


    return 0;
}