using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Codeforces
{
    class Program
    {
        static void Main(string[] args)
        {
            int k = Convert.ToInt32(Console.ReadLine()); // кол-во строк данных

            int[] n = new int[k]; // кол-во учеников
            int[] x = new int[k]; // МАХ кол-во обменов
            int[] a = new int[k]; // позиция первого ученика
            int[] b = new int[k]; // позиция второго ученика

            for (int i = 0; i < k; i++)
            {
                string[] data = Console.ReadLine().Split();

                n[i] = Convert.ToInt32(data[0]);
                x[i] = Convert.ToInt32(data[1]);
                a[i] = Convert.ToInt32(data[2]);
                b[i] = Convert.ToInt32(data[3]);
            }

            for (int i = 0; i < k; i++)
            {
                if (a[i] > b[i])
                {
                    int tmp = a[i];
                    a[i] = b[i];
                    b[i] = tmp;
                }

                for (int j = 0; j < x[i]; j++)
                {
                    if (a[i] > 1)
                    {
                        a[i]--;
                    }
                    else if ((a[i] == 1) && (b[i] < n[i]))
                    {
                        b[i]++;
                    }
                }

                Console.WriteLine(b[i] - a[i]);
            }
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication42
{
    class Program
    {
        static void Main(string[] args)
        {
            int q = int.Parse(Console.ReadLine());
            for (int i = 0; i < q; i++)
            {
                int[] arr = Console.ReadLine().Split().Select(y => int.Parse(y)).ToArray();
                int n = arr[0];
                int x = arr[1];
                int num1 = arr[2];
                int num2 = arr[3];
                int b,s;
                int z = 0;
                if (num1 >= num2)
                {
                    b = num1;
                    s = num2;
                }
                else { b = num2; s = num1; }
                for (int j = 0; j < x; j++)
                {
                    if (b < n)
                    {
                        b++;

                    }
                    else if (s > 1)
                    {
                        s--;
                    }

                }
                Console.WriteLine(b - s);

            }

        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;

namespace ConsoleApplication6
{
    class Program
    {
        static void Main()
        {
            int cipa = int.Parse(Console.ReadLine());

            List<List<int>> linesList = new List<List<int>>();

            for (int i = 0; i < cipa; i++)
            {
                string line = Console.ReadLine();
                List<int> pizda = new List<int>();
                var arr = line.Split(' ');
                foreach (var item in arr)
                {
                    pizda.Add(int.Parse(item));
                }
                linesList.Add(pizda);
            }

            // list[0] - number of students
            // list[1] - swaps
            // list[2] - position of 1st
            // list[3] - position of 2nd

            foreach (var list in linesList)
            {
                int result = 1;
                int maxDist = list[0] - 1;
                int startingDist = distance(list[2], list[3]);
                if (startingDist == maxDist)
                {
                    result = maxDist;
                }
                else
                {
                    if (list[1] + startingDist >= maxDist)
                    {
                        result = maxDist;
                    }
                    else
                    {
                        result = startingDist + list[1];
                    }
                }

                Console.WriteLine(result);
            }
        }

        static int distance (int a, int b)
        {
            if (a >= b)
            {
                return a - b;
            }
            else
            {
                return b - a;
            }
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split();
            string[] str;
            long t = Convert.ToInt32(s[0]);
            for (int i = 0; i < t; i++)
            {
                str = Console.ReadLine().Split(' ');
                long n = Convert.ToInt32(str[0]);
                long x = Convert.ToInt32(str[1]);
                long a = Convert.ToInt32(str[2]);
                long b = Convert.ToInt32(str[3]);
                while (x != 0)
                {
                    if (a > b)
                    {
                        if (a < n)
                            a = a + 1;
                        else
                            if (b > 1)
                                b = b - 1;
                    }
                    else if (b > a)
                    {
                        if (b < n)
                            b = b + 1;
                        else
                            if (a > 1)
                                a = a - 1;
                    }
                    x = x - 1;
                }

                    Console.WriteLine(Math.Abs(a - b));
            }
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split();
            string[] str;
            long t = Convert.ToInt32(s[0]);
            for (int i = 0; i < t; i++)
            {
                str = Console.ReadLine().Split(' ');
                long n = Convert.ToInt32(str[0]);
                long x = Convert.ToInt32(str[1]);
                long a = Convert.ToInt32(str[2]);
                long b = Convert.ToInt32(str[3]);
                while (x != 0)
                {
                    if (a > b && a != n)
                        a = a + 1;
                    else if (b > a && b !=n)
                        b = b + 1;
                    x = x - 1;
                }

                    Console.WriteLine(Math.Abs(a - b));
            }
        }
    }
}


#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#define ll long long
#define PB push_back
#define POP pop_back()
#define PII pair<int,int>
#define FI first
#define SE second
#define ULL unsigned long long
#define endl '\n'
using namespace std;
const int INF=0x3f3f3f3f;
const double pi=acos(-1),eps=1e-8;

int main()
{
	int n;
	cin>>n;
	int tmp,ans=1,tt;
	for(int i=0;i<n;i++){
		if(i){
			cin>>tt;
			tt=tt*tmp/__gcd(tmp,tt);
			ans=__gcd(tt,ans);
		}else{
			cin>>tmp;
		}
	}
	cout<<ans<<endl;
 	return 0;
}


#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#define ll long long
#define PB push_back
#define POP pop_back()
#define PII pair<int,int>
#define FI first
#define SE second
#define ULL unsigned long long
#define endl '\n'
using namespace std;
const int INF=0x3f3f3f3f;
const double pi=acos(-1),eps=1e-8;

int main()
{
	ll n;
	cin>>n;
	ll tmp,ans=0,tt;
	for(int i=0;i<n;i++){
		if(i!=0){
			cin>>tt;
			tt=tt*tmp/__gcd(tmp,tt);
			ans=__gcd(tt,ans);
			tmp=__gcd(tt,tmp);
		}else{
			cin>>tmp;
		}
	}
	cout<<ans<<endl;
 	return 0;
}


#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#define ll long long
#define PB push_back
#define POP pop_back()
#define PII pair<int,int>
#define FI first
#define SE second
#define ULL unsigned long long
#define endl '\n'
using namespace std;
const int INF=0x3f3f3f3f;
const double pi=acos(-1),eps=1e-8;

int main()
{
	int n;
	cin>>n;
	int tmp,ans,tt;
	for(int i=0;i<n;i++){
		if(i){
			cin>>tt;
			tt=tt*tmp/__gcd(tmp,tt);
			ans=__gcd(tt,ans);
		}else{
			cin>>tmp;
		}
	}
	cout<<ans<<endl;
 	return 0;
}


#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#define ll long long
#define PB push_back
#define POP pop_back()
#define PII pair<int,int>
#define FI first
#define SE second
#define ULL unsigned long long
#define endl '\n'
using namespace std;
const int INF=0x3f3f3f3f;
const double pi=acos(-1),eps=1e-8;

int main()
{
	ll n;
	cin>>n;
	long long int tmp,ans=0,tt;
	cin>>tmp;
	for(int i=1;i<n;i++){
		cin>>tt;
		tt=(tt*tmp)/__gcd(tmp,tt);
		ans=__gcd(tt,ans);
		tmp=__gcd(tt,tmp);
	}
	cout<<ans<<endl;
 	return 0;
}


/*
 ╔═══╦═══╦═══╗
 ║╔═╗║╔══╩╗╔╗║
 ║║░║║╚══╗║║║║
 ║║░║║╔══╝║║║║
 ║╚═╝║╚══╦╝╚╝║
 ╚══╗╠═══╩═══╝
 ░░░╚╝░░░░░░░░
 */

#include <bits/stdc++.h>
#define ll					long long
#define MOD					1000000007
#define MAX					1e9
#define MIN                 -1e9
#define PI					acos(-1.0)
#define vi					vector<int>
#define vii					vector<vi>
#define vll					vector<ll>
#define mid(s,e)			(s+(e-s)/2)
#define clz(n)				__builtin_clzll(n))

using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
template<typename T>
void printVec(const T &v, char sep=' ') {for (auto &i: v) cout << i << sep;}
template<typename T>
void printVecPair(const T &v, char sep=' ') {for (auto &i: v) cout << i.first <<" " << i.second<< sep;}

#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
int gcd(int a, int b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
int main() {
	ios::sync_with_stdio(false);
 	cin.tie(0);
	int n;
	cin>>n;
	vi lc(n);
	for(int& i:lc) cin>>i;
	int ans = 0;
	for(int i=0;i<n;i++) {
			for(int j=i+1;j<n;j++) {
					int lcm = (lc[i]*lc[j])/gcd(lc[i],lc[j]);
					ans = gcd(ans,lcm);

			}
	}
	cout<<ans<<endl;

}


/*
 ╔═══╦═══╦═══╗
 ║╔═╗║╔══╩╗╔╗║
 ║║░║║╚══╗║║║║
 ║║░║║╔══╝║║║║
 ║╚═╝║╚══╦╝╚╝║
 ╚══╗╠═══╩═══╝
 ░░░╚╝░░░░░░░░
 */

#include <bits/stdc++.h>
#define ll					long long
#define MOD					1000000007
#define MAX					1e9
#define MIN                 -1e9
#define PI					acos(-1.0)
#define vi					vector<int>
#define vii					vector<vi>
#define vll					vector<ll>
#define mid(s,e)			(s+(e-s)/2)
#define clz(n)				__builtin_clzll(n))

using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
template<typename T>
void printVec(const T &v, char sep=' ') {for (auto &i: v) cout << i << sep;}
template<typename T>
void printVecPair(const T &v, char sep=' ') {for (auto &i: v) cout << i.first <<" " << i.second<< sep;}

#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
vector<int> factors(int n) {
	vector<int> p;
   while (n%2 == 0){
      n = n/2;
	  p.push_back(2);
   }
   for (int i = 3; i <= sqrt(n); i = i+2){
      while (n%i == 0){
			  p.push_back(i);
         n = n/i;
      }
   }
   if (n > 2)
		   p.push_back(n);
   return p;
}
int main() {
	ios::sync_with_stdio(false);
 	cin.tie(0);
	int n;
	cin>>n;
	vi lc(n);
	for(int& i:lc) cin>>i;
	int ans = 1;
	const int sz=111100;
	vector<int> cntPMin(sz,MAX);
	vector<int> cntPMin2(sz,MAX);
	unordered_map<int,int> cnt;
	for(int i: lc) {
			vector<int> fac = factors(i);
			unordered_map<int,bool> visited;
			for(int t: fac) {
					if(visited[t]) continue;
					visited[t] = 1;
					int cn = count(fac.begin(), fac.end(), t);
					if(cntPMin[t] > cn) {
							cntPMin[t] = cn;
					}else {
							cntPMin2[t] = min(cn,cntPMin2[t]);

					}

			}
			auto ip = unique(fac.begin(), fac.end());
			fac.resize(distance(fac.begin(), ip));
			for(int t: fac) {
					cnt[t]++;
			}
	}
	for(int i=2;i<=sz;i++) {
			if(cnt[i] == n) {
					ans*=pow(i,cntPMin2[i]);
			}else if(cnt[i] == n-1) {
					ans*=pow(i,cntPMin[i]);
			}
	}
	cout<<ans<<endl;

}


/*
 ╔═══╦═══╦═══╗
 ║╔═╗║╔══╩╗╔╗║
 ║║░║║╚══╗║║║║
 ║║░║║╔══╝║║║║
 ║╚═╝║╚══╦╝╚╝║
 ╚══╗╠═══╩═══╝
 ░░░╚╝░░░░░░░░
 */

#include <bits/stdc++.h>
#define ll					long long
#define MOD					1000000007
#define MAX					1e9
#define MIN                 -1e9
#define PI					acos(-1.0)
#define vi					vector<int>
#define vii					vector<vi>
#define vll					vector<ll>
#define mid(s,e)			(s+(e-s)/2)
#define clz(n)				__builtin_clzll(n))

using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
template<typename T>
void printVec(const T &v, char sep=' ') {for (auto &i: v) cout << i << sep;}
template<typename T>
void printVecPair(const T &v, char sep=' ') {for (auto &i: v) cout << i.first <<" " << i.second<< sep;}

#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
vector<int> factors(int n) {
	vector<int> p;
   while (n%2 == 0){
      n = n/2;
	  p.push_back(2);
   }
   for (int i = 3; i <= sqrt(n); i = i+2){
      while (n%i == 0){
			  p.push_back(i);
         n = n/i;
      }
   }
   if (n > 2)
		   p.push_back(n);
   return p;
}
int main() {
	ios::sync_with_stdio(false);
 	cin.tie(0);
	int n;
	cin>>n;
	vi lc(n);
	for(int& i:lc) cin>>i;
	int ans = 1;
	const int sz=111100;
	vector<int> cntPMin(sz,MAX);
	vector<int> cntPMin2(sz,MAX);
	vector<int> cnt(sz);
	for(int i: lc) {
			vector<int> fac = factors(i);
			unordered_map<int,bool> visited;
			for(int t: fac) {
					if(visited[t]) continue;
					visited[t] = 1;
					int cn = count(fac.begin(), fac.end(), t);
					if(cntPMin[t] > cn) {
							cntPMin[t] = cn;
					}else {
							cntPMin2[t] = min(cn,cntPMin2[t]);

					}

			}
			auto ip = unique(fac.begin(), fac.end());
			fac.resize(distance(fac.begin(), ip));
			for(int t: fac) {
					cnt[t]++;
			}
	}
	for(int i=2;i<=sz;i++) {
			if(cnt[i] == n) {
					ans*=pow(i,cntPMin2[i]);
			}else if(cnt[i] == n-1) {
					ans*=pow(i,cntPMin[i]);
			}
	}
	cout<<ans<<endl;

}


/*
 ╔═══╦═══╦═══╗
 ║╔═╗║╔══╩╗╔╗║
 ║║░║║╚══╗║║║║
 ║║░║║╔══╝║║║║
 ║╚═╝║╚══╦╝╚╝║
 ╚══╗╠═══╩═══╝
 ░░░╚╝░░░░░░░░
 */

#include <bits/stdc++.h>
#define ll					long long
#define MOD					1000000007
#define MAX					1e9
#define MIN                 -1e9
#define PI					acos(-1.0)
#define vi					vector<int>
#define vii					vector<vi>
#define vll					vector<ll>
#define mid(s,e)			(s+(e-s)/2)
#define clz(n)				__builtin_clzll(n))

using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
template<typename T>
void printVec(const T &v, char sep=' ') {for (auto &i: v) cout << i << sep;}
template<typename T>
void printVecPair(const T &v, char sep=' ') {for (auto &i: v) cout << i.first <<" " << i.second<< sep;}

#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
const int sz = 220000;
vector<int> p[sz];
int main() {
	ios::sync_with_stdio(false);
 	cin.tie(0);
	int n;
	cin>>n;
	for(int _ = 0; _<n; _++) {
			int x; cin>>x;
			for(int j=2;j*j<=x;j++) {
					if(x%j == 0) {
							int cnt = 0;
							while(x%j == 0) {
									cnt++;
									x /= j;
							}
							p[j].push_back(cnt);
					}

			}
			if(x) {
					p[x].push_back(1);
			}

	}
	ll ans = 1;
	for(int i=1;i<9;i++) {
			if(p[i].size() >= n-1) {
					sort(p[i].begin(), p[i].end());
					int k = p[i][(p[i].size() == n)];
					ans *= pow(i,k);
			}
	}
	cout<<ans;
	return 0;
}


/*
 ╔═══╦═══╦═══╗
 ║╔═╗║╔══╩╗╔╗║
 ║║░║║╚══╗║║║║
 ║║░║║╔══╝║║║║
 ║╚═╝║╚══╦╝╚╝║
 ╚══╗╠═══╩═══╝
 ░░░╚╝░░░░░░░░
 */

#include <bits/stdc++.h>
#define ll					long long
#define MOD					1000000007
#define MAX					1e9
#define MIN                 -1e9
#define PI					acos(-1.0)
#define vi					vector<int>
#define vii					vector<vi>
#define vll					vector<ll>
#define mid(s,e)			(s+(e-s)/2)
#define clz(n)				__builtin_clzll(n))

using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
template<typename T>
void printVec(const T &v, char sep=' ') {for (auto &i: v) cout << i << sep;}
template<typename T>
void printVecPair(const T &v, char sep=' ') {for (auto &i: v) cout << i.first <<" " << i.second<< sep;}

#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
vector<ll> factors(int n) {
	vector<ll> p;
   while (n%2 == 0){
      n = n/2;
	  p.push_back(2);
   }
   for (int i = 3; i <= sqrt(n); i = i+2){
      while (n%i == 0){
			  p.push_back(i);
         n = n/i;
      }
   }
   if (n > 2)
		   p.push_back(n);
   return p;
}
int main() {
	ios::sync_with_stdio(false);
 	cin.tie(0);
	int n;
	cin>>n;
	vi lc(n);
	for(int& i:lc) cin>>i;
	ll ans = 1;
	unordered_map<ll, ll> cntPMin;
	unordered_map<ll,ll> cntPMin2;
	unordered_map<ll,ll> cnt;
	ll sz=MIN;
	for(int i: lc) {
			vector<ll> fac = factors(i);
			debug(fac);
			unordered_map<ll,bool> visited;
			for(ll t: fac) {
					sz = max(sz,t);
					if(visited[t]) continue;
					if(cntPMin[t] == 0) cntPMin[t] = MAX;
					if(cntPMin2[t] == 0) cntPMin2[t] = MAX;
					visited[t] = 1;
					ll cn = count(fac.begin(), fac.end(), t);
					if(cntPMin[t] > cn) {
							cntPMin[t] = cn;
					}else {
							cntPMin2[t] = min(cn,cntPMin2[t]);

					}

			}
			auto ip = unique(fac.begin(), fac.end());
			fac.resize(distance(fac.begin(), ip));
			for(int t: fac) {
					cnt[t]++;
			}
	}
	for(int i=2;i<=sz;i++) {
			if(cnt[i] == n) {
					ans*=pow(i,cntPMin2[i]);
			}else if(cnt[i] == n-1) {
					ans*=pow(i,cntPMin[i]);
			}
	}
	cout<<ans<<endl;

}


/*
 ╔═══╦═══╦═══╗
 ║╔═╗║╔══╩╗╔╗║
 ║║░║║╚══╗║║║║
 ║║░║║╔══╝║║║║
 ║╚═╝║╚══╦╝╚╝║
 ╚══╗╠═══╩═══╝
 ░░░╚╝░░░░░░░░
 */

#include <bits/stdc++.h>
#define ll					long long
#define MOD					1000000007
#define MAX					1e9
#define MIN                 -1e9
#define PI					acos(-1.0)
#define vi					vector<int>
#define vii					vector<vi>
#define vll					vector<ll>
#define mid(s,e)			(s+(e-s)/2)
#define clz(n)				__builtin_clzll(n))

using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
template<typename T>
void printVec(const T &v, char sep=' ') {for (auto &i: v) cout << i << sep;}
template<typename T>
void printVecPair(const T &v, char sep=' ') {for (auto &i: v) cout << i.first <<" " << i.second<< sep;}

#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
const int sz = 220000;
vector<int> p[sz];
int main() {
	ios::sync_with_stdio(false);
 	cin.tie(0);
	int n;
	cin>>n;
	for(int _ = 0; _<n; _++) {
			int x; cin>>x;
			for(int j=2;j*j<=x;j++) {
					if(x%j == 0) {
							int cnt = 0;
							while(x%j == 0) {
									cnt++;
									x /= j;
							}
							p[j].push_back(cnt);
					}

			}
			if(x) {
					p[x].push_back(1);
			}

	}
	ll ans = 1;
	for(int i=1;i<sz;i++) {
			if(p[i].size() >= n-1) {
					sort(p[i].begin(), p[i].end());
					int k = p[i][(p[i].size() == n)];
					ans *= pow(i,k);
			}
	}
	cout<<ans;
	return 0;
}


/*
 ╔═══╦═══╦═══╗
 ║╔═╗║╔══╩╗╔╗║
 ║║░║║╚══╗║║║║
 ║║░║║╔══╝║║║║
 ║╚═╝║╚══╦╝╚╝║
 ╚══╗╠═══╩═══╝
 ░░░╚╝░░░░░░░░
 */

#include <bits/stdc++.h>
#define ll					long long
#define MOD					1000000007
#define MAX					1e9
#define MIN                 -1e9
#define PI					acos(-1.0)
#define vi					vector<int>
#define vii					vector<vi>
#define vll					vector<ll>
#define mid(s,e)			(s+(e-s)/2)
#define clz(n)				__builtin_clzll(n))

using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
template<typename T>
void printVec(const T &v, char sep=' ') {for (auto &i: v) cout << i << sep;}
template<typename T>
void printVecPair(const T &v, char sep=' ') {for (auto &i: v) cout << i.first <<" " << i.second<< sep;}

#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
vector<int> factors(int n) {
	vector<int> p;
   while (n%2 == 0){
      n = n/2;
	  p.push_back(2);
   }
   for (int i = 3; i <= sqrt(n); i = i+2){
      while (n%i == 0){
			  p.push_back(i);
         n = n/i;
      }
   }
   if (n > 2)
		   p.push_back(n);
   return p;
}
int main() {
	ios::sync_with_stdio(false);
 	cin.tie(0);
	int n;
	cin>>n;
	vi lc(n);
	for(int& i:lc) cin>>i;
	ll ans = 1;
	unordered_map<int,int> cntPMin;
	unordered_map<int,int> cntPMin2;
	unordered_map<int,int> cnt;
	int sz=MIN;
	for(int i: lc) {
			vector<int> fac = factors(i);
			debug(fac);
			unordered_map<int,bool> visited;
			for(int t: fac) {
					sz = max(sz,t);
					if(visited[t]) continue;
					if(cntPMin[t] == 0) cntPMin[t] = MAX;
					if(cntPMin2[t] == 0) cntPMin2[t] = MAX;
					visited[t] = 1;
					int cn = count(fac.begin(), fac.end(), t);
					if(cntPMin[t] > cn) {
							cntPMin[t] = cn;
					}else {
							cntPMin2[t] = min(cn,cntPMin2[t]);

					}

			}
			auto ip = unique(fac.begin(), fac.end());
			fac.resize(distance(fac.begin(), ip));
			for(int t: fac) {
					cnt[t]++;
			}
	}
	for(int i=2;i<=sz;i++) {
			if(cnt[i] == n) {
					ans*=pow(i,cntPMin2[i]);
			}else if(cnt[i] == n-1) {
					ans*=pow(i,cntPMin[i]);
			}
	}
	cout<<ans<<endl;

}


/*
 ╔═══╦═══╦═══╗
 ║╔═╗║╔══╩╗╔╗║
 ║║░║║╚══╗║║║║
 ║║░║║╔══╝║║║║
 ║╚═╝║╚══╦╝╚╝║
 ╚══╗╠═══╩═══╝
 ░░░╚╝░░░░░░░░
 */

#include <bits/stdc++.h>
#define ll					long long
#define MOD					1000000007
#define MAX					1e9
#define MIN                 -1e9
#define PI					acos(-1.0)
#define vi					vector<int>
#define vii					vector<vi>
#define vll					vector<ll>
#define mid(s,e)			(s+(e-s)/2)
#define clz(n)				__builtin_clzll(n))

using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
template<typename T>
void printVec(const T &v, char sep=' ') {for (auto &i: v) cout << i << sep;}
template<typename T>
void printVecPair(const T &v, char sep=' ') {for (auto &i: v) cout << i.first <<" " << i.second<< sep;}

#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
vector<int> factors(int n) {
	vector<int> p;
   while (n%2 == 0){
      n = n/2;
	  p.push_back(2);
   }
   for (int i = 3; i <= sqrt(n); i = i+2){
      while (n%i == 0){
			  p.push_back(i);
         n = n/i;
      }
   }
   if (n > 2)
		   p.push_back(n);
   return p;
}
int main() {
	ios::sync_with_stdio(false);
 	cin.tie(0);
	int n;
	cin>>n;
	vi lc(n);
	for(int& i:lc) cin>>i;
	int ans = 1;
	const int sz=11100;
	vector<int> cntPMin(sz,MAX);
	vector<int> cntPMin2(sz,MAX);
	vector<int> cnt(sz);
	for(int i: lc) {
			vector<int> fac = factors(i);
			bool visited[sz] = {false};
			for(int t: fac) {
					if(visited[t]) continue;
					visited[t] = 1;
					int cn = count(fac.begin(), fac.end(), t);
					if(cntPMin[t] > cn) {
							cntPMin[t] = cn;
					}else {
							cntPMin2[t] = min(cn,cntPMin2[t]);

					}

			}
			auto ip = unique(fac.begin(), fac.end());
			fac.resize(distance(fac.begin(), ip));
			for(int t: fac) {
					cnt[t]++;
			}
	}
	for(int i=2;i<=sz;i++) {
			if(cnt[i] == n) {
					ans*=pow(i,cntPMin2[i]);
			}else if(cnt[i] == n-1) {
					ans*=pow(i,cntPMin[i]);
			}
	}
	cout<<ans<<endl;

}


/*
 ╔═══╦═══╦═══╗
 ║╔═╗║╔══╩╗╔╗║
 ║║░║║╚══╗║║║║
 ║║░║║╔══╝║║║║
 ║╚═╝║╚══╦╝╚╝║
 ╚══╗╠═══╩═══╝
 ░░░╚╝░░░░░░░░
 */

#include <bits/stdc++.h>
#define ll					long long
#define MOD					1000000007
#define MAX					1e9
#define MIN                 -1e9
#define PI					acos(-1.0)
#define vi					vector<int>
#define vii					vector<vi>
#define vll					vector<ll>
#define mid(s,e)			(s+(e-s)/2)
#define clz(n)				__builtin_clzll(n))

using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
template<typename T>
void printVec(const T &v, char sep=' ') {for (auto &i: v) cout << i << sep;}
template<typename T>
void printVecPair(const T &v, char sep=' ') {for (auto &i: v) cout << i.first <<" " << i.second<< sep;}

#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
vector<ll> factors(int n) {
	vector<ll> p;
   while (n%2 == 0){
      n = n/2;
	  p.push_back(2);
   }
   for (int i = 3; i <= sqrt(n); i = i+2){
      while (n%i == 0){
			  p.push_back(i);
         n = n/i;
      }
   }
   if (n > 2)
		   p.push_back(n);
   return p;
}
int main() {
	ios::sync_with_stdio(false);
 	cin.tie(0);
	int n;
	cin>>n;
	vi lc(n);
	for(int& i:lc) cin>>i;
	ll ans = 1;
	unordered_map<ll, ll> cntPMin;
	unordered_map<ll,ll> cntPMin2;
	unordered_map<ll,ll> cnt;
	ll sz=MIN;
	for(int i: lc) {
			vector<ll> fac = factors(i);
			debug(fac);
			unordered_map<ll,bool> visited;
			for(ll t: fac) {
					sz = max(sz,t);
					if(visited[t]) continue;
					cnt[t]++;
					if(cntPMin[t] == 0) cntPMin[t] = MAX;
					if(cntPMin2[t] == 0) cntPMin2[t] = MAX;
					visited[t] = 1;
					ll cn = count(fac.begin(), fac.end(), t);
					if(cntPMin[t] > cn) {
							cntPMin2[t] = min(cntPMin[t],cntPMin2[t]);
							cntPMin[t] = cn;
					}else {
							cntPMin2[t] = min(cn,cntPMin2[t]);

					}

			}
	}
	for(int i=2;i<=sz;i++) {
			if(cnt[i] == n) {
					ans*=pow(i,cntPMin2[i]);
			}else if(cnt[i] == n-1) {
					ans*=pow(i,cntPMin[i]);
			}
	}
	cout<<ans<<endl;

}


/*
 ╔═══╦═══╦═══╗
 ║╔═╗║╔══╩╗╔╗║
 ║║░║║╚══╗║║║║
 ║║░║║╔══╝║║║║
 ║╚═╝║╚══╦╝╚╝║
 ╚══╗╠═══╩═══╝
 ░░░╚╝░░░░░░░░
 */

#include <bits/stdc++.h>
#define ll					long long
#define MOD					1000000007
#define MAX					1e9
#define MIN                 -1e9
#define PI					acos(-1.0)
#define vi					vector<int>
#define vii					vector<vi>
#define vll					vector<ll>
#define mid(s,e)			(s+(e-s)/2)
#define clz(n)				__builtin_clzll(n))

using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
template<typename T>
void printVec(const T &v, char sep=' ') {for (auto &i: v) cout << i << sep;}
template<typename T>
void printVecPair(const T &v, char sep=' ') {for (auto &i: v) cout << i.first <<" " << i.second<< sep;}

#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
vector<int> factors(int n) {
	vector<int> p;
   while (n%2 == 0){
      n = n/2;
	  p.push_back(2);
   }
   for (int i = 3; i <= sqrt(n); i = i+2){
      while (n%i == 0){
			  p.push_back(i);
         n = n/i;
      }
   }
   if (n > 2)
		   p.push_back(n);
   return p;
}
int main() {
	ios::sync_with_stdio(false);
 	cin.tie(0);
	int n;
	cin>>n;
	vi lc(n);
	for(int& i:lc) cin>>i;
	int ans = 1;
	const int sz=111100;
	unordered_map<int,int> cntPMin;
	unordered_map<int,int> cntPMin2;
	unordered_map<int,int> cnt;
	for(int i: lc) {
			vector<int> fac = factors(i);
			unordered_map<int,bool> visited;
			for(int t: fac) {
					if(visited[t]) continue;
					if(cntPMin[t] == 0) cntPMin[t] = MAX;
					if(cntPMin2[t] == 0) cntPMin2[t] = MAX;
					visited[t] = 1;
					int cn = count(fac.begin(), fac.end(), t);
					if(cntPMin[t] > cn) {
							cntPMin[t] = cn;
					}else {
							cntPMin2[t] = min(cn,cntPMin2[t]);

					}

			}
			auto ip = unique(fac.begin(), fac.end());
			fac.resize(distance(fac.begin(), ip));
			for(int t: fac) {
					cnt[t]++;
			}
	}
	for(int i=2;i<=sz;i++) {
			if(cnt[i] == n) {
					ans*=pow(i,cntPMin2[i]);
			}else if(cnt[i] == n-1) {
					ans*=pow(i,cntPMin[i]);
			}
	}
	cout<<ans<<endl;

}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define vi vector<int>
#define vli vector<long long int>
#define v(s) v.push_back(s)
#define mp make_pair
#define pb push_back
#define fs first
#define ins insert
#define sc second
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod 1000000007

long long int GCD(long long int A,long long int B) {
    if(B==0)
        return A;
    else
        return GCD(B, A % B);
}

int main(void)
{

	  IOS
	  int n;  cin>>n;  int a[n];ll f,ans,h=0,ff;
	  multimap<ll,ll>mm;
	  for(int i=0;i<n;i++)
	   cin>>a[i];

	   for(int i=0;i<n-1;i++)
	    {
	    	 for(int j=i+1;j<n;j++)
	    	  {
	    	  	 f=GCD(a[i]*1ll,a[j]*1ll);
	    	  	 ff=(a[i]*a[j])/f;
	    	  	 mm.ins(mp(h,ff));
	    	  	 h++;
			  }
		}
		multimap<ll,ll>::iterator it=mm.begin();
		ans=it->second;
		for(it;it!=mm.end();it++)
		 {

		 	  ans=GCD(ans,it->second)*1ll;
		 }
		 cout<<ans;

}

/*
int mexpo(int x,int n,int M)
{
    int result=1;
    while(n>0)
    {
        if(power % 2 ==1)
            result=(result * x)%M;
        x=(x*x)%M;
        n=n/2;
    }
    return result;
}
*/


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define vi vector<int>
#define vli vector<long long int>
#define v(s) v.push_back(s)
#define mp make_pair
#define pb push_back
#define fs first
#define ins insert
#define sc second
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod 1000000007
int32_t main(void)
{

	  IOS
	  int n;  cin>>n;  ll a[n],f,ans,h=0,ff;
	  multimap<ll,ll>ap;
	  for(int i=0;i<n;i++)
	   cin>>a[i];

	   for(int i=0;i<n-1;i++)
	    {
	    	 for(int j=i+1;j<n;j++)
	    	  {
	    	  	 f=__gcd(a[i],a[j]);
	    	  	 ff=(a[i]*a[j])/f;
	    	  	 ap.ins(mp(h,ff));
	    	  	 h++;
			  }
		}
		multimap<ll,ll>::iterator it=ap.begin();
		ans=it->second;
		for(it;it!=ap.end();it++)
		 {

		 	  ans=__gcd(ans,it->second);
		 }
		 cout<<ans;

}

/*
int mexpo(int x,int n,int M)
{
    int result=1;
    while(n>0)
    {
        if(power % 2 ==1)
            result=(result * x)%M;
        x=(x*x)%M;
        n=n/2;
    }
    return result;
}
*/


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define vi vector<int>
#define vli vector<long long int>
#define v(s) v.push_back(s)
#define mp make_pair
#define pb push_back
#define fs first
#define ins insert
#define sc second
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod 1000000007
int32_t main(void)
{

	  IOS
	  int n;  cin>>n;  ll a[n],f,ans,h=0,ff;
	  map<ll,ll>ap;
	  for(int i=0;i<n;i++)
	   cin>>a[i];

	   for(int i=0;i<n-1;i++)
	    {
	    	 for(int j=i+1;j<n;j++)
	    	  {
	    	  	 f=__gcd(a[i],a[j]);
	    	  	 ff=(a[i]*a[j])/f;
	    	  	 ap.ins(mp(h,ff));
	    	  	 h++;
			  }
		}
		map<ll,ll>::iterator it=ap.begin();
		ans=it->second;
		for(it;it!=ap.end();it++)
		 {

		 	  ans=__gcd(ans,it->second);
		 }
		 cout<<ans;

}

/*
int mexpo(int x,int n,int M)
{
    int result=1;
    while(n>0)
    {
        if(power % 2 ==1)
            result=(result * x)%M;
        x=(x*x)%M;
        n=n/2;
    }
    return result;
}
*/


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define vi vector<int>
#define vli vector<long long int>
#define v(s) v.push_back(s)
#define mp make_pair
#define pb push_back
#define fs first
#define ins insert
#define sc second
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod 1000000007

long long int GCD(long long int A,long long int B) {
    if(B==0)
        return A;
    else
        return GCD(B, A % B);
}

int main(void)
{

	  IOS
	  int n;  cin>>n;  ll hcf[n],a[n];  ll ans;
	  for(int i=0;i<n;i++)cin>>a[i];
	  for(int i=n-1;i>=0;i--)
	    {
	    	 if(i==n-1)
	    	  hcf[i]=a[i];
	    	 else
			  hcf[i]=__gcd(a[i],hcf[i+1]);
		}
		if(n==1)
		 cout<<hcf[0]<<endl;
		 else
		 {
	        for(int i=0;i<n-1;i++)
	        {
	   	       if(i==0)
	   	        ans=((a[i]*hcf[i+1])*1ll)/((__gcd(a[i],hcf[i+1]))*1ll);
	   	       else
	   	         ans=__gcd(ans,((a[i]*hcf[i+1])*1ll)/((__gcd(a[i],hcf[i+1]))*1ll));
	   }
	        cout<<ans;
	   }
}

/*
int mexpo(int x,int n,int M)
{
    int result=1;
    while(n>0)
    {
        if(power % 2 ==1)
            result=(result * x)%M;
        x=(x*x)%M;
        n=n/2;
    }
    return result;
}
*/


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define vi vector<int>
#define vli vector<long long int>
#define v(s) v.push_back(s)
#define mp make_pair
#define pb push_back
#define fs first
#define ins insert
#define sc second
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod 1000000007

long long int GCD(long long int A,long long int B) {
    if(B==0)
        return A;
    else
        return GCD(B, A % B);
}

int main(void)
{

	  IOS
	  int n;  cin>>n;  int a[n],k=0;ll f,ans;
	  multimap<int,ll>mm;
	  for(int i=0;i<n;i++)
	   cin>>a[i];

	   for(int i=0;i<n-1;i++)
	    {
	    	 for(int j=i+1;j<n;j++)
	    	  {
	    	  	 f=GCD(a[i]*1ll,a[j]*1ll);

	    	  	 mm.ins(mp(k,(a[i]/f)*(a[j])));
	    	  	 k++;
			  }
		}
		multimap<int,ll>::iterator it=mm.begin();
		ans=it->second;
		for(it;it!=mm.end();it++)
		 {

		 	  ans=GCD(ans,it->second)*1ll;
		 }
		 cout<<ans;

}

/*
int mexpo(int x,int n,int M)
{
    int result=1;
    while(n>0)
    {
        if(power % 2 ==1)
            result=(result * x)%M;
        x=(x*x)%M;
        n=n/2;
    }
    return result;
}
*/


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define vi vector<int>
#define vli vector<long long int>
#define v(s) v.push_back(s)
#define mp make_pair
#define pb push_back
#define fs first
#define ins insert
#define sc second
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod 1000000007
int32_t main(void)
{

	  IOS
	  int n;  cin>>n;  ll a[n],f,ans;
	  vli v;
	  for(int i=0;i<n;i++)
	   cin>>a[i];

	   for(int i=0;i<n-1;i++)
	    {
	    	 for(int j=i+1;j<n;j++)
	    	  {
	    	  	 f=__gcd(a[i],a[j]);
	    	  	 v.pb((a[i]*a[j])/f);
			  }
		}
		ans=v[0];
		for(int i=0;i<v.size();i++)
		 {
		 	 ans=__gcd(ans,v[i]);
		 }
		 cout<<ans;

}

/*
int mexpo(int x,int n,int M)
{
    int result=1;
    while(n>0)
    {
        if(power % 2 ==1)
            result=(result * x)%M;
        x=(x*x)%M;
        n=n/2;
    }
    return result;
}
*/


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define vi vector<int>
#define vli vector<long long int>
#define v(s) v.push_back(s)
#define mp make_pair
#define pb push_back
#define fs first
#define ins insert
#define sc second
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod 1000000007
int32_t main(void)
{

	  IOS
	  int n;  cin>>n;  ll a[n],f,ans,h=0,ff;
	  multimap<ll,ll>mm;
	  for(int i=0;i<n;i++)
	   cin>>a[i];

	   for(int i=0;i<n-1;i++)
	    {
	    	 for(int j=i+1;j<n;j++)
	    	  {
	    	  	 f=__gcd(a[i],a[j]);
	    	  	 ff=(a[i]*a[j])/f;
	    	  	 mm.ins(mp(h,ff));
	    	  	 h++;
			  }
		}
		multimap<ll,ll>::iterator it=mm.begin();
		ans=it->second;
		for(it;it!=mm.end();it++)
		 {

		 	  ans=__gcd(ans,it->second)*1ll;
		 }
		 cout<<ans;

}

/*
int mexpo(int x,int n,int M)
{
    int result=1;
    while(n>0)
    {
        if(power % 2 ==1)
            result=(result * x)%M;
        x=(x*x)%M;
        n=n/2;
    }
    return result;
}
*/


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define vi vector<int>
#define vli vector<long long int>
#define v(s) v.push_back(s)
#define mp make_pair
#define pb push_back
#define fs first
#define ins insert
#define sc second
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod 1000000007

long long int GCD(long long int A,long long int B) {
    if(B==0)
        return A;
    else
        return GCD(B, A % B);
}

int main(void)
{

	  IOS
	  int n;  cin>>n;  int a[n];ll f,ans;
	  multimap<ll,ll>mm;
	  for(int i=0;i<n;i++)
	   cin>>a[i];

	   for(int i=0;i<n-1;i++)
	    {
	    	 for(int j=i+1;j<n;j++)
	    	  {
	    	  	 f=GCD(a[i]*1ll,a[j]*1ll);

	    	  	 mm.ins(mp(f,(a[i]/f)*(a[j])));

			  }
		}
		multimap<ll,ll>::iterator it=mm.begin();
		ans=it->second;
		for(it;it!=mm.end();it++)
		 {

		 	  ans=GCD(ans,it->second)*1ll;
		 }
		 cout<<ans;

}

/*
int mexpo(int x,int n,int M)
{
    int result=1;
    while(n>0)
    {
        if(power % 2 ==1)
            result=(result * x)%M;
        x=(x*x)%M;
        n=n/2;
    }
    return result;
}
*/


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define vi vector<int>
#define vli vector<long long int>
#define v(s) v.push_back(s)
#define mp make_pair
#define pb push_back
#define fs first
#define ins insert
#define sc second
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod 1000000007

long long int GCD(long long int A,long long int B) {
    if(B==0)
        return A;
    else
        return GCD(B, A % B);
}

int main(void)
{

	  IOS
	  int n,ans;  cin>>n;  int hcf[n],a[n];
	  for(int i=0;i<n;i++)cin>>a[i];
	  for(int i=n-1;i>=0;i--)
	    {
	    	 if(i==n-1)
	    	  hcf[i]=a[i];
	    	 else
			  hcf[i]=__gcd(a[i],hcf[i+1]);
		}
		if(n==1)
		 cout<<hcf[0]<<endl;
		 else
		 {
	        for(int i=0;i<n-1;i++)
	        {
	   	       if(i==0)
	   	        ans=(a[i]*hcf[i+1])/(__gcd(a[i],hcf[i+1]));
	   	       else
	   	         ans=__gcd(ans,(a[i]*hcf[i+1])/(__gcd(a[i],hcf[i+1])));
	   }
	        cout<<ans;
	   }
}

/*
int mexpo(int x,int n,int M)
{
    int result=1;
    while(n>0)
    {
        if(power % 2 ==1)
            result=(result * x)%M;
        x=(x*x)%M;
        n=n/2;
    }
    return result;
}
*/


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define vi vector<int>
#define vli vector<long long int>
#define v(s) v.push_back(s)
#define mp make_pair
#define pb push_back
#define fs first
#define ins insert
#define sc second
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod 1000000007

long long int GCD(long long int A,long long int B) {
    if(B==0)
        return A;
    else
        return GCD(B, A % B);
}

int main(void)
{

	  IOS
	  int n;  cin>>n;  ll a[n],f,ans,h=0,ff;
	  multimap<ll,ll>mm;
	  for(int i=0;i<n;i++)
	   cin>>a[i];

	   for(int i=0;i<n-1;i++)
	    {
	    	 for(int j=i+1;j<n;j++)
	    	  {
	    	  	 f=GCD(a[i],a[j]);
	    	  	 ff=(a[i]*a[j])/f;
	    	  	 mm.ins(mp(h,ff));
	    	  	 h++;
			  }
		}
		multimap<ll,ll>::iterator it=mm.begin();
		ans=it->second;
		for(it;it!=mm.end();it++)
		 {

		 	  ans=GCD(ans,it->second)*1ll;
		 }
		 cout<<ans;

}

/*
int mexpo(int x,int n,int M)
{
    int result=1;
    while(n>0)
    {
        if(power % 2 ==1)
            result=(result * x)%M;
        x=(x*x)%M;
        n=n/2;
    }
    return result;
}
*/


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define vi vector<int>
#define vli vector<long long int>
#define v(s) v.push_back(s)
#define mp make_pair
#define pb push_back
#define fs first
#define ins insert
#define sc second
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod 1000000007

long long int GCD(long long int A,long long int B) {
    if(B==0)
        return A;
    else
        return GCD(B, A % B);
}

int main(void)
{

	  IOS
	  int n;  cin>>n;  int hcf[n],a[n];  ll ans;
	  for(int i=0;i<n;i++)cin>>a[i];
	  for(int i=n-1;i>=0;i--)
	    {
	    	 if(i==n-1)
	    	  hcf[i]=a[i];
	    	 else
			  hcf[i]=__gcd(a[i],hcf[i+1]);
		}
		if(n==1)
		 cout<<hcf[0]<<endl;
		 else
		 {
	        for(int i=0;i<n-1;i++)
	        {
	   	       if(i==0)
	   	        ans=((a[i]*hcf[i+1])*1ll)/((__gcd(a[i],hcf[i+1]))*1ll);
	   	       else
	   	         ans=__gcd(ans,((a[i]*hcf[i+1])*1ll)/((__gcd(a[i],hcf[i+1]))*1ll));
	   }
	        cout<<ans;
	   }
}

/*
int mexpo(int x,int n,int M)
{
    int result=1;
    while(n>0)
    {
        if(power % 2 ==1)
            result=(result * x)%M;
        x=(x*x)%M;
        n=n/2;
    }
    return result;
}
*/


#include <bits/stdc++.h>
using namespace std;

//____________________________________________________________________________________________________________________________________

#define PI  2*acos(0.0)
#define pf  printf
#define sf  scan
#define ff  first
#define ss  second
#define mp  make_pair
#define pb  push_back
typedef long long ll;
typedef unsigned long long ull;
typedef std::vector<int> vi;
typedef vector<long long> vll ;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define sc(n)       scanf("%d",&n);
#define scf(f)      scanf("%f",&f);
#define FOR(i,a,n)  for(int i = a; i < n; i++)
#define TEST(test)  for(int cse = 1; cse <= test; cse++)
#define all(x) (x).begin(), (x).end()
#define fap(x) cout << _LINE_ << " says: " << #x << " = " << x << "\n"
#define FastIO ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mst(arr, n) memset(arr, n, sizeof arr)
const ll INF = 2000000000000000000LL;
const int inf = 0x3f3f3f3f;
const long double EPS = 1e-9;
const ll MOD = 1e9 + 7;
template <class T> inline T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
//____________________________________________________________________________________________________________________________________

const int maxn = 2e5 + 100;

ll n, lim = -1;
std::vector<ll> v(maxn);
bool isprime[maxn];
void primegen(int lim)
{
    for(int i = 2; i * i <= lim + 2; i++)
    {
        if(!isprime[i])
        {
            for(int j = i * i; j <= lim; j+= i)
                isprime[j] = 1;
        }
    }
}

bool nibo(ll value)
{
    int cnt = 0;
    for(int i = 0; i < n; i++ )
        if(v[i] % value == 0) cnt++;
    if(cnt >= n - 1) return 1;

    return 0;
}
int main()
{
#ifdef PARTHO
   freopen("C:\\Users\\rnoji\\Desktop\\Partho Code\\IO\\input.txt","r",stdin);
   freopen("C:\\Users\\rnoji\\Desktop\\Partho Code\\IO\\output.txt","w",stdout);
   int start_time = clock();
#endif
FastIO;

cin >> n;
for(int i = 0; i < n; i++)
{
    cin >> v[i];
    lim = max(lim, v[i]);
}
primegen(lim);

ll mxgcd = 1;
for(ll i = 2; i <= lim; i++)
{
    if(!isprime[i])
    {
        ll div = i;
        while(nibo(div))
        {
            mxgcd *= i;
            div *= i;
        }
    }
}

cout << mxgcd << endl;

#ifdef PARTHO
   int end_time = clock();
   printf("Time = %.4f\n",(end_time-start_time+0.0)/CLOCKS_PER_SEC);
#endif

    return 0;
}
///Before submit=>
///    *check for integer overflow,array bounds
///    *check for n=1


#include <bits/stdc++.h>
using namespace std;

//____________________________________________________________________________________________________________________________________

#define PI  2*acos(0.0)
#define pf  printf
#define sf  scan
#define ff  first
#define ss  second
#define mp  make_pair
#define pb  push_back
typedef long long ll;
typedef unsigned long long ull;
typedef std::vector<int> vi;
typedef vector<long long> vll ;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define sc(n)       sf("%d",&n);
#define scf(f)      sf("%f",&f);
#define FOR(i,a,n)  for(int i = a; i < n; i++)
#define TEST(test)  for(int cse = 1; cse <= test; cse++)
#define all(x) (x).begin(), (x).end()
#define fap(x) cout << __LINE__ << " says: " << #x << " = " << x << "\n"
#define FastIO ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mst(arr, n) memset(arr, n, sizeof arr)
const ll INF = 2000000000000000000LL;
const int inf = 0x3f3f3f3f;
const long double EPS = 1e-9;
const ll MOD = 1e9 + 7;
template <class T> inline T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
//____________________________________________________________________________________________________________________________________

ll lcm(ll a, ll b)
{
   return (a * b) / gcd( a, b);
}

int main()
{
#ifdef PARTHO
   freopen("C:\\Users\\rnoji\\Desktop\\Partho Code\\IO\\input.txt","r",stdin);
   freopen("C:\\Users\\rnoji\\Desktop\\Partho Code\\IO\\output.txt","w",stdout);
   int start_time = clock();
#endif
//FastIO;

int n;
cin >> n;
std::vector<ll> v(n);

for(int i = 0; i < n; i++)
{
   cin >> v[i];
}

set<ll> st;

ll lc;
for(int i = 0; i < v.size(); i++)
{
   for(int j = i + 1;j < min((int)v.size(),10000); j++)
   {
      lc = lcm(v[i], v[j]);
      st.insert(lc);
   }
}

ll gd = *st.begin();

for(auto it : st)
{
   gd = gcd(it, gd);
}

cout << gd << endl;

#ifdef PARTHO
   int end_time = clock();
   printf("Time = %.4f\n",(end_time-start_time+0.0)/CLOCKS_PER_SEC);
#endif

    return 0;
}
///Before submit=>
///    *check for integer overflow,array bounds
///    *check for n=1


#include <bits/stdc++.h>
using namespace std;

//____________________________________________________________________________________________________________________________________

#define PI  2*acos(0.0)
#define pf  printf
#define sf  scan
#define ff  first
#define ss  second
#define mp  make_pair
#define pb  push_back
typedef long long ll;
typedef unsigned long long ull;
typedef std::vector<int> vi;
typedef vector<long long> vll ;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define sc(n)       scanf("%d",&n);
#define scf(f)      scanf("%f",&f);
#define FOR(i,a,n)  for(int i = a; i < n; i++)
#define TEST(test)  for(int cse = 1; cse <= test; cse++)
#define all(x) (x).begin(), (x).end()
#define fap(x) cout << __LINE__ << " says: " << #x << " = " << x << "\n"
#define FastIO ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mst(arr, n) memset(arr, n, sizeof arr)
const ll INF = 2000000000000000000LL;
const int inf = 0x3f3f3f3f;
const long double EPS = 1e-9;
const ll MOD = 1e9 + 7;
template <class T> inline T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
//____________________________________________________________________________________________________________________________________

const int maxn = 2e5 + 100;

ll n, lim = -1;
ll v[maxn];
bool isprime[maxn];
void primegen(int lim)
{
    for(int i = 2; i * i <= lim + 2; i++)
    {
        if(!isprime[i])
        {
            for(int j = i * i; j <= lim; j+= i)
                isprime[j] = 1;
        }
    }
}

bool nibo(ll x)
{
    int cnt = 0;
    for(int i = x; i <= lim; i+= x) {
        if(v[i]) cnt+= v[i];
    }

    if(cnt >= n - 1) return 1;
    return 0;
}
int main()
{
#ifdef PARTHO
   freopen("C:\\Users\\rnoji\\Desktop\\Partho Code\\IO\\input.txt","r",stdin);
   freopen("C:\\Users\\rnoji\\Desktop\\Partho Code\\IO\\output.txt","w",stdout);
   int start_time = clock();
#endif
//FastIO;

cin >> n;
ll value;
for(int i = 0; i < n; i++)
{
    cin >> value;
    v[value]++;
    lim = max(lim, value);
}
primegen(lim);

ll mxgcd = 1;
for(ll i = 2; i <= lim; i++)
{
    if(!isprime[i])
    {
        ll div = i;
        while(nibo(div))
        {
            mxgcd *= i;
            div *= i;
        }
    }
}

cout << mxgcd << endl;

#ifdef PARTHO
   int end_time = clock();
   printf("Time = %.4f\n",(end_time-start_time+0.0)/CLOCKS_PER_SEC);
#endif

    return 0;
}
///Before submit=>
///    *check for integer overflow,array bounds
///    *check for n=1


#include <bits/stdc++.h>
using namespace std;
//____________________________________________________________________________________________________________________________________
#define PI  2*acos(0.0)
#define pf  printf
#define sf  scan
#define ff  first
#define ss  second
#define mp  make_pair
#define pb  push_back
typedef long long ll;
typedef unsigned long long ull;
typedef std::vector<int> vi;
typedef vector<long long> vll ;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define sc(n)       scanf("%d",&n);
#define scf(f)      scanf("%f",&f);
#define FOR(i,a,n)  for(int i = a; i < n; i++)
#define TEST(test)  for(int cse = 1; cse <= test; cse++)
#define all(x) (x).begin(), (x).end()
#define fap(x) cout << __LINE__ << " says: " << #x << " = " << x << "\n"
#define FastIO ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mst(arr, n) memset(arr, n, sizeof arr)
const ll INF = 2000000000000000000LL;
const int inf = 0x3f3f3f3f;
const long double EPS = 1e-9;
const ll MOD = 1e9 + 7;
template <class T> inline T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
//____________________________________________________________________________________________________________________________________
const int maxn = 2e5 + 100;
ll n, lim = -1;
int v[maxn];
bool isprime[maxn];
void primegen(int lim)
{
    for(int i = 2; i * i <= lim + 2; i++)
    {
        if(!isprime[i])
        {
            for(int j = i * i; j <= lim; j+= i)
                isprime[j] = 1;
        }
    }
}
bool nibo(ll x)
{
    int cnt = 0;
    for(int i = x; i <= lim; i+= x)
    {
        if(v[i]) cnt+= v[i];
    }
    if(cnt >= n - 1) return 1;
    return 0;
}
int main()
{
#ifdef PARTHO
   freopen("C:\\Users\\rnoji\\Desktop\\Partho Code\\IO\\input.txt","r",stdin);
   freopen("C:\\Users\\rnoji\\Desktop\\Partho Code\\IO\\output.txt","w",stdout);
   int start_time = clock();
#endif
FastIO;
cin >> n;
ll value;
for(int i = 0; i < n; i++)
{
    cin >> value;
    v[value]++;
    lim = max(lim, value);
}
primegen(lim);
ll mxgcd = 1;
for(ll i = 2; i <= lim; i++)
{
    if(!isprime[i])
    {
        ll div = i;
        while(nibo(div))
        {
            mxgcd *= i;
            div *= i;
        }
    }
}
cout << mxgcd << endl;
#ifdef PARTHO
   int end_time = clock();
   printf("Time = %.4f\n",(end_time-start_time+0.0)/CLOCKS_PER_SEC);
#endif
    return 0;
}
///Before submit=>
///    *check for integer overflow,array bounds
///    *check for n=1


#include <bits/stdc++.h>
using namespace std;

//____________________________________________________________________________________________________________________________________

#define PI  2*acos(0.0)
#define pf  printf
#define sf  scan
#define ff  first
#define ss  second
#define mp  make_pair
#define pb  push_back
typedef long long ll;
typedef unsigned long long ull;
typedef std::vector<int> vi;
typedef vector<long long> vll ;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define sc(n)       sf("%d",&n);
#define scf(f)      sf("%f",&f);
#define FOR(i,a,n)  for(int i = a; i < n; i++)
#define TEST(test)  for(int cse = 1; cse <= test; cse++)
#define all(x) (x).begin(), (x).end()
#define fap(x) cout << __LINE__ << " says: " << #x << " = " << x << "\n"
#define FastIO ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mst(arr, n) memset(arr, n, sizeof arr)
const ll INF = 2000000000000000000LL;
const int inf = 0x3f3f3f3f;
const long double EPS = 1e-9;
const ll MOD = 1e9 + 7;
template <class T> inline T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
//____________________________________________________________________________________________________________________________________

ll lcm(ll a, ll b)
{
   return (a * b) / gcd( a, b);
}

int main()
{
#ifdef PARTHO
   freopen("C:\\Users\\rnoji\\Desktop\\Partho Code\\IO\\input.txt","r",stdin);
   freopen("C:\\Users\\rnoji\\Desktop\\Partho Code\\IO\\output.txt","w",stdout);
   int start_time = clock();
#endif
//FastIO;

int n;
cin >> n;
std::vector<ll> v(n);

for(int i = 0; i < n; i++)
{
   cin >> v[i];
}

set<ll> st;

ll lc;
sort(all(v), greater<int>());
for(int i = 0; i < v.size(); i++)
{
   for(int j = i + 1;j < min((int)v.size(),10000); j++)
   {
      lc = lcm(v[i], v[j]);
      st.insert(lc);
   }
}

ll gd = *st.begin();

for(auto it : st)
{
   gd = gcd(it, gd);
}

cout << gd << endl;

#ifdef PARTHO
   int end_time = clock();
   printf("Time = %.4f\n",(end_time-start_time+0.0)/CLOCKS_PER_SEC);
#endif

    return 0;
}
///Before submit=>
///    *check for integer overflow,array bounds
///    *check for n=1


#include <bits/stdc++.h>
using namespace std;

//____________________________________________________________________________________________________________________________________

#define PI  2*acos(0.0)
#define pf  printf
#define sf  scan
#define ff  first
#define ss  second
#define mp  make_pair
#define pb  push_back
typedef long long ll;
typedef unsigned long long ull;
typedef std::vector<int> vi;
typedef vector<long long> vll ;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define sc(n)       sf("%d",&n);
#define scf(f)      sf("%f",&f);
#define FOR(i,a,n)  for(int i = a; i < n; i++)
#define TEST(test)  for(int cse = 1; cse <= test; cse++)
#define all(x) (x).begin(), (x).end()
#define fap(x) cout << __LINE__ << " says: " << #x << " = " << x << "\n"
#define FastIO ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mst(arr, n) memset(arr, n, sizeof arr)
const ll INF = 2000000000000000000LL;
const int inf = 0x3f3f3f3f;
const long double EPS = 1e-9;
const ll MOD = 1e9 + 7;
template <class T> inline T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
//____________________________________________________________________________________________________________________________________

ll lcm(ll a, ll b)
{
   return (a * b) / gcd( a, b);
}

int main()
{
#ifdef PARTHO
   freopen("C:\\Users\\rnoji\\Desktop\\Partho Code\\IO\\input.txt","r",stdin);
   freopen("C:\\Users\\rnoji\\Desktop\\Partho Code\\IO\\output.txt","w",stdout);
   int start_time = clock();
#endif
//FastIO;

int n;
cin >> n;
std::vector<ll> v(n);

for(int i = 0; i < n; i++)
{
   cin >> v[i];
}

set<ll> st;

ll lc;
for(int i = 0; i < v.size(); i++)
{
   for(int j = i + 1;j < v.size(); j++)
   {
      lc = lcm(v[i], v[j]);
      st.insert(lc);
   }
}

ll gd = *st.begin();

for(auto it : st)
{
   gd = gcd(it, gd);
}

cout << gd << endl;

#ifdef PARTHO
   int end_time = clock();
   printf("Time = %.4f\n",(end_time-start_time+0.0)/CLOCKS_PER_SEC);
#endif

    return 0;
}
///Before submit=>
///    *check for integer overflow,array bounds
///    *check for n=1


#include <bits/stdc++.h>
using namespace std;

//____________________________________________________________________________________________________________________________________

#define PI  2*acos(0.0)
#define pf  printf
#define sf  scan
#define ff  first
#define ss  second
#define mp  make_pair
#define pb  push_back
typedef long long ll;
typedef unsigned long long ull;
typedef std::vector<int> vi;
typedef vector<long long> vll ;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define sc(n)       scanf("%d",&n);
#define scf(f)      scanf("%f",&f);
#define FOR(i,a,n)  for(int i = a; i < n; i++)
#define TEST(test)  for(int cse = 1; cse <= test; cse++)
#define all(x) (x).begin(), (x).end()
#define fap(x) cout << __LINE__ << " says: " << #x << " = " << x << "\n"
#define FastIO ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mst(arr, n) memset(arr, n, sizeof arr)
const ll INF = 2000000000000000000LL;
const int inf = 0x3f3f3f3f;
const long double EPS = 1e-9;
const ll MOD = 1e9 + 7;
template <class T> inline T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
//____________________________________________________________________________________________________________________________________

const int maxn = 2e5 + 100;

ll n, lim = -1;
ll v[maxn];
bool isprime[maxn];
void primegen(int lim)
{
    for(int i = 2; i * i <= lim + 2; i++)
    {
        if(!isprime[i])
        {
            for(int j = i * i; j <= lim; j+= i)
                isprime[j] = 1;
        }
    }
}

bool nibo(ll x)
{
    int cnt = 0;
    for(int i = x; i <= lim; i+= x) {
        if(v[i]) cnt+= v[i];
    }

    if(cnt >= n - 1) return 1;
    return 0;
}
int main()
{
#ifdef PARTHO
   freopen("C:\\Users\\rnoji\\Desktop\\Partho Code\\IO\\input.txt","r",stdin);
   freopen("C:\\Users\\rnoji\\Desktop\\Partho Code\\IO\\output.txt","w",stdout);
   int start_time = clock();
#endif
FastIO;

cin >> n;
ll value;
for(int i = 0; i < n; i++)
{
    cin >> value;
    v[value]++;
    lim = max(lim, value);
}
primegen(lim);

ll mxgcd = 1;
for(ll i = 2; i <= lim; i++)
{
    if(!isprime[i])
    {
        ll div = i;
        while(nibo(div))
        {
            mxgcd *= i;
            div *= i;
        }
    }
}

cout << mxgcd << endl;

#ifdef PARTHO
   int end_time = clock();
   printf("Time = %.4f\n",(end_time-start_time+0.0)/CLOCKS_PER_SEC);
#endif

    return 0;
}
///Before submit=>
///    *check for integer overflow,array bounds
///    *check for n=1


#include <bits/stdc++.h>
using namespace std;

//____________________________________________________________________________________________________________________________________

#define PI  2*acos(0.0)
#define pf  printf
#define sf  scan
#define ff  first
#define ss  second
#define mp  make_pair
#define pb  push_back
typedef long long ll;
typedef unsigned long long ull;
typedef std::vector<int> vi;
typedef vector<long long> vll ;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define sc(n)       sf("%d",&n);
#define scf(f)      sf("%f",&f);
#define FOR(i,a,n)  for(int i = a; i < n; i++)
#define TEST(test)  for(int cse = 1; cse <= test; cse++)
#define all(x) (x).begin(), (x).end()
#define fap(x) cout << __LINE__ << " says: " << #x << " = " << x << "\n"
#define FastIO ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mst(arr, n) memset(arr, n, sizeof arr)
const ll INF = 2000000000000000000LL;
const int inf = 0x3f3f3f3f;
const long double EPS = 1e-9;
const ll MOD = 1e9 + 7;
template <class T> inline T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
//____________________________________________________________________________________________________________________________________

ll lcm(ll a, ll b)
{
   return (a * b) / gcd( a, b);
}

int main()
{
#ifdef PARTHO
   freopen("C:\\Users\\rnoji\\Desktop\\Partho Code\\IO\\input.txt","r",stdin);
   freopen("C:\\Users\\rnoji\\Desktop\\Partho Code\\IO\\output.txt","w",stdout);
   int start_time = clock();
#endif
//FastIO;

int n;
cin >> n;
std::vector<ll> v(n);

for(int i = 0; i < n; i++)
{
   cin >> v[i];
}

set<ll> st;

ll lc;
sort(all(v));
for(int i = 0; i < v.size(); i++)
{
   for(int j = i + 1;j < min((int)v.size(),20000); j++)
   {
      lc = lcm(v[i], v[j]);
      st.insert(lc);
   }
}

ll gd = *st.begin();

for(auto it : st)
{
   gd = gcd(it, gd);
}

cout << gd << endl;

#ifdef PARTHO
   int end_time = clock();
   printf("Time = %.4f\n",(end_time-start_time+0.0)/CLOCKS_PER_SEC);
#endif

    return 0;
}
///Before submit=>
///    *check for integer overflow,array bounds
///    *check for n=1


#include <bits/stdc++.h>
using namespace std;

//____________________________________________________________________________________________________________________________________

#define PI  2*acos(0.0)
#define pf  printf
#define sf  scan
#define ff  first
#define ss  second
#define mp  make_pair
#define pb  push_back
typedef long long ll;
typedef unsigned long long ull;
typedef std::vector<int> vi;
typedef vector<long long> vll ;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define sc(n)       sf("%d",&n);
#define scf(f)      sf("%f",&f);
#define FOR(i,a,n)  for(int i = a; i < n; i++)
#define TEST(test)  for(int cse = 1; cse <= test; cse++)
#define all(x) (x).begin(), (x).end()
#define fap(x) cout << __LINE__ << " says: " << #x << " = " << x << "\n"
#define FastIO ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mst(arr, n) memset(arr, n, sizeof arr)
const ll INF = 2000000000000000000LL;
const int inf = 0x3f3f3f3f;
const long double EPS = 1e-9;
const ll MOD = 1e9 + 7;
template <class T> inline T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
//____________________________________________________________________________________________________________________________________

ll lcm(ll a, ll b)
{
   return (a * b) / gcd( a, b);
}

int main()
{
#ifdef PARTHO
   freopen("C:\\Users\\rnoji\\Desktop\\Partho Code\\IO\\input.txt","r",stdin);
   freopen("C:\\Users\\rnoji\\Desktop\\Partho Code\\IO\\output.txt","w",stdout);
   int start_time = clock();
#endif
//FastIO;

int n;
cin >> n;
std::vector<ll> v(n);

for(int i = 0; i < n; i++)
{
   cin >> v[i];
}

set<ll> st;

ll lc;
sort(all(v));
for(int i = 0; i < v.size(); i++)
{
   for(int j = i + 1;j < min((int)v.size(),1000); j++)
   {
      lc = lcm(v[i], v[j]);
      st.insert(lc);
   }
}

ll gd = *st.begin();

for(auto it : st)
{
   gd = gcd(it, gd);
}

cout << gd << endl;

#ifdef PARTHO
   int end_time = clock();
   printf("Time = %.4f\n",(end_time-start_time+0.0)/CLOCKS_PER_SEC);
#endif

    return 0;
}
///Before submit=>
///    *check for integer overflow,array bounds
///    *check for n=1


#include <bits/stdc++.h>
using namespace std;

//____________________________________________________________________________________________________________________________________

#define PI  2*acos(0.0)
#define pf  printf
#define sf  scan
#define ff  first
#define ss  second
#define mp  make_pair
#define pb  push_back
typedef long long ll;
typedef unsigned long long ull;
typedef std::vector<int> vi;
typedef vector<long long> vll ;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define sc(n)       scanf("%d",&n);
#define scf(f)      scanf("%f",&f);
#define FOR(i,a,n)  for(int i = a; i < n; i++)
#define TEST(test)  for(int cse = 1; cse <= test; cse++)
#define all(x) (x).begin(), (x).end()
#define fap(x) cout << _LINE_ << " says: " << #x << " = " << x << "\n"
#define FastIO ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mst(arr, n) memset(arr, n, sizeof arr)
const ll INF = 2000000000000000000LL;
const int inf = 0x3f3f3f3f;
const long double EPS = 1e-9;
const ll MOD = 1e9 + 7;
template <class T> inline T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
//____________________________________________________________________________________________________________________________________

const int maxn = 2e5 + 100;

ll n, lim = -1;
std::vector<ll> v(maxn);
bool isprime[maxn];
void primegen(int lim)
{
    for(int i = 2; i * i <= lim + 2; i++)
    {
        if(!isprime[i])
        {
            for(int j = i * i; j <= lim; j+= i)
                isprime[j] = 1;
        }
    }
}

bool nibo(ll value)
{
    int cnt = 0;
    for(int i = 0; i < n; i++ )
        if(v[i] % value == 0) cnt++;
    if(cnt >= n - 1) return 1;

    return 0;
}
int main()
{
#ifdef PARTHO
   freopen("C:\\Users\\rnoji\\Desktop\\Partho Code\\IO\\input.txt","r",stdin);
   freopen("C:\\Users\\rnoji\\Desktop\\Partho Code\\IO\\output.txt","w",stdout);
   int start_time = clock();
#endif
//FastIO;

cin >> n;
for(int i = 0; i < n; i++)
{
    cin >> v[i];
    lim = max(lim, v[i]);
}
primegen(lim);

ll mxgcd = 1;
for(ll i = 2; i <= lim; i++)
{
    if(!isprime[i])
    {
        ll div = i;
        while(nibo(div))
        {
            mxgcd *= i;
            div *= i;
        }
    }
}

cout << mxgcd << endl;

#ifdef PARTHO
   int end_time = clock();
   printf("Time = %.4f\n",(end_time-start_time+0.0)/CLOCKS_PER_SEC);
#endif

    return 0;
}
///Before submit=>
///    *check for integer overflow,array bounds
///    *check for n=1


#include <bits/stdc++.h>
using namespace std;

//____________________________________________________________________________________________________________________________________

#define PI  2*acos(0.0)
#define pf  printf
#define sf  scan
#define ff  first
#define ss  second
#define mp  make_pair
#define pb  push_back
typedef long long ll;
typedef unsigned long long ull;
typedef std::vector<int> vi;
typedef vector<long long> vll ;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define sc(n)       sf("%d",&n);
#define scf(f)      sf("%f",&f);
#define FOR(i,a,n)  for(int i = a; i < n; i++)
#define TEST(test)  for(int cse = 1; cse <= test; cse++)
#define all(x) (x).begin(), (x).end()
#define fap(x) cout << __LINE__ << " says: " << #x << " = " << x << "\n"
#define FastIO ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mst(arr, n) memset(arr, n, sizeof arr)
const ll INF = 2000000000000000000LL;
const int inf = 0x3f3f3f3f;
const long double EPS = 1e-9;
const ll MOD = 1e9 + 7;
template <class T> inline T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
//____________________________________________________________________________________________________________________________________

ll lcm(ll a, ll b)
{
   return (a * b) / gcd( a, b);
}

int main()
{
#ifdef PARTHO
   freopen("C:\\Users\\rnoji\\Desktop\\Partho Code\\IO\\input.txt","r",stdin);
   freopen("C:\\Users\\rnoji\\Desktop\\Partho Code\\IO\\output.txt","w",stdout);
   int start_time = clock();
#endif
//FastIO;

int n;
cin >> n;
std::vector<ll> v(n);

for(int i = 0; i < n; i++)
{
   cin >> v[i];
}

set<ll> st;

ll lc;
sort(all(v));
for(int i = 0; i < v.size(); i++)
{
   for(int j = i + 1;j < min((int)v.size(),80000); j++)
   {
      lc = lcm(v[i], v[j]);
      st.insert(lc);
   }
}

ll gd = *st.begin();

for(auto it : st)
{
   gd = gcd(it, gd);
}

cout << gd << endl;

#ifdef PARTHO
   int end_time = clock();
   printf("Time = %.4f\n",(end_time-start_time+0.0)/CLOCKS_PER_SEC);
#endif

    return 0;
}
///Before submit=>
///    *check for integer overflow,array bounds
///    *check for n=1


#include <bits/stdc++.h>
using namespace std;

//____________________________________________________________________________________________________________________________________

#define PI  2*acos(0.0)
#define pf  printf
#define sf  scan
#define ff  first
#define ss  second
#define mp  make_pair
#define pb  push_back
typedef long long ll;
typedef unsigned long long ull;
typedef std::vector<int> vi;
typedef vector<long long> vll ;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define sc(n)       sf("%d",&n);
#define scf(f)      sf("%f",&f);
#define FOR(i,a,n)  for(int i = a; i < n; i++)
#define TEST(test)  for(int cse = 1; cse <= test; cse++)
#define all(x) (x).begin(), (x).end()
#define fap(x) cout << __LINE__ << " says: " << #x << " = " << x << "\n"
#define FastIO ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mst(arr, n) memset(arr, n, sizeof arr)
const ll INF = 2000000000000000000LL;
const int inf = 0x3f3f3f3f;
const long double EPS = 1e-9;
const ll MOD = 1e9 + 7;
template <class T> inline T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
//____________________________________________________________________________________________________________________________________

ll lcm(ll a, ll b)
{
   return (a * b) / gcd( a, b);
}

int main()
{
#ifdef PARTHO
   freopen("C:\\Users\\rnoji\\Desktop\\Partho Code\\IO\\input.txt","r",stdin);
   freopen("C:\\Users\\rnoji\\Desktop\\Partho Code\\IO\\output.txt","w",stdout);
   int start_time = clock();
#endif
//FastIO;

int n;
cin >> n;
std::vector<ll> v(n);

for(int i = 0; i < n; i++)
{
   cin >> v[i];
}

set<ll> st;

ll lc;
sort(all(v));
for(int i = 0; i < v.size(); i++)
{
   for(int j = i + 1;j < min((int)v.size(),10000); j++)
   {
      lc = lcm(v[i], v[j]);
      st.insert(lc);
   }
}

ll gd = *st.begin();

for(auto it : st)
{
   gd = gcd(it, gd);
}

cout << gd << endl;

#ifdef PARTHO
   int end_time = clock();
   printf("Time = %.4f\n",(end_time-start_time+0.0)/CLOCKS_PER_SEC);
#endif

    return 0;
}
///Before submit=>
///    *check for integer overflow,array bounds
///    *check for n=1


#include <bits/stdc++.h>
using namespace std;

//____________________________________________________________________________________________________________________________________

#define PI  2*acos(0.0)
#define pf  printf
#define sf  scan
#define ff  first
#define ss  second
#define mp  make_pair
#define pb  push_back
typedef long long ll;
typedef unsigned long long ull;
typedef std::vector<int> vi;
typedef vector<long long> vll ;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define sc(n)       sf("%d",&n);
#define scf(f)      sf("%f",&f);
#define FOR(i,a,n)  for(int i = a; i < n; i++)
#define TEST(test)  for(int cse = 1; cse <= test; cse++)
#define all(x) (x).begin(), (x).end()
#define fap(x) cout << __LINE__ << " says: " << #x << " = " << x << "\n"
#define FastIO ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mst(arr, n) memset(arr, n, sizeof arr)
const ll INF = 2000000000000000000LL;
const int inf = 0x3f3f3f3f;
const long double EPS = 1e-9;
const ll MOD = 1e9 + 7;
template <class T> inline T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
//____________________________________________________________________________________________________________________________________

ll lcm(ll a, ll b)
{
   return (a * b) / gcd( a, b);
}

int main()
{
#ifdef PARTHO
   freopen("C:\\Users\\rnoji\\Desktop\\Partho Code\\IO\\input.txt","r",stdin);
   freopen("C:\\Users\\rnoji\\Desktop\\Partho Code\\IO\\output.txt","w",stdout);
   int start_time = clock();
#endif
//FastIO;

int n;
cin >> n;
std::vector<ll> v(n);

for(int i = 0; i < n; i++)
{
   cin >> v[i];
}

set<ll> st;

ll lc;
sort(all(v));
for(int i = 0; i < v.size(); i++)
{
   for(int j = i + 1;j < min((int)v.size(),50000); j++)
   {
      lc = lcm(v[i], v[j]);
      st.insert(lc);
   }
}

ll gd = *st.begin();

for(auto it : st)
{
   gd = gcd(it, gd);
}

cout << gd << endl;

#ifdef PARTHO
   int end_time = clock();
   printf("Time = %.4f\n",(end_time-start_time+0.0)/CLOCKS_PER_SEC);
#endif

    return 0;
}
///Before submit=>
///    *check for integer overflow,array bounds
///    *check for n=1


/* Isn't passion overrated?*/

#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long
#define mod 1000000007
using namespace std;
ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
int main()
{
    ios_base:: sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
    ll n;
    cin>>n;
    ll arr[n];
    vector<ll>prime(2000010);
    vector<ll>temp;
    for(ll i = 2; i <= sqrt(2000010); i++)
    {
        if(prime[i] == 1)
            continue;
        temp.pb(i);
        for(ll j = 2; i*j <= 2000010; j++)
            prime[i*j] = 1;
    }
    for(ll i = 0; i < n; i++)
        cin>>arr[i];
    unordered_map<ll,vector<ll> >m;
    for(ll i = 0; i < n; i++)
    {
        ll a = arr[i];
        for(ll j = 0; j < temp.size(); j++)
        {
            ll c = 0;
            while(a % temp[j] == 0 && a != 1)
            {
                a /= temp[j];
                c++;
            }
            m[temp[j]].pb(c);
        }
    }
    ll ans = 1;
    for(ll i = 0; i <temp.size(); i++)
    {
        sort(m[temp[i]].begin(), m[temp[i]].end());
        ll o = pow(temp[i], m[temp[i]][1]);
        ans = ans * o;
    }
    cout<<ans;
    return 0;
}


/* Isn't passion overrated?*/

#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long
#define mod 1000000007
using namespace std;
ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
int main()
{
    ios_base:: sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
    ll n;
    cin>>n;
    ll arr[n];
    vector<ll>prime(100010);
    vector<ll>temp;
    for(ll i = 2; i <= sqrt(100010); i++)
    {
        if(prime[i] == 1)
            continue;
        for(ll j = 2; i*j < 100010; j++)
            prime[i*j] = 1;
    }
    for(ll i = 2; i < 100010; i++)
    {
        if(prime[i] == 0)
            temp.pb(i);
    }
    for(ll i = 0; i < n; i++)
        cin>>arr[i];
    map<ll,vector<ll> >m;
    for(ll i = 0; i < n; i++)
    {
        ll a = arr[i];
        for(ll j = 0; j < temp.size(); j++)
        {
            ll c = 0;
            if(temp[j] > sqrt(a))
            {
                m[temp[j]].pb(1);
                break;
            }
            while(a % temp[j] == 0 && a != 1)
            {
                a /= temp[j];
                c++;
            }
            if(c)
                m[temp[j]].pb(c);
        }
    }
    ll ans = 1;
    for(ll i = 0; i <temp.size(); i++)
    {
        if(m[temp[i]].size() < n-1)
            continue;
        sort(m[temp[i]].begin(), m[temp[i]].end());
        ll o;
        if(m[temp[i]].size() == n-1)
            o = m[temp[i]][0];
        else
            o = m[temp[i]][1];
        while(o--)
            ans = ans * temp[i];
    }
    cout<<ans;
    return 0;
}


/* Isn't passion overrated?*/

#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long
#define mod 1000000007
using namespace std;
ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
int main()
{
    ios_base:: sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
    ll n;
    cin>>n;
    ll arr[n];
    vector<ll>prime(200010);
    vector<ll>temp;
    for(ll i = 2; i <= sqrt(200010); i++)
    {
        if(prime[i] == 1)
            continue;
        for(ll j = 2; i*j < 200010; j++)
            prime[i*j] = 1;
    }
    for(ll i = 2; i < 200010; i++)
    {
        if(prime[i] == 0)
            temp.pb(i);
    }
    for(ll i = 0; i < n; i++)
        cin>>arr[i];
    map<ll,vector<ll> >m;
    for(ll i = 0; i < n; i++)
    {
        ll a = arr[i];
        for(ll j = 0; j < temp.size(); j++)
        {
            if(a == 1)
                break;
            ll c = 0;
            if(temp[j] > sqrt(a))
            {
                m[a].pb(1);
                break;
            }
            while(a % temp[j] == 0 && a != 1)
            {
                a /= temp[j];
                c++;
            }
            if(c)
                m[temp[j]].pb(c);
        }
    }
    ll ans = 1;
    for(ll i = 0; i <temp.size(); i++)
    {
        if(m[temp[i]].size() < n-1)
            continue;
        sort(m[temp[i]].begin(), m[temp[i]].end());
        ll o;
        if(m[temp[i]].size() == n-1)
            o = m[temp[i]][0];
        else
            o = m[temp[i]][1];
        while(o--)
            ans = ans * temp[i];
    }
    cout<<ans;
    return 0;
}


/* Isn't passion overrated?*/

#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long
#define mod 1000000007
using namespace std;
ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
int main()
{
    ios_base:: sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
    ll n;
    cin>>n;
    ll arr[n];
    vector<ll>prime(200010);
    vector<ll>temp;
    for(ll i = 2; i <= sqrt(200010); i++)
    {
        if(prime[i] == 1)
            continue;
        for(ll j = 2; i*j < 200010; j++)
            prime[i*j] = 1;
    }
    for(ll i = 2; i < 200010; i++)
    {
        if(prime[i] == 0)
            temp.pb(i);
    }
    for(ll i = 0; i < n; i++)
        cin>>arr[i];
    map<ll,vector<ll> >m;
    for(ll i = 0; i < n; i++)
    {
        ll a = arr[i];
        for(ll j = 0; j < temp.size(); j++)
        {
            ll c = 0;
            while(a % temp[j] == 0 && a != 1)
            {
                a /= temp[j];
                c++;
            }
            if(c)
                m[temp[j]].pb(c);
        }
    }
    ll ans = 1;
    for(ll i = 0; i <temp.size(); i++)
    {
        if(m[temp[i]].size() < n-1)
            continue;
        sort(m[temp[i]].begin(), m[temp[i]].end());
        ll o;
        if(m[temp[i]].size() == n-1)
            o = m[temp[i]][0];
        else
            o = m[temp[i]][1];
        while(o--)
            ans = ans * temp[i];
    }
    cout<<ans;
    return 0;
}


/* Isn't passion overrated?*/

#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long
#define mod 1000000007
using namespace std;
ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
int main()
{
    ios_base:: sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
    ll n;
    cin>>n;
    ll arr[n];
    vector<ll>prime(200010);
    vector<ll>temp;
    for(ll i = 2; i <= sqrt(200010); i++)
    {
        if(prime[i] == 1)
            continue;
        for(ll j = 2; i*j < 200010; j++)
            prime[i*j] = 1;
    }
    for(ll i = 2; i < 200010; i++)
    {
        if(prime[i] == 0)
            temp.pb(i);
    }
    for(ll i = 0; i < n; i++)
        cin>>arr[i];
    map<ll,vector<ll> >m;
    for(ll i = 0; i < n; i++)
    {
        ll a = arr[i];
        for(ll j = 0; j < temp.size(); j++)
        {
            ll c = 0;
            while(a % temp[j] == 0 && a != 1)
            {
                a /= temp[j];
                c++;
            }
            m[temp[j]].pb(c);
        }
    }
    ll ans = 1;
    for(ll i = 0; i <temp.size(); i++)
    {
        sort(m[temp[i]].begin(), m[temp[i]].end());
        ll o = m[temp[i]][1];
        while(o--)
            ans = ans * temp[i];
    }
    cout<<ans;
    return 0;
}


/* Isn't passion overrated?*/

#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long
#define mod 1000000007
using namespace std;
ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
int main()
{
    ios_base:: sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
    ll n;
    cin>>n;
    ll arr[n];
    vector<ll>prime(2000010);
    vector<ll>temp;
    for(ll i = 2; i <= sqrt(2000010); i++)
    {
        if(prime[i] == 1)
            continue;
        temp.pb(i);
        for(ll j = 2; i*j <= 2000010; j++)
            prime[i*j] = 1;
    }
    for(ll i = 0; i < n; i++)
        cin>>arr[i];
    unordered_map<ll,vector<ll> >m;
    for(ll i = 0; i < n; i++)
    {
        ll a = arr[i];
        for(ll j = 0; j < temp.size(); j++)
        {
            ll c = 0;
            while(a % temp[j] == 0 && a != 1)
            {
                a /= temp[j];
                c++;
            }
            m[temp[j]].pb(c);
        }
    }
    ll ans = 1;
    for(ll i = 0; i <temp.size(); i++)
    {
        sort(m[temp[i]].begin(), m[temp[i]].end());
        ll o = m[temp[i]][1];
        while(o--)
            ans = ans * temp[i];
    }
    cout<<ans;
    return 0;
}


/* Isn't passion overrated?*/

#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long
#define mod 1000000007
using namespace std;
ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
int main()
{
    ios_base:: sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
    ll n;
    cin>>n;
    ll arr[n];
    vector<ll>prime(100010);
    vector<ll>temp;
    for(ll i = 2; i <= sqrt(100010); i++)
    {
        if(prime[i] == 1)
            continue;
        for(ll j = 2; i*j < 100010; j++)
            prime[i*j] = 1;
    }
    for(ll i = 2; i < 100010; i++)
    {
        if(prime[i] == 0)
            temp.pb(i);
    }
    for(ll i = 0; i < n; i++)
        cin>>arr[i];
    unordered_map<ll,vector<ll> >m;
    for(ll i = 0; i < n; i++)
    {
        ll a = arr[i];
        for(ll j = 0; j < temp.size(); j++)
        {
            ll c = 0;
            while(a % temp[j] == 0 && a != 1)
            {
                a /= temp[j];
                c++;
            }
            if(c)
                m[temp[j]].pb(c);
        }
    }
    ll ans = 1;
    for(ll i = 0; i <temp.size(); i++)
    {
        if(m[temp[i]].size() < n-1)
            continue;
        sort(m[temp[i]].begin(), m[temp[i]].end());
        ll o;
        if(m[temp[i]].size() == n-1)
            o = m[temp[i]][0];
        else
            o = m[temp[i]][1];
        while(o--)
            ans = ans * temp[i];
    }
    cout<<ans;
    return 0;
}


/* Isn't passion overrated?*/

#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long
#define mod 1000000007
using namespace std;
ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
int main()
{
    ios_base:: sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
    ll n;
    cin>>n;
    ll arr[n];
    vector<ll>prime(100010);
    vector<ll>temp;
    for(ll i = 2; i <= sqrt(100010); i++)
    {
        if(prime[i] == 1)
            continue;
        for(ll j = 2; i*j < 100010; j++)
            prime[i*j] = 1;
    }
    for(ll i = 2; i < 100010; i++)
    {
        if(prime[i] == 0)
            temp.pb(i);
    }
    for(ll i = 0; i < n; i++)
        cin>>arr[i];
    map<ll,vector<ll> >m;
    for(ll i = 0; i < n; i++)
    {
        ll a = arr[i];
        for(ll j = 0; j < temp.size(); j++)
        {
            ll c = 0;
            while(a % temp[j] == 0 && a != 1)
            {
                a /= temp[j];
                c++;
            }
            if(c)
                m[temp[j]].pb(c);
        }
    }
    ll ans = 1;
    for(ll i = 0; i <temp.size(); i++)
    {
        if(m[temp[i]].size() < n-1)
            continue;
        sort(m[temp[i]].begin(), m[temp[i]].end());
        ll o;
        if(m[temp[i]].size() == n-1)
            o = m[temp[i]][0];
        else
            o = m[temp[i]][1];
        while(o--)
            ans = ans * temp[i];
    }
    cout<<ans;
    return 0;
}


/* Isn't passion overrated?*/

#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long
#define mod 1000000007
using namespace std;
ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
int main()
{
    ios_base:: sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
    ll n;
    cin>>n;
    ll arr[n];
    vector<ll>prime(2000010);
    vector<ll>temp;
    for(ll i = 2; i <= sqrt(2000010); i++)
    {
        if(prime[i] == 1)
            continue;
        for(ll j = 2; i*j < 2000010; j++)
            prime[i*j] = 1;
    }
    for(ll i = 2; i < 2000010; i++)
    {
        if(prime[i] == 0)
            temp.pb(i);
    }
    for(ll i = 0; i < n; i++)
        cin>>arr[i];
    unordered_map<ll,vector<ll> >m;
    for(ll i = 0; i < n; i++)
    {
        ll a = arr[i];
        for(ll j = 0; j < temp.size(); j++)
        {
            ll c = 0;
            while(a % temp[j] == 0 && a != 1)
            {
                a /= temp[j];
                c++;
            }
            m[temp[j]].pb(c);
        }
    }
    ll ans = 1;
    for(ll i = 0; i <temp.size(); i++)
    {
        sort(m[temp[i]].begin(), m[temp[i]].end());
        ll o = m[temp[i]][1];
        while(o--)
            ans = ans * temp[i];
    }
    cout<<ans;
    return 0;
}


/* Isn't passion overrated?*/

#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long
#define mod 1000000007
using namespace std;
ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
int main()
{
    ios_base:: sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
    ll n;
    cin>>n;
    ll arr[n];
    vector<ll>prime(100010);
    vector<ll>temp;
    for(ll i = 2; i <= sqrt(100010); i++)
    {
        if(prime[i] == 1)
            continue;
        for(ll j = 2; i*j < 100010; j++)
            prime[i*j] = 1;
    }
    for(ll i = 2; i < 100010; i++)
    {
        if(prime[i] == 0)
            temp.pb(i);
    }
    for(ll i = 0; i < n; i++)
        cin>>arr[i];
    map<ll,vector<ll> >m;
    for(ll i = 0; i < n; i++)
    {
        ll a = arr[i];
        for(ll j = 0; j < temp.size(); j++)
        {
            if(a == 1)
                break;
            ll c = 0;
            if(temp[j] > sqrt(a))
            {
                m[temp[j]].pb(1);
                break;
            }
            while(a % temp[j] == 0 && a != 1)
            {
                a /= temp[j];
                c++;
            }
            if(c)
                m[temp[j]].pb(c);
        }
    }
    ll ans = 1;
    for(ll i = 0; i <temp.size(); i++)
    {
        if(m[temp[i]].size() < n-1)
            continue;
        sort(m[temp[i]].begin(), m[temp[i]].end());
        ll o;
        if(m[temp[i]].size() == n-1)
            o = m[temp[i]][0];
        else
            o = m[temp[i]][1];
        while(o--)
            ans = ans * temp[i];
    }
    cout<<ans;
    return 0;
}


/* Isn't passion overrated?*/

#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long
#define mod 1000000007
using namespace std;
ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
int main()
{
    ios_base:: sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
    ll n;
    cin>>n;
    ll arr[n];
    vector<ll>prime(100010);
    vector<ll>temp;
    for(ll i = 2; i <= sqrt(100010); i++)
    {
        if(prime[i] == 1)
            continue;
        for(ll j = 2; i*j < 100010; j++)
            prime[i*j] = 1;
    }
    for(ll i = 2; i < 100010; i++)
    {
        if(prime[i] == 0)
            temp.pb(i);
    }
    for(ll i = 0; i < n; i++)
        cin>>arr[i];
    map<ll,vector<ll> >m;
    for(ll i = 0; i < n; i++)
    {
        ll a = arr[i];
        for(ll j = 0; j < temp.size(); j++)
        {
            if(a == 1)
                break;
            ll c = 0;
            if(temp[j] > sqrt(a))
            {
                m[a].pb(1);
                break;
            }
            while(a % temp[j] == 0 && a != 1)
            {
                a /= temp[j];
                c++;
            }
            if(c)
                m[temp[j]].pb(c);
        }
    }
    ll ans = 1;
    for(ll i = 0; i <temp.size(); i++)
    {
        if(m[temp[i]].size() < n-1)
            continue;
        sort(m[temp[i]].begin(), m[temp[i]].end());
        ll o;
        if(m[temp[i]].size() == n-1)
            o = m[temp[i]][0];
        else
            o = m[temp[i]][1];
        while(o--)
            ans = ans * temp[i];
    }
    cout<<ans;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
    ll i,n; cin>>n;   ll currans,arr[n],ans[n],gcd[n];
    for(i=0;i<n;i++) cin>>arr[i];
    gcd[n-1]=arr[n-1]; ans[n-1]=arr[n-1];
    for(i=n-2;i>=0;i--)
    {
      gcd[i]=__gcd(gcd[i+1],arr[i]);
      currans=(gcd[i+1]*arr[i])/gcd[i];
      ans[i]=__gcd(currans,ans[i+1]);
    }
    cout<<ans[0];
 return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int mod = 1000000007;

int main()
{

    int n;
    cin>>n;
    int i,k,a[n],num[1000],power[100],number,p;
    ll ans=1;
    set<int> s;
    for(i=0;i<n;i++) cin>>a[i];
    number=a[0];
    for(i=2;i*i<=number;i++)
    { p=0;
      while(number%i==0) { number/=i; p++; }
      if(p)              { s.insert(i);   }
    }
    if(number>1) s.insert(number);
    number=a[1];
    for(i=2;i*i<=number;i++)
    { p=0;
      while(number%i==0) { number/=i; p++; }
      if(p)              { s.insert(i);   }
    }
    if(number>1) s.insert(number);

    vector<int> arr[s.size()];
    k=0;
    for(i=0;i<n;i++)
    { k=0;
      for(auto j=s.begin();j!=s.end();j++){
          p=0;
          while(a[i]%(*j)==0) { a[i]/=(*j); p++; }
          arr[k].push_back(p);
          k++;
      }
    }
    k=0;
    for(auto j=s.begin();j!=s.end();j++){
        sort(arr[k].begin(),arr[k].end());
        ans=ans*(ll)pow((*j),arr[k][1]);
        k++;
    }
    cout<<ans;
  return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
    int i,n; cin>>n;   ll currans,arr[n],ans[n],gcd[n];
    for(i=0;i<n;i++) cin>>arr[i];
    gcd[n-1]=arr[n-1]; ans[n-1]=arr[n-1];
    for(i=n-2;i>=0;i--)
    {
      gcd[i]=__gcd(gcd[i+1],arr[i]);
      currans=(gcd[i+1]*arr[i])/gcd[i];
      ans[i]=__gcd(currans,ans[i+1]);
    }
    if(n==2)
    ans[0]=lcm(arr[0],arr[1]);
    cout<<ans[0];
 return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
    int i,n; cin>>n;   int currans,arr[n],ans[n],gcd[n];
    for(i=0;i<n;i++) cin>>arr[i];
    gcd[n-1]=arr[n-1]; ans[n-1]=arr[n-1];
    for(i=n-2;i>=0;i--)
    {
      gcd[i]=__gcd(gcd[i+1],arr[i]);
      currans=(gcd[i+1]*arr[i])/gcd[i];
      ans[i]=__gcd(currans,ans[i+1]);
    }
    cout<<ans[0];
 return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
    int i,n; cin>>n;   ll currans,arr[n],ans[n],gcd[n];
    for(i=0;i<n;i++) cin>>arr[i];
    gcd[n-1]=arr[n-1]; ans[n-1]=1;
    for(i=n-2;i>=0;i--)
    {
      gcd[i]=__gcd(gcd[i+1],arr[i]);
      currans=(gcd[i+1]*arr[i])/gcd[i];
      ans[i]=__gcd(currans,ans[i+1]);
    }
    cout<<ans[0];
 return 0;
}


#include<bits/stdc++.h>
#define int long long
int n,ans;
int a[1000000],g[1000000];
main(){
  scanf("%lld",&n);
  for(int i=1;i<=n;++i)scanf("%lld",&a[i]);
  for(int i=n;i;--i)
	  g[i]=std::__gcd(a[i],g[i+1]);
  for(int i=1;i<=n;++i){
	  a[i]=a[i]/std::__gcd(a[i],g[i+1])*g[i+1];
	  ans=std::__gcd(ans,a[i]);
	}
  printf("%lld\n",ans);
  return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
    int i,n; cin>>n;   ll currans,arr[n],ans[n],gcd[n];
    for(i=0;i<n;i++) cin>>arr[i];
    gcd[n-1]=arr[n-1]; ans[n-1]=arr[n-1];
    for(i=n-2;i>=0;i--)
    {
      gcd[i]=__gcd(gcd[i+1],arr[i]);
      currans=(gcd[i+1]*arr[i])/gcd[i];
      ans[i]=__gcd(currans,ans[i+1]);
    }
    if(n==2) ans[0]=gcd[0];
    cout<<ans[0];
 return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
    int i,n; cin>>n;   ll currans,arr[n],ans[n],gcd[n];
    for(i=0;i<n;i++) cin>>arr[i];
    gcd[n-1]=arr[n-1]; ans[n-1]=arr[n-1];
    for(i=n-2;i>=0;i--)
    {
      gcd[i]=__gcd(gcd[i+1],arr[i]);
      currans=(gcd[i+1]*arr[i])/gcd[i];
      ans[i]=__gcd(currans,ans[i+1]);
    }
    cout<<currans;
 return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
    int i,n; cin>>n;   ll currans,arr[n],ans[n],gcd[n];
    for(i=0;i<n;i++) cin>>arr[i];
    gcd[n-1]=arr[n-1]; ans[n-1]=arr[n-1];
    for(i=n-2;i>=0;i--)
    {
      gcd[i]=__gcd(gcd[i+1],arr[i]);
      ans[i]=gcd[i+1]*arr[i]/gcd[i];
    }

    currans=ans[0];
    for(i=0;i<n-1;i++)
    {
      currans=__gcd(currans,ans[i]);
    }
    cout<<currans;
 return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
    int i,n; cin>>n;   ll currans,arr[n],ans[n],gcd[n];
    for(i=0;i<n;i++) cin>>arr[i];
    gcd[n-1]=arr[n-1]; ans[n-1]=arr[n-1];
    for(i=n-2;i>=0;i--)
    {
      gcd[i]=(ll)__gcd(gcd[i+1],arr[i]);
      currans=(gcd[i+1]*arr[i])/gcd[i];
      ans[i]=(ll)__gcd(currans,ans[i+1]);
    }
    cout<<ans[0];
 return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{   ios_base::sync_with_stdio(false); cin.tie(NULL);
    int i,n; cin>>n;   ll currans,arr[n],ans[n],gcd[n];
    for(i=0;i<n;i++) cin>>arr[i];
    gcd[n-1]=arr[n-1]; ans[n-1]=arr[n-1]; currans=lcm(arr[n-1],arr[n-2])
    for(i=n-2;i>=0;i--)
    {
      gcd[i]=__gcd(gcd[i+1],arr[i]);
      ans[i]=gcd[i+1]*arr[i]/gcd[i];
      currans=__gcd(currans,ans[i]);
    }
    cout<<currans;
 return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{   ios_base::sync_with_stdio(false); cin.tie(NULL);
    int i,n; cin>>n;   ll currans,arr[n],ans[n],gcd[n];
    for(i=0;i<n;i++) cin>>arr[i];
    gcd[n-1]=arr[n-1]; ans[n-1]=arr[n-1]; currans=lcm(arr[n-1],arr[n-2])
    for(i=n-2;i>=0;i--;)
    {
      gcd[i]=__gcd(gcd[i+1],arr[i]);
      ans[i]=gcd[i+1]*arr[i]/gcd[i];
      currans=__gcd(currans,ans[i]);
    }
    cout<<currans;
 return 0;
}