#include <bits/stdc++.h>   const int mod = 1000000007;   const int inf = 1000000009;   const long long INF = 1000000000000000009;   const long long big = 1000000000000000;   const long double eps = 0.000000000000000000001;   using namespace std;   const int M = 100000;   int W[M + 5], U[M + 5], cnt[M + 5];   vector<int> D[M + 5], S;   long long int funkcja(int x) {     long long int wynik = 0;     for (auto v : D[x]) wynik += cnt[v] * U[v];     return wynik;   }   void aktualizuj(int x, int c) {     for (auto v : D[x]) cnt[v] += c;   }   int main() {     ios::sync_with_stdio(false);     cin.tie();     cout.tie();     int n;     cin >> n;     for (int i = 1; i <= M; i++) {       for (int j = i; j <= M; j += i) D[j].push_back(i);       if (i == 1)         U[i] = 1;       else if ((i / D[i][1]) % D[i][1] == 0)         U[i] = 0;       else         U[i] = -U[i / D[i][1]];     }     long long int wynik = 0;     for (int i = 1; i <= n; i++) {       int a;       cin >> a;       wynik = max(wynik, (long long int)a);       for (auto v : D[a]) W[v] = 1;     }     for (int j = M; j >= 1; j--) {       if (!W[j]) continue;       while (funkcja(j)) {         wynik = max(wynik, (long long int)j * S.back());         aktualizuj(S.back(), -1);         S.pop_back();       }       aktualizuj(j, 1);       S.push_back(j);     }     cout << wynik;     return 0;   }   