#include <iostream>
#include <cmath>
using namespace std;
long long n, a[3000005], ans, num;
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;
    }
    int br2=0, br3=0, br5=0;
    long long newA=a[i];
    while(newA%2==0){
        br2++;
        newA=newA/2;
    }
    while(newA%3==0){
        br3++;
        newA=newA/3;
    }
    while(newA%5==0){
        br5++;
        newA=newA/5;
    }
    long long num2=1, num3, num5;
    for(int k=0;k<=br2;k++){
        num3=1;
        for(int l=0;l<=br3;l++){
            num5=1;
            for(int p=0;p<=br5;p++){
                num=num2*num3*num5;
                if(used[num] and num!=a[i]){
                    up[num]++;
                    down[a[i]]++;
                    //cout<<"up "<<num<<"  down "<<a[i]<<"\n";
                }
                num5=num5*5;
            }
            num3=num3*3;
        }
        num2=num2*2;
    }
    for(int j=7;j<sqrt(newA);j++){
        if(newA%j==0){
            num2=1;
            for(int k=0;k<=br2;k++){
                num3=1;
                for(int l=0;l<=br3;l++){
                    num5=1;
                    for(int p=0;p<=br5;p++){
                        num=j*num2*num3*num5;
                        if(used[num]){
                            up[num]++;
                            down[a[i]]++;
                            cout<<"up "<<num<<"  down "<<a[i]<<"\n";
                        }
                        long long num1=a[i]/num;
                        if(used[num1]){
                            up[num1]++;
                            down[a[i]]++;
                            //cout<<"up "<<num1<<"  down "<<a[i]<<"\n";
                        }
                        num5=num5*5;
                    }
                    num3=num3*3;
                }
                num2=num2*2;
            }
        }
    }
    num=a[i]/newA;
    if(square[num] and num!=1){
        long long j = sqrt(num);
        num2=1;
        for(int k=0;k<=br2;k++){
            num3=1;
            for(int l=0;l<=br3;l++){
                num5=1;
                for(int p=0;p<=br5;p++){
                    num=j*num2*num3*num5;
                    if(used[num]){
                        up[num]++;
                        down[a[i]]++;
                        //cout<<"up "<<num<<"  down "<<a[i]<<"\n";
                    }
                    long long num1=a[i]/num;
                    if(used[num1]){
                        up[num1]++;
                        down[a[i]]++;
                        //cout<<"up "<<num1<<"  down "<<a[i]<<"\n";
                    }
                    num5=num5*5;
                }
                num3=num3*3;
            }
            num2=num2*2;
        }
    }
}
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;
}
