#pragma region RegionDefs
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define reps(i,l,r) for(int i=(l),i##_len=(r);i<i##_len;++i)
#define repr(i,l,r) for(int i=(r)-1,i##_left=(l);i>=i##_left;--i)
#define all(x) begin(x),end(x)
using namespace std;
typedef long long ll;
const ll INF = 1e9;
template<class T=ll> using V = vector<T>;
template<class T=ll> using PQ = priority_queue<T>;
template<class T=ll> using PQG = priority_queue<T, V<T>, greater<T>>;
const ll MOD = 1000000007LL;
void in() {}
template<class Head, class... Tail>
void in(Head&& head, Tail&&... tail) { cin >> head; in(move(tail)...); }
#define IN(...) ll __VA_ARGS__; in(__VA_ARGS__)
#define TIN(T, ...) T __VA_ARGS__; in(__VA_ARGS__)
#define VIN(T, v, n) V<T> v(n); for(auto& _elem:v)cin>>_elem
template<class T>bool chmax(T &a, const T &b) {if (a<b) {a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) {if (a>b) {a=b; return 1;} return 0;}
template<class T>
string join(vector<T>& v, string delim="") { ostringstream os; rep(i,v.size())i?os<<delim<<v[i]:os<<v[0]; return os.str(); }
#pragma endregion RegionDefs

struct rational {
    ll p, q; // p/q;
    constexpr rational() : rational(0, 1) {}
    constexpr rational(ll p, ll q=1) : p(p), q(q) { normalize(); }
    constexpr ll gcd(const ll a, const ll b) const noexcept { return b == 0 ? a : gcd(b, a % b); }
    constexpr void normalize() noexcept {
        if (q < 0) p = -p, q = -q;
        ll g = gcd(p > 0 ? p : -p, q);
        if (g) p /= g, q /= g;
        else p = 0, q = 1;
    }
    constexpr bool operator< (const rational &x) const noexcept { return (long double)p*x.q < (long double)q*x.p; }
    constexpr bool operator> (const rational &x) const noexcept { return x < *this; }
    constexpr bool operator<=(const rational &x) const noexcept { return !(*this > x); }
    constexpr bool operator>=(const rational &x) const noexcept { return !(*this < x); }
    constexpr bool operator==(const rational &x) const noexcept { return !(*this < x) && !(*this > x); }
	constexpr bool operator!=(const rational &x) const noexcept { return *this < x || *this > x; }
	constexpr rational operator-() const noexcept { return rational(-p, q); }
	constexpr rational operator+(const rational &x) const noexcept { return rational(*this) += x; }
	constexpr rational operator-(const rational &x) const noexcept { return rational(*this) -= x; }
	constexpr rational operator*(const rational &x) const noexcept { return rational(*this) *= x; }
	constexpr rational operator/(const rational &x) const noexcept { return rational(*this) /= x; }
	constexpr rational &operator+=(const rational &x) noexcept {
		p = p*x.q+q*x.p;
        q = q*x.q;
        normalize();
		return *this;
	}
	constexpr rational &operator-=(const rational &x) noexcept {
		p = p*x.q-q*x.p;
        q = q*x.q;
        normalize();
		return *this;
	}
	constexpr rational &operator*=(const rational &x) noexcept {
		p = p*x.p;
        q = q*x.q;
        normalize();
		return *this;
	}
	constexpr rational &operator/=(const rational &x) noexcept {
		p = p*x.q;
        q = q*x.p;
        normalize();
		return *this;
	}
    friend ostream &operator<<(ostream &os,const rational &x) noexcept {
		return os << x.p << "/" << x.q;
	}
    static rational parse(string& s) {
        auto pos = s.find('.');
        if (pos == string::npos) return stoll(s);
        ll k = 1;
        rep(i, s.size()-pos-1) k *= 10;
        return rational(stoll(s.substr(0, pos))*k+stoll(s.substr(pos+1)), k);
    }
	friend istream &operator>>(istream &is, rational &x) noexcept {
		string s; is >> s;
        x = rational::parse(s);
		return is;
	}
};
void solve()
{
    IN(n);
    VIN(rational, a, n);
    map<pair<ll,ll>,ll> m;
    for (auto [p, q] : a) {
        ll a = 0, b = 0;
        while(p % 2 == 0) p /= 2, ++a;
        while(p % 5 == 0) p /= 5, ++b;
        while(q % 2 == 0) q /= 2, --a;
        while(q % 5 == 0) q /= 5, --b;
        ++m[{a,b}];
    }
    ll ans = 0;
    for (auto p1 : m) {
        for (auto p2 : m) {
            if (p1.first.first+p2.first.first >= 0 && p1.first.second+p2.first.second >= 0) {
                if (p1 < p2) ans += p1.second*p2.second;
                else if (p1 == p2) ans += p1.second*(p1.second-1)/2;
            }
        }
    }
    cout << ans << endl;
}

int main()
{
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(numeric_limits<double>::max_digits10);

    solve();

    return 0;
}

Measured memory_bytes: 6360