#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
using P = pair<ll,ll>;
const ll mod = 1e9+7;
#define ALL(x) (x).begin(),(x).end()
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REPS(i,n) for(ll (i)=1;(i)<=(n);(i)++)
#define RREP(i,n) for(ll (i)=(n-1);(i)>=0;(i)--)
#define RREPS(i,n) for(ll (i)=(n);(i)>0;(i)--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());

template<class T> inline void chmin(T& a, T b){
    if (a > b){
        a = b;
    }
}

template<class T> inline void chmax(T& a, T b){
    if (a < b){
        a = b;
    }
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(12);
    ll N;
    cin >> N;
    vector<string> A(N);
    vector<P> B(N);
    vector<P> D(N);
    ll large = 0;
    REP(i,N)cin >> A[i];
    REP(i,N){
        ll shousuu = 0;
        REP(l,A[i].size()){
            if(A[i][l] == '.')shousuu = -1;
        }
        if(shousuu == -1){
            RREP(l,A[i].size()){
                if(A[i][l] == '0'){
                    A[i].pop_back();
                }else if(A[i][l] == '.'){
                    A[i].pop_back();
                    shousuu = 0;
                    break;
                }else{
                    break;
                }
            }
        }
        if(shousuu == -1){
            REP(l,A[i].size()){
                if(A[i][A[i].size()-1-l] == '.'){
                    shousuu = l;
                    A[i].erase(A[i].size()-1-l,1);
                }
            }
            REP(l,A[i].size()){
                if(A[i][l] != '0'){
                    A[i].erase(0,l);
                    break;
                }
            }
        }
        ll num = stoll(A[i]);
        ll two = 0,five = 0;
        while(1){
            if(num % 2 == 0){
                two++;
                num/=2;
            }else{
                break;
            }
        }
        while(1){
            if(num % 5 == 0){
                five++;
                num/=5;
            }else{
                break;
            }
        }
        B[i] = mp(five-shousuu,two - shousuu);
        D[i] = mp(two - shousuu,five-shousuu);
        if(B[i].F >= 0&&B[i].S >= 0)large++;
    }
    sort(ALL(B));
    sort(ALL(D));
    ll min = B[0].F;
    ll mint = D[0].F;
    if(min < 0){
        min *= -1;
    }else{
        min = 0;
    }
    if(mint < 0){
        mint *= -1;
    }else{
        mint = 0;
    }
    vector<vector<ll>> C(min + B[N-1].F+1,vector<ll>(60));
    ll fives = B[0].F;
    ll twos = B[0].S;
    REP(i,N){
        if(fives != B[i].F){
            for(ll a = twos+mint+1;a < 60;a++){
                C[fives+min][a] = C[fives+min][twos+mint+1];
            }
            while(1){
                fives++;
                if(fives >= B[i].F){
                    break;
                }
            }
            twos = B[i].S;
        }
        if(twos == B[i].S){
            C[fives+min][twos+mint+1]++;
        }else{
            while(1){
                twos++;
                C[fives+min][twos+mint+1] = C[fives+min][twos+mint];
                if(twos == B[i].S){
                    break;
                }
            }
            C[fives+min][twos+mint+1]++;
        }
    }
    for(ll a = twos+mint+1;a < 60;a++){
        C[fives+min][a] = C[fives+min][twos+mint+1];
    }
    ll sum = 0;
    REP(i,N){
        ll f = B[i].F*(-1);
        ll t = B[i].S*(-1);
        for(ll l = max(f + min,(ll)0);l < C.size();l++){
            if(t+mint >= 0){
                sum += C[l][59] - C[l][t+mint];
            }else{
                sum += C[l][59];
            }
        }
    }
    REP(i,N){
    }
    cout << (sum-large)/2 << "\n";
}

Measured memory_bytes: 15880