#include <iostream>
#include <cmath>
using namespace std;
long long n, a[3000005], ans;
int up[3000005], down[3000005];
bool used[3000005], square[3000005];
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cin>>n;
for(long long i=0;i<n;i++){
    cin>>a[i];
    used[a[i]]=true;
}
for(long long i=1;i<=sqrt(3000000); i++){
    square[i*i]=true;
}
for(long long i=0;i<n;i++){
    if(a[i]==1){
        continue;
    }
    if(used[1]){
        up[1]++;
        down[a[i]]++;
    }
    for(int j=2;j<sqrt(a[i]);j++){
        if(a[i]%j==0){
            if(used[j]){
                up[j]++;
                down[a[i]]++;
            }
            long long num=a[i]/j;
            if(used[num]){
                up[num]++;
                down[a[i]]++;
            }
        }
    }
    if(square[a[i]]){
        long long num = sqrt(a[i]);
        if(used[num]){
            up[num]++;
            down[a[i]]++;
        }
    }
}
for(long long i=1;i<3000000;i++){
    ans=ans+up[i]*down[i];
    /*if(up[i]>0 and down[i]>0){
        cout<<i<<" "<<down[i]<<" "<<up[i]<<"\n";
    }*/
}
cout<<ans;
return 0;
}
