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

#define int long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define fs first
#define sc second
#define MP make_pair
#define pb push_back
#define sz(x) (int)x.size()
#define sqr(x) ((x) * (x))
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int N = 51;
vector<int> primes;
int cnt[N], d[N];

void init() {
    for (int i = 2; i < N; i++) {
        if (d[i] == 0) {
            d[i] = i;
            primes.push_back(i);
        }
        for (int x : primes) {
            if (x > d[i] || x * i >= N) break;
            d[x * i] = x;
        }
    }
}

signed main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#ifdef FLameDragon
    freopen("in.txt", "r", stdin);
//    freopen("out.txt", "w", stdout);
#endif
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        cnt[x] += 1;
    }
    const int INF = 1e18;
    int ans = INF;
    init();
    for (int mask = 0; (mask < (1 << sz(primes))); mask++) {
        int curAns = 1;
        for (int bit = 0; bit < sz(primes); bit++) {
            if ((mask >> bit) & 1) {
                curAns *= primes[bit];
            }
        }
        bool ok = 1;
        for (int i = 2; i < N; i++) {
            if (cnt[i] && __gcd(curAns, i) == 1) {
                ok = false;
                break;
            }
        }
        if (ok) {
            ans = min(ans, curAns);
        }
    }
    cout << ans << '\n';
}

#include <bits/stdc++.h>
using namespace std;
#define repr(i, a, b) for (int i = a; i < b; i++)
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
typedef pair<ll,ll> P;
#define mod 1000000007

ll gcd(ll x,ll y) {return y ? gcd(y,x%y) : x;} 
ll lcm(ll x,ll y) {return x/gcd(x,y)*y;}

int main(){
    ll n;
    cin >> n;
    vector<ll> a(405,0);
    rep(i,n){
        ll x;
        cin >> x;
        a[x+200]++;
    }
    
    ll ans=0;
    
    for(ll i=0;i<=400;i++){
        if(a[i]==0) continue;
        for(ll j=i+1;j<=400;j++){
            ll now=(j-i)*(j-i);
            ans+=now*a[i]*a[j];
        }
    }
    
    cout << ans << endl;

    return 0;
}









