#include "bits/stdc++.h"
#define clr(x) memset((x), 0, sizeof(x))
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define mp make_pair
#define in(x) int (x); input((x));
#define x first
#define y second
using namespace std;
template<typename T>
T gcd(T x, T y) {
while (y > 0) {
x %= y;
swap(x, y);
}
return x;
}
template<class _T>
inline _T sqr(const _T &x) {
return x * x;
}
template<class _T>
inline string tostr(const _T &a) {
ostringstream os("");
os << a;
return os.str();
}
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
const long double PI = 3.1415926535897932384626433832795L;
template<typename T>
inline void input(T &a) {
static int c;
a = 0;
while (!isdigit(c = getchar()) && c != '-') {}
char neg = 0;
if (c == '-') {
neg = 1;
c = getchar();
}
while (isdigit(c)) {
a = 10 * a + c - '0';
c = getchar();
}
if (neg) a = -a;
}
template<typename T = int>
inline T nxt() {
T res;
input(res);
return res;
}
int primes[] = {2, 3, 5, 7, 11, 13, 17, 19};
long long VMAX = 1000000;
int best = 0;
void rec(int pos, int cnt, int prev, long long cur) {
if (pos == 8) {
best = max(best, cnt);
return;
}
for (int i = 0; i <= 100 && cur <= VMAX; ++i) {
rec(pos + 1, cnt * (2 * i + 1), i, cur);
cur *= primes[pos];
}
}
const int N = 1000000;
int lp[N + 1];
int dp[N + 1];
int pr[20];
int deg[20];
int sz;
long long cur;
long long cur2;
int l[N + 1], r[N + 1];
int ans;
inline void rec(int pos, long long cur1) {
if (pos == sz) {
if (cur2 > N * cur1) return;
long long v = cur2 / cur1;
ans += l[cur1] && (r[v] - l[v]);
return;
}
for (int i = 0; i <= 2 * deg[pos] && cur1 < cur; ++i) {
rec(pos + 1, cur1);
cur1 *= pr[pos];
}
}
int main(int argc, char **argv) {
#ifdef LOCAL
freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
#endif
for (int i = 2; i <= N; ++i) {
if (!lp[i]) {
for (int j = i, k = 1; j <= N; j += i, ++k) {
if (!lp[j]) {
lp[j] = i;
dp[j] = k;
}
}
}
}
int n = nxt();
int a[n];
for (int i = 0; i < n; ++i) {
a[i] = nxt();
r[a[i]]++;
}
for (int i = 0; i < n; ++i) {
int d = a[i];
sz = 0;
while (d > 1) {
int p = lp[d];
pr[sz] = p;
deg[sz] = 0;
while (lp[d] == p) {
d = dp[d];
++deg[sz];
}
++sz;
}
cur2 = cur = a[i];
cur2 *= cur2;
rec(0, 1);
++l[a[i]];
}
cout << ans << "\n";
#ifdef LOCAL
cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC * 1000 << " ms." << endl;
#endif
return 0;
}
I2luY2x1ZGUgImJpdHMvc3RkYysrLmgiCgojZGVmaW5lIGNscih4KSBtZW1zZXQoKHgpLCAwLCBzaXplb2YoeCkpCiNkZWZpbmUgYWxsKHgpICh4KS5iZWdpbigpLCAoeCkuZW5kKCkKI2RlZmluZSBwYiBwdXNoX2JhY2sKI2RlZmluZSBtcCBtYWtlX3BhaXIKI2RlZmluZSBpbih4KSBpbnQgKHgpOyBpbnB1dCgoeCkpOwojZGVmaW5lIHggZmlyc3QKI2RlZmluZSB5IHNlY29uZAoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCnRlbXBsYXRlPHR5cGVuYW1lIFQ+ClQgZ2NkKFQgeCwgVCB5KSB7CiAgICB3aGlsZSAoeSA+IDApIHsKICAgICAgICB4ICU9IHk7CiAgICAgICAgc3dhcCh4LCB5KTsKICAgIH0KICAgIHJldHVybiB4Owp9Cgp0ZW1wbGF0ZTxjbGFzcyBfVD4KaW5saW5lIF9UIHNxcihjb25zdCBfVCAmeCkgewogICAgcmV0dXJuIHggKiB4Owp9Cgp0ZW1wbGF0ZTxjbGFzcyBfVD4KaW5saW5lIHN0cmluZyB0b3N0cihjb25zdCBfVCAmYSkgewogICAgb3N0cmluZ3N0cmVhbSBvcygiIik7CiAgICBvcyA8PCBhOwogICAgcmV0dXJuIG9zLnN0cigpOwp9Cgp0eXBlZGVmIGxvbmcgZG91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aSA9IDA7IGkgPD0gMTAwICYmIGN1ciA8PSBWTUFYOyArK2kpIHsKICAgICAgICByZWMocG9zICsgMSwgY250ICogKDIgKiBpICsgMSksIGksIGN1cik7CiAgICAgICAgY3VyICo9IHByaW1lc1twb3NdOwogICAgfQp9CmNvbnN0IGludCBOID0gMTAwMDAwMDsKaW50IGxwW04gKyAxXTsKaW50IGRwW04gKyAxXTsKCmludCBwclsyMF07CmludCBkZWdbMjBdOwppbnQgc3o7CmxvbmcgbG9uZyBjdXI7CmxvbmcgbG9uZyBjdXIyOwppbnQgbFtOICsgMV0sIHJbTiArIDFdOwoKaW50IGFuczsKCmlubGluZSB2b2lkIHJlYyhpbnQgcG9zLCBsb25nIGxvbmcgY3VyMSkgewogICAgaWYgKHBvcyA9PSBzeikgewogICAgICAgIGlmIChjdXIyID4gTiAqIGN1cjEpIHJldHVybjsKICAgICAgICBsb25nIGxvbmcgdiA9IGN1cjIgLyBjdXIxOwogICAgICAgIGFucyArPSBsW2N1cjFdICYmIChyW3ZdIC0gbFt2XSk7CiAgICAgICAgcmV0dXJuOwogICAgfQogICAgZm9yIChpbnQgaSA9IDA7IGkgPD0gMiAqIGRlZ1twb3NdICYmIGN1cjEgPCBjdXI7ICsraSkgewogICAgICAgIHJlYyhwb3MgKyAxLCBjdXIxKTsKICAgICAgICBjdXIxICo9IHByW3Bvc107CiAgICB9Cn0KCmludCBtYWluKGludCBhcmdjLCBjaGFyICoqYXJndikgewojaWZkZWYgTE9DQUwKICAgIGZyZW9wZW4oImlucHV0LnR4dCIsICJyIiwgc3RkaW4pOwogICAgLy9mcmVvcGVuKCJvdXRwdXQudHh0IiwgInciLCBzdGRvdXQpOwojZW5kaWYKCiAgICBmb3IgKGludCBpID0gMjsgaSA8PSBOOyArK2kpIHsKICAgICAgICBpZiAoIWxwW2ldKSB7CiAgICAgICAgICAgIGZvciAoaW50IGogPSBpLCBrID0gMTsgaiA8PSBOOyBqICs9IGksICsraykgewogICAgICAgICAgICAgICAgaWYgKCFscFtqXSkgewogICAgICAgICAgICAgICAgICAgIGxwW2pdID0gaTsKICAgICAgICAgICAgICAgICAgICBkcFtqXSA9IGs7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9CiAgICBpbnQgbiA9IG54dCgpOwogICAgaW50IGFbbl07CiAgICBmb3IgKGludCBpID0gMDsgaSA8IG47ICsraSkgewogICAgICAgIGFbaV0gPSBueHQoKTsKICAgICAgICByW2FbaV1dKys7CiAgICB9CgogICAgZm9yIChpbnQgaSA9IDA7IGkgPCBuOyArK2kpIHsKICAgICAgICBpbnQgZCA9IGFbaV07CiAgICAgICAgc3ogPSAwOwogICAgICAgIHdoaWxlIChkID4gMSkgewogICAgICAgICAgICBpbnQgcCA9IGxwW2RdOwogICAgICAgICAgICBwcltzel0gPSBwOwogICAgICAgICAgICBkZWdbc3pdID0gMDsKICAgICAgICAgICAgd2hpbGUgKGxwW2RdID09IHApIHsKICAgICAgICAgICAgICAgIGQgPSBkcFtkXTsKICAgICAgICAgICAgICAgICsrZGVnW3N6XTsKICAgICAgICAgICAgfQogICAgICAgICAgICArK3N6OwogICAgICAgIH0KICAgICAgICBjdXIyID0gY3VyID0gYVtpXTsKICAgICAgICBjdXIyICo9IGN1cjI7CiAgICAgICAgcmVjKDAsIDEpOwogICAgICAgICsrbFthW2ldXTsKICAgIH0KCiAgICBjb3V0IDw8IGFucyA8PCAiXG4iOwoKI2lmZGVmIExPQ0FMCiAgICBjZXJyIDw8ICJUaW1lIGVsYXBzZWQ6ICIgPDwgMS4wICogY2xvY2soKSAvIENMT0NLU19QRVJfU0VDICogMTAwMCA8PCAiIG1zLiIgPDwgZW5kbDsKI2VuZGlmCiAgICByZXR1cm4gMDsKfQo=