#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <algorithm>
#include <map>
#include <fstream>
#include <bitset>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef map<int, int> mii;
typedef map<int, string> mis;
typedef map<string, int> msi;
typedef set<int> si;
typedef set<ll> sl;
typedef map<ll, ll> mll;
typedef queue<int> qi;
typedef queue<ii> qii;
typedef vector<string> vs;
typedef pair<ll, ll> iil;
typedef priority_queue<int> pqi;
typedef priority_queue<ii> pqii;
typedef priority_queue<ll> pqil;
typedef priority_queue<iil> pqiil;
typedef vector<iil> viil;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int, ii> iii;
typedef pair<iil, ll> iiil;
typedef vector<pair<pair<int,int>,int>> viii;
typedef vector<pair<pair<ll,ll>,ll>> viiil;

#define pb push_back
#define mp make_pair
#define rep(i, n) for (int i = 0 ; i < n ; i++)
#define INF 1000000000
#define MOD 1000000007;

void solve() {
    int n;
    cin >> n;
    
    vl a;
    vi b;
    
    rep(i, n) {
        string s;
        cin >> s;
        //s = ss[i];
        int di = s.find(".");
        
        ll nm = 0;
        ll pow = 1;
        bool bord = true;
        int bc = 0;
        for (int j = s.length() - 1 ; j >= 0 ; j--) {
            if (j == di) continue;
            if (bord && s[j] == '0' && di < s.length()) {
                bc++;
                continue;
            }
            bord = false;
            nm += pow * (s[j] - '0');
            pow *= 10;
        }
        int dp = s.length() - di - 1 - bc;
        if (di > s.length()) dp = 0;
        //cout << nm << endl;
        a.pb(nm);
        b.pb(dp);
    }
    
    ll sm = 0;
    int LIM = 30;
    ll seen[LIM*2+1][LIM*2+1];
    memset(seen, 0, sizeof seen);
    
    rep(i, n) {
        ll nm = a[i];
        int c = 0;
        int d = 0;
        while (nm % 5 == 0 && nm > 0) {
            nm /= 5;
            c++;
        }
        while (nm % 2 == 0 && nm > 0) {
            nm /= 2;
            d++;
        }
        
        c -= b[i];
        d -= b[i];
        
        for (int j = -LIM ; j <= LIM ; j++) {
            for (int k = -LIM ; k <= LIM ; k++) {
                if (c + j >= 0 && d + k >= 0) {
                    sm += seen[j + LIM][k + LIM];
                }
            }
        }
        seen[c + LIM][d + LIM]++;
    }
    
    cout << sm << endl;
}

int solve2(int n, vs ss) {
    /*int n;
    cin >> n;*/
    
    vl a;
    vi b;
    
    rep(i, n) {
        string s;
        //cin >> s;
        s = ss[i];
        int di = s.find(".");
        
        ll nm = 0;
        ll pow = 1;
        bool bord = true;
        int bc = 0;
        for (int j = s.length() - 1 ; j >= 0 ; j--) {
            if (j == di) continue;
            if (bord && s[j] == '0' && di < s.length()) {
                bc++;
                continue;
            }
            bord = false;
            nm += pow * (s[j] - '0');
            pow *= 10;
        }
        int dp = s.length() - di - 1 - bc;
        if (di > s.length()) dp = 0;
        //cout << nm << endl;
        a.pb(nm);
        b.pb(dp);
    }
    
    int par = 0;
    
    for (int i = 0 ; i < n ; i++) {
        for (int j = 0 ; j < n ; j++) {
            ll nm1 = a[i];
            int c = 0;
            int d = 0;
            //cout << a[i] << " " << a[j] << endl;
            while (nm1 % 5 == 0 && nm1 > 0) {
                nm1 /= 5;
                c++;
            }
            while (nm1 % 2 == 0 && nm1 > 0) {
                nm1 /= 2;
                d++;
            }
            ll nm2 = a[j];
            while (nm2 % 5 == 0 && nm2 > 0) {
                nm2 /= 5;
                c++;
            }
            while (nm2 % 2 == 0 && nm2 > 0) {
                nm2 /= 2;
                d++;
            }
            
            if (c >= b[i] + b[j] && d >= b[i] + b[j] && i != j) {
                par++;
            }
        }
    }
    
    return par/2;
}

void querySolve() {
    int n;
    cin >> n;
    while (n--) {
        //solve();
    }
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    //querySolve();
    /*rep(i, 100) {
        int n = rand() % 5 + 1000;
        vs ss;
        rep(j, n) {
            string s;
            int dg = rand()%4 + 1;
            rep(k, dg) {
                s += '0' + (rand()%9+1);
            }
            s += '.';
            int dp = rand()%8 + 1;
            rep(k, dp) {
                s += '0' + (rand()%9+1);
            }
            ss.pb(s);
        }
        int ans1 = solve(n, ss);
        int ans2 = solve2(n, ss);
        if (ans1 != ans2) {
            cout << n << endl;
            rep(j, n) {
                cout << ss[j] << endl;
            }
            cout << ans1 << " " << ans2 << endl;
            break;
        }
    }*/
    solve();

}


Measured memory_bytes: 6624