//
//$$$$$$$$$$$$$$$$$$$$$$
//$$                  $$
//$$   gyoubu_oniwa   $$
//$$                  $$
//$$$$$$$$$$$$$$$$$$$$$$
//
#include<bits/stdc++.h>
using namespace std;
#define DBG(a) if(DBGDO) cout<<#a<<':'<<a<<endl;
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define btoe(v) (v).begin(),(v).end()
#define etob(v) (v).rbegin(),(v).rend()
#define F first
#define S second
#define SZ size()
#define pow(a,b) (pow(a,b)+0.5)

typedef unsigned long long int ulli;
typedef long long int lli;
typedef long double ldbl;
#define f(i,a,b) for(int i=(a); i<(b); ++i)
#define fr(i,a,b) for(int i=(a); i>(b); --i)
#define fl(i,a,b) for(lli i=(a); i<(b); ++i)
#define flr(i,a,b) for(lli i=(a); i>(b); --i)
#define w(x) lli x; cin>>x; while(x--) 
#define inpn(n,v,T) T n; cin>>n; vector<T> v(n); fl(i,0,n) cin>>v[i];
#define inp(n,v,T) vector<T> v(n); fl(i,0,n) cin>>v[i];

typedef pair<int,int> pii;typedef vector<int> vi;typedef vector<vi> vvi;typedef vector<pii> vpii;typedef vector<vector<pii>> vvpii;typedef pair<lli,lli> plli;typedef vector<lli> vlli;typedef vector<vlli> vvlli;typedef vector<plli> vplli;typedef vector<vector<plli>> vvplli;typedef vector<bool> vb;typedef vector<string> vs;typedef vector<vector<string>> vvs;

#define unmp unordered_map

#define PRIME ((lli)(1e9+7ll))
#define PRIME2 (998244353ll)
const lli TEN_18 = 1e18;
const lli TEN_9 = 1e9;
const lli TEN_5 = 1e5;

inline void debugORfast(int a=1,int b=1){
    if(a){
        #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
        #endif
    }
    if(b){ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
}}

template<typename T>
void print(const T &v, int begin=-1, int end=-1, int w=2)
{
	if(begin<=end){
		if(begin==-1) fl(i,0,v.SZ) cout<<setw(w)<<v[i]<<' ';
		else if(end==-1) fl(i,begin,v.SZ) cout<<setw(w)<<v[i]<<' ';
		else fl(i,begin,end) cout<<setw(w)<<v[i]<<' ';
		cout<<endl;}
	else{
		if(begin==-1) flr(i,v.SZ-1,-1) cout<<setw(w)<<v[i]<<' ';
		else if(end==-1) flr(i,begin,-1) cout<<setw(w)<<v[i]<<' ';
		else flr(i,begin,end) cout<<setw(w)<<v[i]<<' ';
		cout<<endl;
	}
}

void pans(char v){
	switch(v){
		case 'y' : cout<<"yes"<<endl; break;
		case 'n' : cout<<"no"<<endl; break;
		case 'Y' : cout<<"Yes"<<endl; break;
		case 'N' : cout<<"No"<<endl; break;
		case 'B' : cout<<"YES"<<endl; break;
		case 'S' : cout<<"NO"<<endl; break;
	}
}

int DBGDO=0;

lli brute(){
	return 0;
}

lli mostFrequent(vlli &arr, lli &cnt)
{ 
	lli n = arr.SZ;
  
    // find the max frequency using linear traversal 
    lli max_count = 1, res = arr[0], curr_count = 1; 
    for (lli i = 1; i < n; i++) { 
        if (arr[i] == arr[i - 1]) 
            curr_count++; 
        else { 
            if (curr_count >= max_count) { 
                max_count = curr_count; 
                res = arr[i - 1]; 
            } 
            curr_count = 1; 
        } 
    } 
  
    // If last element is most frequent 
    if (curr_count >= max_count) 
    { 
        max_count = curr_count; 
        res = arr[n - 1]; 
    } 

	cnt = max_count;
    return res; 
} 

bool pal(string s){
	f(i,0,s.SZ){
		if(s[i] != s[s.SZ-i-1]) return false;
	}
	return true;
}

lli solve(){
	inpn(n,a,int);
	sort(btoe(a));
	unmp<int,int> freq;
	f(i,0,a.SZ){freq[a[i]]++;}
	auto e = unique(btoe(a));
	a.resize(e-a.begin());
	unmp<int,int> index;
	f(i,0,a.SZ){index[a[i]]=i;}
	vb ok(a.SZ,true);

	f(i,0,a.SZ){
		int val = a[i];
		if(ok[index[val]]==false) continue;
		if(freq[val]>1) ok[index[val]]=false;
		for(int j=val+val; j<=a.back(); j+=val){
			if(freq.count(j)>0){
				ok[index[j]] = false;
			}
		}
	}
	lli ans = count_if(btoe(ok),[](auto a){return a==true;});
	return ans;
}

void shift(vi &a, int pos){
	int t = a[pos+2];
	a[pos+2] = a[pos+1];
	a[pos+1] = a[pos];
	a[pos] = t;
}

int find(int tar, vi &a){
	f(i,0,a.SZ){
		if(a[i]==tar)
			return i;
	}
	return -1;
}

template<typename T>
class dsu{
	public:
		vector<T> parent;
		T num_comp;
		dsu(){num_comp=0;};
		dsu(T n){
			parent.resize(n);
			f(i,0,n) parent[i]=i;
			num_comp=n;
		}
		T insert(){
			parent.PB(parent.SZ);
			num_comp++;
			return parent.SZ-1; //idx of new val returned
		}
		T join(T id1, T id2){

		}
		T find(T id){
			T ret = id;
			while(parent[id] != id){
				ret = parent[id];
				id = parent[id];
			}
			return ret;
		}
};

vector<bool> isprime;
void sieve(const int lmt){
	isprime.resize(lmt+1,true);
	isprime[0]=isprime[1]=false;
	fl(p,2,sqrt(lmt+1)+1){
		if(!isprime[p]) continue;
		for(lli j=p*p; j<isprime.SZ; j+=p)
			isprime[j]=false;
	}
	return;
}

vector<pair<lli,lli>> plist;
void makePrimeList(int n){
	plist.clear();
	fl(i,2,n+1){
		if(isprime[i]) plist.EB(i,0);
	}
}


ulli gcd(ulli a, ulli b)
{
    //Time - O(Lg min(a,b))
    //Consecutive fibonacci are worst inputs
    //DONT pass negative arguments
    while(b)
    {
        a%=b;
        swap(a,b);
    }
    return a;
}

ulli gcd(ulli a, ulli b, lli & x, lli & y)
{
    //a.x + b.y = gcd
    //Note x and y can be negative, but not a and b
    if (a == 0) {
        x = 0;
        y = 1;
        return b;
    }
    lli x1, y1;
    ulli d = gcd(b % a, a, x1, y1);
    x = y1 - (b / a) * x1;
    y = x1;
    return d;
}

ulli mmi(ulli a, ulli m)
{
    lli x,y;
    ulli g = gcd(a,m,x,y);
    if(g!=1)   //gcd(a,m) must be 1 for MMI to exist
    {
        return -1;
        //signifies no mmi exists
    }
    //to make x within m and positive both
    if(x<0) return x+m;
    else return x;


    ////THE CORRECT WAY TO GIVE ANSWER FOR WHEN FRACTION a/b is to be
    ////reported as  (a*b^-1)moduloPRIME
    //int a,b; cin>>a>>b;
    //cout<<(((ulli)a)*mmi(b,PRIME2))%PRIME2<<endl;
}

ulli lcm(ulli a, ulli b)
{
    return a/gcd(a,b)*b;   //No need of float in division
}

template<typename T>
T binpow(T a, T b) {
    T res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

template<typename T>
T binpow(T a, T b, T m) {
    a %= m;
    T res = 1;
    while (b > 0) {
        if (b & 1)
            res = (res * a) % m;
        a = (a * a) % m;
        b >>= 1;
    }
    return res;
}

template<typename T>
T binpow(T a, T b, pair<T,bool> isprime) {
    T m = isprime.F;
    if(isprime.S==true) b %= (m-1);
    a %= m;
    T res = 1;
    while (b > 0) {
        if (b & 1)
            res = (res * a) % m;
        a = (a * a) % m;
        b >>= 1;
    }
    return res;
}


plli fib(lli n) {
    //O(logn)
    //Using prop -> F(2k) = F(k) * (2*F(k+1) - F(k))
    //and F(2k+1) = F(k+1)*F(k+1) + F(k)*F(k)
    //F(k) means kTh Fib num
    if (n == 0)
        return {0, 1};

    plli p = fib(n >> 1);
    lli c = p.first * (2 * p.second - p.first);
    lli d = p.first * p.first + p.second * p.second;
    if (n & 1)
        return {d, c + d};
    else
        return {c, d};
}

#define LPF_LIMIT (TEN_5)   // (10^7)-(0.1sec), (10^8)-(1.5sec)
vi lpf;   
void leastPrimeFactorVector()
{
    lpf.resize(LPF_LIMIT);
    lpf[0] = 0;
    lpf[1] = 1; //take care to not forget this
    fl(i,2,LPF_LIMIT+2)
    {
        if(lpf[i] == 0)
        {
            lpf[i] = i;
            for(lli j=2*i; j<=LPF_LIMIT; j+=i)
            {
                if(lpf[j]==0) lpf[j]=i;
            }
        }
    }
}

//This one repeats factors, eg PF(8) = 2,2,2,1
//Remember to call leastPrimeFactorVector before calling this
//To get factorisation of big numbers, increase limit of lpf too
void primeFactorisation(unsigned int n, vi &pf)
{
    while(n)
    {
        if(n==1)
        {
            pf.push_back(1); break;
        }
        pf.push_back(lpf[n]);
        n /= lpf[n];
    }
}

//This one doesn't repeat factors, eg PF(8) = (2,3), (1,1)
//Remember to call leastPrimeFactorVector before calling this
//To get factorisation of big numbers, increase limit of lpf too
void primeFactorisation2(unsigned int n, vpii &pf)
{
    while(n!=1)
    {
        if(pf.size()>0 && pf[pf.size()-1].F == lpf[n])
        {
            pf[pf.size()-1].S++;
        }
        else
        {
            pf.PB(MP(lpf[n],1));
        }
        n /= lpf[n];
    }
    pf.PB(MP(1,1));
}

#define ERATOS_LIMIT 32000  //32000^2 > 10^9
#define ERATOS_LIMIT_BIG 1000002 //1000002^2 > 10^12
vector<char> sieveEratos(ulli n = ERATOS_LIMIT)
{
    // n/(ln(n)-1.1) gives upperbound to number of primes less than n
    // use is_prime like this
    // if((bool)is_prime(num)) cout<<num<<" is prime"<<endl;
    
    vector<char> is_prime(n+1, true);
    is_prime[0] = is_prime[1] = false;
    for (int i = 2; i * i <= n; i++) {
        if (is_prime[i]) {
            for (int j = i * i; j <= n; j += i)
                is_prime[j] = false;
        }
    }
    return is_prime;

    // use is_prime like this
    // if((bool)is_prime(num)) cout<<num<<" is prime"<<endl;
}

int ceilLog2(ulli x)
{
    static const unsigned long long t[6] = {
        0xFFFFFFFF00000000ull,
        0x00000000FFFF0000ull,
        0x000000000000FF00ull,
        0x00000000000000F0ull,
        0x000000000000000Cull,
        0x0000000000000002ull
    };
    int y = (((x & (x - 1)) == 0) ? 0 : 1);
    int j = 32;
    int i;
    for (i = 0; i < 6; i++) {
        int k = (((x & t[i]) == 0) ? 0 : j);
        y += k;
        x >>= k;
        j >>= 1;
    }
    return y;
}

unsigned int floorLog2(ulli val) {
    if (val == 0) return UINT_MAX;
    if (val == 1) return 0;
    unsigned int ret = 0;
    while (val > 1) {
        val >>= 1;
        ret++;
    }
    return ret;
}

ulli countSetBits(ulli val)
{
    int co = 0;
    while(val)
    {
        ++co;
        val = val&(val-1);
    }
    return co;
}

vi* factorialModulo(lli lim = 10000, lli m = PRIME)
{
    vi* facmod = new vi(lim+1);
    facmod->at(0) = 1;
    fl(i,1,lim+1)
    {
        facmod->at(i) = (facmod->at(i-1)*i)%m;
    }
    return facmod;
}

lli bincoeffm(lli n, lli k, vi* facmodd, lli m = PRIME)
{
    //call factorialModulo before this for precomputation
    vi &facmod = *facmodd;
    assert(facmod.SZ >n);
    return (((facmod[n]*mmi(facmod[k],m))%m)*(mmi(facmod[n-k],m)))%m;
}



void dfs(int x, vvi &g, vi &d, int dist){
	d[x] = dist;
	for(auto v:g[x]){
		if(d[v]==-1){
			dfs(v,g,d,d[x]+1);
		}
	}
}


int main()
{
	debugORfast(0,1);

	{
		cout<<solve()<<endl;
	}
	return 0;

	lli x,y,l,r; cin>>x>>y>>l>>r;
	DBGDO=1;

	//using x only
	lli maxl = 0;
	lli a = 0;
	while(binpow(x,a) < l-1) ++a;
	while(binpow(x,a+1) <= r){
		DBG(a);
		lli t = binpow(x,a)*(x-1);
		++a;
		if(t>maxl) maxl=t;
	}

	lli b = 0;
	while(binpow(y,b) < l-1) ++b;
	while(binpow(y,b+1) <= r){
		DBG(b);
		lli t = binpow(y,b)*(y-1);
		++b;
		if(t>maxl) maxl=t;
	}

	cout<<maxl<<endl;

	return 0;

	sieve(10000);
	w(ttt)
	{
		lli n,m; cin>>n>>m;
		makePrimeList(m);

		fl(i,0,n){
			lli val; cin>>val;
			fl(p,0,plist.SZ){
				lli prime = plist[p].F;
				if(prime > val) break;
				else{
					lli k=0;
					while(val%prime==0){
						val/=prime;
						k++;
					}
					plist[p].S = max(plist[p].S,k);
				}
			}
		}

		lli lcm=1;
		fl(p,0,plist.SZ){
			fl(e,0,plist[p].S){
				lcm*=plist[p].F;
			}
		}

		if(DBGDO){
			f(i,0,plist.SZ) cout<<plist[i].F<<endl;
			cout<<endl;
			
			cout<<lcm<<endl;
			cout<<"-------"<<endl;
		}

		lli maxlcm=lcm, minans=1;
		fl(val,2,m+1){
			lli temp = val;
			lli addprod=1;
			fl(p,0,plist.SZ){

				lli prime = plist[p].F;
				if(prime>temp) break;

				lli ogfreq = plist[p].S;
				lli k=0;
				while(temp%prime==0){
					temp/=prime;
					k++;
				}

				if(k>ogfreq){
					lli prime_power = pow(prime,k-ogfreq);
					addprod *= prime_power;
				}
			}
			if(lcm*addprod > maxlcm){
				maxlcm = lcm*addprod;
				minans = val;
			}
		}

		//cout<<minans<<endl;
		cout<<maxlcm<<' '<<minans<<endl;
	}
	return 0;
}


Measured memory_bytes: 20552