#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#define PI 3.14159265359
#define mod 1000000007
#define ALL(a)  (a).begin(),(a).end()

int main(){
    ll a,b;
    cin >> a >> b;
    int ans = 1;
    for(int i = 1; i <= 200000; i++){
        if(a % i != 0){
            if(a <= i * (a / i + 1) && i * (a / i + 1) <= b){
                if(a <= i * (a / i + 2) && i * (a / i + 2) <= b){
                    ans = max(ans,i);
                }
            }
        }
        else{
            if(a <= i * (a / i + 1) && i * (a / i + 1) <= b){
                ans = max(ans,i);
            }
        }
    }
    cout << ans << endl;
} 
#include<bits/stdc++.h>
using namespace std;

#define all(a) (a).begin(),(a).end()
#define rep(i,n) for(int (i)=0; (i)<(n); (i)++)
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define eb emplace_back
#define fi first
#define se second
#define wt(a) cout<<a[0];for(int i=1; i<a.size(); i++)cout<<" "<<a[i];cout<<endl;
#define V vector

template<class T> bool chmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
template<class T> bool chmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }

template<class T> vector<T> vec(int n, T val){vector<T>ret(n, val);return ret;}

using ll=long long;



signed main(){
    int n;
    cin>>n;
    V<int>a(n);
    rep(i,n)cin>>a[i];
    int maxi=-1, maxv=-1;
    for(int i=2; i<=1000; i++){
        int cnt=0;
        rep(j,n){
            if(a[j]%i==0){
                cnt++;
            }
        }
        if(maxv<cnt){
            maxv=cnt;
            maxi=i;
        }
    }
    cout<<maxi<<endl;
}