#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < (int)(n); i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
using ll = long long;

int main() {
    cin.tie(0); cout.tie(0); ios::sync_with_stdio(false);
    int N; cin >> N;

    int ten_max = 15;
    int ten_min = -10;
    int two_max = 50;
    int fiv_max = 22;


    vector<int> tens(N), fives(N), twos(N);
    unordered_map<int, vector<int>> T; 
    unordered_map<int, vector<int>> F;
    REP(i, 0, N) {
        // cout << "# i : " << i << endl;
        string S; cin >> S;

        int dot = -1; string tmp = "";
        REP(j, 0, S.size()) {
            if (S[j] == '.') dot = j;
            else tmp += S[j];
        }
        // cout << "--> tmp : " << tmp << endl;

        int deci = 0;
        if (dot != -1) deci = (int)S.size() - dot - 1;

        ll n = stoll(tmp);
        int two = 0, fiv = 0;
        while (n % 2 == 0) { n /= 2; two++; };
        while (n % 5 == 0) { n /= 5; fiv++; };
        
        int ten = min(two, fiv);
        tens[i] = ten; fives[i] = fiv - ten; twos[i] = two - ten;
        tens[i] = ten - deci;

        if (T[tens[i]].size() == 0) T[tens[i]].resize(two_max, 0);
        if (F[tens[i]].size() == 0) F[tens[i]].resize(fiv_max, 0);
        T[tens[i]][twos[i]]++;
        F[tens[i]][fives[i]]++;
    }

    for (auto &vec : T) {
        REP(i, 1, vec.second.size()) {
            vec.second[i] += vec.second[i - 1];
        }
    }
    for (auto &vec : F) {
        REP(i, 1, vec.second.size()) {
            vec.second[i] += vec.second[i - 1];
        }
    }

    ll ans = 0;
    REP(i, 0, N) {
        // cout << "# i : " << i << ", tens : " << tens[i] << ", fives : " << fives[i] << ", twos : " << twos[i] << endl;
        REP(j, twos[i],  two_max) {
            T[tens[i]][j]--;
        }
        REP(j, fives[i],  fiv_max) {
            F[tens[i]][j]--;
        }
        REP(j, ten_min, ten_max) {
            if (j + tens[i] >= 0) {
                if (T[j].size() == 0) continue;
                // cout << "--> j : " << j << ", add : " << T[j][max_size - 1] << endl;;
                ans += T[j][two_max - 1];
            } else {
                int min_two = (j + tens[i]) * (-1), max_two = twos[i];
                if (min_two <= max_two && F[j].size()) {
                    // cout << "--> two : " << min_two << " " << max_two << endl;
                    // cout << "--> j : " << j << ", add : " << F[j][max(max_two, max_size - 1)] << " - " << F[j][min_two - 1] << endl;
                    // ans += F[j][min(max_two, two_max - 1)] - F[j][min_two - 1];
                    ans += F[j][fiv_max - 1] - F[j][min_two - 1];
                }
                int min_five = (j + tens[i]) * (-1), max_five = fives[i];
                if (min_five <= max_five && T[j].size()) {
                    // cout << "--> five : " << min_five << " " << max_five << endl;
                    // cout << "--> j : " << j << ", add : " << T[j][max(max_five, max_size - 1)] << " - " << T[j][min_five - 1] << endl;
                    // ans += T[j][min(max_five, fiv_max - 1)] - T[j][min_five - 1];
                    ans += T[j][two_max - 1] - T[j][min_five - 1];
                }
            }
        }
        // cout << "----> ans : " << ans << endl;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 5544