#include <bits/stdc++.h>
using namespace std;
// #define LOCAL  // 提出時はコメントアウト

typedef long long ll;
const double EPS = 1e-9;
typedef vector<ll> vecl;
typedef pair<ll, ll> pairl;

template <typename T, typename U>
using mapv = map<T, vector<U>>;

#define ALL(v) v.begin(), v.end()
#define REP(i, x, n) for (int i = x; i < n; i++)
#define rep(i, n) REP(i, 0, n)
template <class T, class C>
void chmax(T &a, C b) {
    a > b ?: a = b;
}
template <class T, class C>
void chmin(T &a, C b) {
    a < b ?: a = b;
}

///// For Debug

#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
// vector
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
    for (T &x : vec) is >> x;
    return is;
}
// pair
template <typename T, typename U>
ostream &operator<<(ostream &os, pair<T, U> &pair_var) {
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}
// vector
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
    os << "{";
    for (int i = 0; i < vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
// map
template <typename T, typename U>
ostream &operator<<(ostream &os, map<T, U> &map_var) {
    os << "{";
    repi(itr, map_var) {
        os << *itr;
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
// set
template <typename T>
ostream &operator<<(ostream &os, set<T> &set_var) {
    os << "{";
    repi(itr, set_var) {
        os << *itr;
        itr++;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}

#define DUMPOUT cerr

void dump_func() { DUMPOUT << endl; }
template <class Head, class... Tail>
void dump_func(Head &&head, Tail &&... tail) {
    DUMPOUT << head;
    if (sizeof...(Tail) > 0) {
        DUMPOUT << ", ";
    }
    dump_func(std::move(tail)...);
}

#define DEBUG_

#ifndef LOCAL
#undef DEBUG_
#endif

#ifdef DEBUG_

#define DEB
#define dump(...)                                                       \
    DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                     \
            << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]" \
            << endl                                                     \
            << "    ",                                                  \
        dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)

#endif

//////////

using expo = tuple<ll,ll>;

int main() {
    #ifdef LOCAL
        ifstream in("../../Atcoder/input.txt");
        cin.rdbuf(in.rdbuf());
    #endif

    ll N;
    cin >> N;

    vecl A(N);
    map<expo, ll> expo_count;
    ll corr = 1e9;
    rep(i, N) {
        double _a;
        ll a;
        
        cin >> _a;
        a = round(_a*corr);
        A[i] = a;

        ll two = 0;
        ll b = a;
        while (b % 2 == 0) {
            b /= 2;
            two++;
            if (two == 18) break;
        }

        ll five = 0;
        ll c = a;
        while (c % 5 == 0) {
            c /= 5;
            five++;
            if (five == 18) break;
        }

        expo e = {two,five};
        if (expo_count.find(e) == expo_count.end()) {
            expo_count[e] = 0;
        }

        expo_count[e]++;
    }

    // dump(A);

    set<pair<expo, expo>> seen;

    ll ans = 0;
    rep(i, 19) {
        rep(j, 19) {
            expo e1 = {i, j};
            rep(i2, 19) {
                rep(j2, 19) {
                    expo e2 = {i2, j2};
                    if (!(i + i2 >= 18 && j + j2 >= 18)) continue;
                
                    pair<expo, expo> p1 = make_pair(e1, e2);
                    pair<expo, expo> p2 = make_pair(e2, e1);

                    if (seen.find(p1) != seen.end() || seen.find(p2) != seen.end()) continue;
                    if (expo_count.find(e1) == expo_count.end() || expo_count.find(e2) == expo_count.end()) continue;

                    // dump(get<0>(e1),get<1>(e1),get<0>(e2),get<1>(e2));
                    // dump(expo_count[e1],expo_count[e2]);

                    if (i==i2 && j == j2)
                        ans += expo_count[e1] * (expo_count[e2]-1) / 2;
                    else
                        ans += expo_count[e1] * expo_count[e2];

                    seen.insert(p1);
                    seen.insert(p2);
                }
            }
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 5616