#include<iostream>
#include<algorithm>
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];
    }

    sort(chisla, chisla + broiChisla);

    int broiTroiki = 0;

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

    cout<<broiTroiki<<endl;

    return 0;
}
