#include <bits/stdc++.h>
using namespace std;
int n, a[4444];
unordered_map <double, int> cnt;
int main()
{
cin >> n;
for (int i = 0; i < n; i++)
cin >> a[i];
sort(a, a + n);
long long ans = 0;
for (int i = 0; i < n; i++)
{
for (int j = i + 1; j < n; j++)
{
double d = 1. * a[i] / a[j];
if (cnt.count(d))
ans += cnt[d];
}
for (int j = 0; j < i; j++)
cnt[1. * a[j] / a[i]]++;
}
cout << ans << endl;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgbiwgYVs0NDQ0XTsKdW5vcmRlcmVkX21hcCA8ZG91YmxlLCBpbnQ+IGNudDsKCmludCBtYWluKCkKewogIGNpbiA+PiBuOwogIGZvciAoaW50IGkgPSAwOyBpIDwgbjsgaSsrKQogICAgY2luID4+IGFbaV07CiAgc29ydChhLCBhICsgbik7CgogIGxvbmcgbG9uZyBhbnMgPSAwOwogIGZvciAoaW50IGkgPSAwOyBpIDwgbjsgaSsrKQogIHsKICAgIGZvciAoaW50IGogPSBpICsgMTsgaiA8IG47IGorKykKICAgIHsKICAgICAgZG91YmxlIGQgPSAxLiAqIGFbaV0gLyBhW2pdOwogICAgICBpZiAoY250LmNvdW50KGQpKQogICAgICAgIGFucyArPSBjbnRbZF07CiAgICB9CiAgICBmb3IgKGludCBqID0gMDsgaiA8IGk7IGorKykKICAgICAgY250WzEuICogYVtqXSAvIGFbaV1dKys7CiAgfQoKICBjb3V0IDw8IGFucyA8PCBlbmRsOwp9