#include <bits/stdc++.h>   using namespace std;   const int N = 100005;   vector<int> divs[N];   vector<int> mult[N];   int mu[N], a[N], n;   int cnt[N];   long long res = 0;   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     mu[1] = 1;     for (int i = 1; i < N; i++) {       divs[i].push_back(i);       for (int j = 2 * i; j < N; j += i) {         divs[j].push_back(i);         mu[j] -= mu[i];       }     }     cin >> n;     for (int i = 1; i <= n; i++) {       cin >> a[i];       for (int e : divs[a[i]]) mult[e].push_back(a[i] / e);     }     for (int i = 1; i < N; i++) {       sort(mult[i].begin(), mult[i].end(),            [](int first, int second) { return first > second; });       stack<int> st;       for (int e : mult[i]) {         int ans = 0;         for (int div : divs[e]) {           ans -= mu[div] * cnt[div];         }         while (ans != 0) {           int u = st.top();           st.pop();           for (int div : divs[u]) {             cnt[div]--;             if (e % div == 0) ans += mu[div];           }           if (ans == 0) res = max(res, 1LL * i * e * u);         }         st.push(e);         for (int div : divs[e]) cnt[div]++;       }       for (int e : mult[i]) {         for (int div : divs[e]) cnt[div] = 0;       }     }     cout << res;     return 0;   }   