// by Ccucumber12
#include <iostream>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <cstring>
#include <string.h>
#include <sstream>
#include <iomanip>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <tuple>
#include <vector>
#include <random>
#include <chrono>
using namespace std;

#define F first
#define S second
#define siz(v) ((int)v.size())
#define rs(n) resize(n)
#define ALL(v) v.begin(),v.end()
#define reset(v) memset((v),0,sizeof(v))
#define EB emplace_back
#define MP make_pair
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define REP(i,a,b) for(int i=(a);i<=(b);i++)
#define debug(x) cout << " > " << #x << ':' << x << endl;
#define kiyohime ios::sync_with_stdio(false);cin.tie(0);
#define endl '\n'

using ll = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
template<typename T> using vec = vector<T>;
template<typename T> using Prior = priority_queue<T>;
template<typename T> using prior = priority_queue<T, vec<T>, greater<T>>;

const int INF = 1e9;
const ll LLINF = (ll)4*1e18;
const ll MOD = 1e9+7;
const double PI  = 3.14159265358;
const double EPS = 1e-8;
const int xx[8] = {0,1,0,-1,1,1,-1,-1};
const int yy[8] = {1,0,-1,0,1,-1,-1,1};

void pmod(ll &a, ll b) {a = (a+b)%MOD;}
void mmod(ll &a, ll b) {a = (a-b+MOD)%MOD;}
void tmod(ll &a, ll b) {a = (a*b)%MOD;}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll POW(ll a, ll b) {ll res=1; do{if(b%2)tmod(res,a);tmod(a,a);}while(b>>=1); return res;}
template<typename T> T gcd(T a, T b) {return b == 0 ? a : gcd(b, a%b);};
template<typename T> void amax(T &a, T b) {if(a < b) a = b;}
template<typename T> void amin(T &a, T b) {if(a > b) a = b;}

#define N 100010
#define ZN 20

void solve(){
    int n;
    
    cin >> n;
    
    ll a, b, k;
    int cnt;
    bool flag;
    string s, tmp;
    stringstream ss;
    vec<pii> bot, top;
    
    while(n--){
        cin >> s;
        
        flag = true;
        cnt = 0;
        for(auto &i:s) {
            if(i == '.') {
                flag = false;
                i = ' ';
            }
            cnt += flag;
        }
        
        if(flag) s += ' ';
        while(siz(s) < cnt + 10)
            s += '0';
        
        ss.clear();
        ss << s ;
        ss >> a >> b ;
        
        k = 1e9;
        b += a * k;
        
        ll g = gcd(b, k);
        b /= g;
        k /= g;

        int ct2 = 0, ct5 = 0;

        while(k % 2 == 0) {
            k /= 2;
            ct2--;
        }
        while(k % 5 == 0) {
            k /= 5;
            ct5--;
        }

        if(k > 1) continue;

        while(b % 2 == 0) {
            b /= 2;
            ct2++;
        }
        while(b % 5 == 0) {
            b /= 5;
            ct5++;
        }

        if(ct2 < 0) bot.EB(ct2, ct5);
        else        top.EB(ct2, ct5);
    }
    
    sort(ALL(bot), greater<pii>());
    sort(ALL(top));
    
    int idx = 0;
    int dp[110] = {}; // 20
    ll ans = 0;

    for(auto i:top){
        while(idx < siz(bot) && abs(bot[idx].F) <= i.F)
            dp[bot[idx++].S + ZN]++;

        REP(j, -i.S, 80)
            ans += dp[j + ZN];
        dp[i.S + ZN]++;
    }

    cout << ans << endl;
}

int main(){
//    kiyohime
    int T = 1;
    
//    cin >> T;
    while(T--){
        solve();
    }
}





 


Measured memory_bytes: 9956