#include <bits/stdc++.h>
using namespace std;
#ifndef LOCAL
#define cerr if(false) cerr
#endif
#define endl "\n"
typedef long long ll;
template<class T, class T2> inline ostream &operator <<(ostream &out, const pair<T, T2> &x) { out << x.first << " " << x.second; return out;}
template<class T, class T2> inline bool chkmax(T &x, const T2 &y) { return x < y ? x = y, 1 : 0; }
template<class T, class T2> inline bool chkmin(T &x, const T2 &y) { return x > y ? x = y, 1 : 0; }
const ll mod = 1e9 + 7;

const int MAX_N = 1e6 + 10;
ll arr[MAX_N];
int n;

signed main() {
#ifndef LOCAL
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#endif

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

    ll cnt = 0;
    for(int i = 0; i < n; i ++) {
        for(int j = 0; j < n; j ++) {
            for(int k = 0; k < n; k ++) {
                if(arr[i] < arr[j] && arr[j] < arr[k] && arr[j] % arr[i] == 0 && arr[k] % arr[j] == 0) {
                    cnt ++;
                }
            }
        }
    }

    cout << cnt << endl;

    return 0;
}
