#include <bits/stdc++.h>

using namespace std;
typedef long long LL;
typedef pair<int,int> pii;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}

#ifdef OJ
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

#define all(x) (x).begin(), (x).end()
#define rsort(x) sort((x).rbegin(), (x).rend())
#define sz(x) ((int)x.size())
#define fori(i, n) for (int i = 0; i < (int)(n); ++i)
#define ford(i, n, e) for (int i = (int)(n); i >= (int)(e); --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
template<typename T> bool mmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool mmin(T &m, const T q) { if (m > q) {m = q; return true;} else return false; }
#define RETURN(x) do{cout << (x) << '\n'; return 0;}while(0)

const char en = '\n';
const int MOD = 0;
const int MAXN = 0;
const int INF = 1e9;

LL gcd(LL a, LL b) {
    return (b == 0) ? a : gcd(b, a%b);
}

struct Fraction {
    LL num, den;
    Fraction(LL n = 0, LL d = 1) {
        LL g = gcd(n,d);
        num = n/g;
        den = d/g;
    }

    Fraction(const string& s) {
        int i = 0;
        LL n = 0;
        while(i < sz(s) && s[i] != '.') {
            n *= 10;
            n += s[i]-'0';
            i++;
        }
        LL d = 1;
        if(i < sz(s)) {
            i++;
            while(i < sz(s)) {
                n *= 10;
                n += s[i]-'0';
                d *= 10;
                i++;
            }
        }
        LL g = gcd(n,d);
        num = n/g;
        den = d/g;
    }
};

struct stKey {
    int give2, give5, need2, need5;
    stKey(int g2 = 0, int g5 = 0, int n2 = 0, int n5 = 0) {
        give2 = g2;
        give5 = g5;
        need2 = n2;
        need5 = n5;
    }

    bool operator<(const stKey &other) const {
        if(give2 != other.give2) return give2 < other.give2;
        if(give5 != other.give5) return give5 < other.give5;
        if(need2 != other.need2) return need2 < other.need2;
        return need5 < other.need5;
    };
};

int solve() {
    int n; cin >> n;
    auto count = [](LL x, int k) {
        int c = 0;
        while(x%k == 0) {
            c++;
            x /= k;
        }
        return c;
    };

    map<stKey, int> table;
    LL ans = 0;

    fori(i,n) {
        string s; cin >> s;
        Fraction f(s);

        int give2 = count(f.num, 2);
        int give5 = count(f.num, 5);
        int need2 = count(f.den, 2);
        int need5 = count(f.den, 5);

        //debug(s);
        //debug(give2);
        //debug(give5);
        //debug(need2);
        //debug(need5);

        for(auto &p: table) {
            auto &key = p.fi;
            auto c = p.se;
            if(key.give2 >= need2 && key.give5 >= need5 && 
                    give2 >= key.need2 && give5 >= key.need5) {
                ans += c;
            }
        }
        table[stKey(give2, give5, need2, need5)]++;
    }
    cout << ans << en;

    return 0;
} 

int main(int argc, char **argv) {
#ifdef OJ
    freopen("input.txt", "rt", stdin);
    //freopen("output.txt", "wt", stdout);
#endif
    ios::sync_with_stdio(false);
    cin.tie(0);

    int ntest = 1;
    //cin >> ntest;
    fori(test, ntest) {
        //cout << "Case #" << test+1 << ": ";
        solve();
    }

    return 0;
    }



Measured memory_bytes: 3648