#include<iostream>
using namespace std;

int broiChisla;

int chisla[1000010];

int main(){

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin>>broiChisla;

    for(int i = 0; i < broiChisla; i++){
        cin>>chisla[i];
    }

    int broiTroiki = 0;

    for(int i = 0; i < broiChisla; i++){
        for(int j = 0; j < broiChisla; j++){
            if(chisla[i] < chisla[j] && chisla[j]%chisla[i] == 0){
                for(int k = 0; k < broiChisla; k++){
                    if(chisla[j] < chisla[k] && chisla[k] % chisla[j] == 0){
                        broiTroiki++;
                    }
                }
            }
        }
    }

    cout<<broiTroiki<<endl;

    return 0;
}
