#include<iostream>
#include<map>
using namespace std;
const int BUF = 300005;


int nVal;
int val[BUF];

void read() {
    cin >> nVal;
    for (int i = 0; i < nVal; ++i) {
        cin >> val[i];
    }
}


void work() {
    map<int, int> v2cnt;
    for (int i = 0; i < nVal; ++i) {
        ++v2cnt[val[i]];
    }

    long long sum = 0;
    for (map<int, int>::iterator it = v2cnt.begin(); it != v2cnt.end(); ++it) {
        sum += 1LL * it->second * (nVal - it->second);
    }

    cout << sum / 2 << endl;
}


int main() {
    read();
    work();
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
const ll linf = (1ll << 60);

int N, M;
int X[50];
bool notprime[51];
int prime[50];

int main() {
	cin >> N;
	for(int i = 2; i <= 50; i++) {
		if(notprime[i]) continue;
		prime[M++] = i;
		for(int j = i; j <= 50; j += i) {
			notprime[j] = 1;
		}
	}
	for(int i = 0; i < N; i++) cin >> X[i];
	ll ans = linf;
	for(int bit = 0; bit < (1 << M); bit++) {
		bool found = false;
		for(int i = 0; i < N; i++) {
			bool g = false;
			for(int j = 0; j < M; j++) {
				if(!(bit & (1 << j))) continue;
				if(X[i] % prime[j] == 0) g = true;
			}
			if(!g) found = true;
		}
		if(!found) {
			ll tmp = 1;
			for(int j = 0; j < M; j++) {
				if(!(bit & (1 << j))) continue;
				tmp *= prime[j];
			}
			ans = min(ans, tmp);
		}
	}
	cout << ans << endl;
}