#include <bits/stdc++.h>
#define FASTIO
using namespace std;

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();

class Prints {
private:
    class __Prints {
    public:
        __Prints(const char* sep, const char* term) : sep(sep), term(term) {}
        template <class... Args>
        void operator()(Args&&... args) const { print(std::forward<Args>(args)...); }

    private:
        const char *sep, *term;
        void print() const { std::cout << term; }
        void print_rest() const { std::cout << term; }
        template <class T, class... Tail>
        void print(T&& head, Tail&&... tail) const { std::cout << head, print_rest(std::forward<Tail>(tail)...); }
        template <class T, class... Tail>
        void print_rest(T&& head, Tail&&... tail) const { std::cout << sep << head, print_rest(std::forward<Tail>(tail)...); }
    };

public:
    Prints() {}
    __Prints operator()(const char* sep = " ", const char* term = "\n") const { return __Prints(sep, term); }
    template <class T>
    void print_vec(const std::vector<T>& vec, const char* sep = " ", const char* term = "\n") const {
        const size_t sz = vec.size();
        for (size_t i = 0; i < sz; i++) std::cout << vec[i] << (i == sz - 1 ? term : sep);
    }
};

Prints prints;

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

ll power(ll a, ll n) {
    ll res = 1;
    for (; n > 0; n >>= 1) {
        if (n & 1) res *= a;
        a *= a;
    }
    return res;
}

Pll analyze(ll a) {
    ll cnt2 = 0, cnt5 = 0;
    while (a % 2 == 0) {
        ++cnt2;
        a /= 2;
    }
    while (a % 5 == 0) {
        ++cnt5;
        a /= 5;
    }
    return {cnt2, cnt5};
}

using Tup = tuple<ll, ll, ll>;

ll table1[31][31];
ll table2[31][31][31];

void solve() {
    ll N;
    cin >> N;
    Vl zs;
    vector<Tup> bs, cs, ds;
    for (ll i = 0; i < N; i++) {
        string s;
        cin >> s;
        ll p = 0, cnt = 0;
        bool is_shou = false;
        for (auto c : s) {
            if (c == '.') {
                is_shou = true;
            }
            else {
                ll d = c - '0';
                p *= 10;
                p += d;
                if (is_shou) {
                    ++cnt;
                }
            }
        }
        ll q = power(10, cnt);
        ll g = gcd(p, q);
        p /= g;
        q /= g;
        auto [cnt2, cnt5] = analyze(q);
        if (cnt2 > 0 && cnt5 > 0) {
            ds.emplace_back(p, cnt2, cnt5);
        }
        else if (cnt2 > 0) {
            bs.emplace_back(p, cnt2, 0);
        }
        else if (cnt5 > 0) {
            cs.emplace_back(p, 0, cnt5);
        }
        else {
            zs.emplace_back(p);
        }
    }

    ll ans = 0;

    // 整数と小数
    for (auto [p, x, y] : bs) {
        ++table1[x][y];
        --table1[30][y];
        --table1[x][30];
        ++table1[30][30];
    }
    for (auto [p, x, y] : cs) {
        ++table1[x][y];
        --table1[30][y];
        --table1[x][30];
        ++table1[30][30];
    }
    for (auto [p, x, y] : ds) {
        ++table1[x][y];
        --table1[30][y];
        --table1[x][30];
        ++table1[30][30];
    }
    for (ll i = 0; i < 30; i++) {
        for (ll j = 0; j < 30; j++) {
            table1[i][j + 1] += table1[i][j];
        }
    }
    for (ll j = 0; j < 30; j++) {
        for (ll i = 0; i < 30; i++) {
            table1[i + 1][j] += table1[i][j];
        }
    }
    for (auto p : zs) {
        auto [cnt2, cnt5] = analyze(p);
        ans += table1[cnt2][cnt5];
    }

    // 小数と小数
    for (auto [p, x, y] : bs) {
        auto [cnt2, cnt5] = analyze(p);
        ++table2[x][0][0];
        --table2[x][cnt2 + 1][0];
        --table2[x][0][cnt5 + 1];
        ++table2[x][cnt2 + 1][cnt5 + 1];
    }
    for (ll k = 0; k <= 30; k++) {
        for (ll i = 0; i < 30; i++) {
            for (ll j = 0; j < 30; j++) {
                table2[k][i][j + 1] += table2[k][i][j];
            }
        }
        for (ll j = 0; j < 30; j++) {
            for (ll i = 0; i < 30; i++) {
                table2[k][i + 1][j] += table2[k][i][j];
            }
        }
    }
    for (auto [p, x, y] : cs) {
        auto [cnt2, cnt5] = analyze(p);
        for (ll i = 0; i <= cnt2; i++) {
            ans += table2[i][0][y];
        }
    }

    // 整数と整数
    ll nz = (ll)zs.size();
    ans += nz * (nz - 1) / 2;

    prints()(ans);
}

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

int main() {
#ifdef FASTIO
    cin.tie(0), cout.tie(0);
    ios::sync_with_stdio(false);
#endif
#ifdef FILEINPUT
    ifstream ifs("./in_out/input.txt");
    cin.rdbuf(ifs.rdbuf());
#endif
#ifdef FILEOUTPUT
    ofstream ofs("./in_out/output.txt");
    cout.rdbuf(ofs.rdbuf());
#endif
    cout << setprecision(18) << fixed;
    solve();
    cout << flush;
    return 0;
}

Measured memory_bytes: 9016