#include <bits/stdc++.h>
#define pb push_back
#define pll pair <ll, ll>
#define mp make_pair
#define pyshnapyshnakaa ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define x first
#define y second
#pragma GCC optimize("O3")
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("unroll-loops")
#define plll pair <pair <ll, ll>, ll>
#define pllll pair <pair <ll, ll>, pair <ll, ll> >
#define psl pair <string, ll>
#define pld pair <ld, ld>
#define all(a) a.begin(), a.end()
#define vvl vector <vector <ll> >
#define cld complex <double>

typedef long long ll;

typedef long double ld;

using namespace std;

const ll maxn = 1e5;

ll n, m, k, t;

// ll A[maxn];

ll st2[maxn];

ll st5[maxn];

vector <ll> A[maxn];

vector <ll> B[maxn];
vector <ll> C[maxn];

vector <ll> D[maxn];

bool F[maxn];

int main() {
    pyshnapyshnakaa
    ll q, w, e, a, b, c;
    st2[0] = 1;
    for (q = 1; q < 63; q++) {
          st2[q] = st2[q - 1] * 2;
    }
    st5[0] = 1;
    for (q = 1; q < 30; q++) {
        st5[q] = st5[q - 1] * 5;
    }
    vector <ll> good;
    cin >> n;
    for (q = 0; q < n; q++) {
        string s;
        cin >> s;
        ll first = 0, second = 0;
        ll len = 0;
        // string s1, s2;
        bool found = 0;
        for (ll q = 0; q < s.length(); q++) {
            if (s[q] == '.') {
                found = 1;
                continue;
            }
            if (!found) {
                first *= 10;
                first += s[q] - '0';
            }
            else {
                second *= 10;
                second += s[q] - '0';
                len++;
            }
        }
        ll p = 0, q = st2[len] * st5[len];
        p = first * q + second;
        ll g = __gcd(p, q);
        p /= g;
        q /= g;
        // cout << p << " " << q << endl;
        ll p1 = p, q1 = q;
        if (q1 == 1) {
            good.pb(p);
            F[q] = 1;
            continue;
        }
        if (p % 2 == 0) {
            ll s2 = 0, s5 = 0;
            while (p1 % 2 == 0) {
                p1 /= 2;
                s2++;
            }
            while (q1 % 5 == 0) {
                q1 /= 5;
                s5++;
            }
            A[s2].pb(s5);
            // if (F[q]) {
            //     B[s2].pb(s5);
            // }
            // cout << "TYPE1 " << s2 << " " << s5 << endl;
            C[s5].pb(s2);
        }
        else {
            ll s2 = 0, s5 = 0;
            while (p1 % 5 == 0) {
                p1 /= 5;
                s5++;
            }
            while (q1 % 2 == 0) {
                q1 /= 2;
                s2++;
            }
            if (q1 == 1) {
                B[s2].pb(s5);
            }
            else {
                s5 = 0;
                while (q1 % 5 == 0) {
                    q1 /= 5;
                    s5++;
                }
                // cout << "HERE" << endl;
                D[s2].pb(s5);
            }
            // if (F[q]) {
            //     A[s2].pb(s5);
            // }
            // cout << "TYPE2 " << s2 << " " << s5 << endl;
        }
    }
    for (q = 0; q < 63; q++) {
        sort(all(D[q]));
        sort(all(B[q]));
    }
    ll ans = good.size() * (good.size() - 1) / 2;
    for (q = 0; q < 63; q++) {
        for (w = 0; w < A[q].size(); w++) {
            for (e = 0; e <= q; e++) {
                ll cnt_less = lower_bound(all(B[e]), A[q][w]) - B[e].begin();
                ll dans = B[e].size() - cnt_less;
                ans += dans;
            }
        }
    }
    // cout << "HERE" << endl;
    for (q = 0; q < good.size(); q++) {
        ll s2 = 0, s5 = 0;
        ll x = good[q];
        while (x % 2 == 0) {
            x /= 2;
            s2++;
        }
        while (x % 5 == 0) {
            x /= 5;
            s5++;
        }
        // cout << s2 << " " << s5 << endl;
        for (ll q = 0; q <= s2; q++) {
            ans += B[q].size();
        }
        for (ll q = 0; q <= s5; q++) {
            ans += C[q].size();
        }
        // cout << "MANS " << ans << endl;
        for (ll q = 0; q <= s2; q++) {
            ll cnt_less = upper_bound(all(D[q]), s5) - D[q].begin();
            ans += cnt_less;
        }
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 15520