#include <iostream>
#include <unordered_map>
#include <vector>
using namespace std;
vector<int> gen_primes(int n) {
vector<int> result = {2};
for (int i = 3; i*i <= n; ++i) {
bool good = true;
for (auto p : result) {
if (i % p == 0) {
good = false;
break;
}
}
if (good) result.push_back(i);
}
return result;
}
vector<int> prime_facts(int x, const vector<int> &primes) {
vector<int> result;
for (auto p : primes) {
if (p > x) break;
if (x % p == 0) {
result.push_back(p);
do {
x /= p;
} while (x % p == 0);
}
}
if (x > 1) result.push_back(x);
return result;
}
int main()
{
int n;
cin >> n;
vector<int> nums(n);
int maximum = 0;
for (int i = 0; i < n; ++i) {
cin >> nums[i];
maximum = max(maximum, nums[i]);
}
auto primes = gen_primes(maximum);
unordered_map<int, int> counts;
unordered_map<int, int> parity;
long long ans = (long long)n * ((long long)n - 1) / 2;
for (int i = 0; i < n; ++i) {
auto facts = prime_facts(nums[i], primes);
vector<pair<int, int>> products = {{0, 1}};
for (auto f : facts) {
auto round_max = products.size();
for (int a = 0; a < round_max; ++a) {
auto new_count = products[a].first + 1;
auto new_product = products[a].second * f;
++counts[new_product];
parity[new_product] = new_count % 2;
products.push_back({new_count, new_product});
}
}
//cout << i << endl;
//for (auto p : products) {
// cout << p.first << " " << p.second << endl;
//}
}
//cout << "---" << endl;
for (auto x : counts) {
//cout << x.first << " " << x.second << " " << parity[x.first] << endl;
//cout << x.second * (x.second - 1) / 2 << endl;
if (parity[x.first] == 1) {
ans -= (long long)x.second * ((long long)x.second - 1) / 2;
} else {
ans += (long long)x.second * ((long long)x.second - 1) / 2;
}
}
cout << ans << endl;
}