#pragma GCC optimize ("O3")
#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("unroll-loops")
#include<bits/stdc++.h>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define ll long long
#define ld long double
#define all(a) a.begin(),a.end()
#define endl '\n'
#define ull unsigned long long
#define y1 ljhadglkjsadf
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define iter set< pair<int,ll> >::iterator
#define iter1 set<int>::iterator
#define int long long
using namespace std;
using namespace __gnu_pbds;

template<class T>
using ordered_set=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

template<class T>
using ordered_multiset=tree<T,null_type,less_equal<T>,rb_tree_tag,tree_order_statistics_node_update>;

mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rnd1(chrono::steady_clock::now().time_since_epoch().count());

//find_by_order
//order_of_key

const int N=2e5+7;
const int inf=1e18+1e9;
const int mod=1e9+7;
const ld eps=1e-9;

//const int MAX_MEM=1e8;
//int mpos=0;
//char mem[MAX_MEM];
//
//inline void * operator new(size_t n){
//    char *res=mem+mpos;
//    mpos+=n;
//    if (mpos>=MAX_MEM){
//        cout<<"BAD"<<endl;
//        exit(0);
//    }
//    return (void*)res;
//}
//
//inline void operator delete(void *) {}

int n;
vector< pair< int,pair<int,int> > >a1;
vector< pair< pair<int,int>, pair<int,int> > >a2;
int st[14];

main ()
{
    st[0]=1;
    for (int i=1;i<14;++i){
        st[i]=(st[i-1]*10);
    }
    ios;
    cin>>n;
    for (int i=1;i<=n;++i){
        string s;
        cin>>s;
        int res=0,kol=0;
        int cur=0;
        for (cur=0;cur<s.size();++cur){
            if (s[cur]=='.')break;
            res=res*10+(s[cur]-'0');
        }
        ++cur;
        int last=0;
        for (int j=0;j<s.size();++j){
            if (s[j]!='0'){
                last=j;
            }
        }
        for (;cur<=last;++cur){
            res=(res*10)+(s[cur]-'0');
            ++kol;
        }
        int kol2=0;
        int kol5=0;
        while(res%2==0){
            ++kol2;
            res/=2;
        }
        while(res%5==0){
            ++kol5;
            res/=5;
        }
        a1.pb({kol,{kol2,kol5}});
    }
    sort(all(a1));
    int cnt=0;
    for (int i=0;i<a1.size();++i){
        if (i && a1[i]!=a1[i-1]){
            pair< pair<int,int>, pair<int,int> > c;
            int kol=a1[i-1].ff;
            int kol2=a1[i-1].ss.ff;
            int kol5=a1[i-1].ss.ss;
            c={{cnt,kol},{kol2,kol5}};
            a2.pb(c);
            cnt=1;
        }
        else {
            ++cnt;
        }
    }
    pair< pair<int,int>, pair<int,int> > c;
    int kol=a1.back().ff;
    int kol2=a1.back().ss.ff;
    int kol5=a1.back().ss.ss;
    c={{cnt,kol},{kol2,kol5}};
    a2.pb(c);
    int ans=0;
    for (int i=0;i<a2.size();++i){
        int cnt1=a2[i].ff.ff;
        int kol1=a2[i].ff.ss;
        int kol12=a2[i].ss.ff;
        int kol15=a2[i].ss.ss;
        if (kol1==0){
            ans+=cnt1*(cnt1-1)/2;
        }
    }
    for (int i=0;i<a2.size();++i){
        for (int j=i+1;j<a2.size();++j){
            int cnt1=a2[i].ff.ff;
            int kol1=a2[i].ff.ss;
            int kol12=a2[i].ss.ff;
            int kol15=a2[i].ss.ss;
            int cnt2=a2[j].ff.ff;
            int kol2=a2[j].ff.ss;
            int kol22=a2[j].ss.ff;
            int kol25=a2[j].ss.ss;
            if (kol12+kol22>=kol1+kol2 && kol15+kol25>=kol1+kol2){
                ans+=cnt1*cnt2;
            }
        }
    }
    cout<<ans<<endl;
}
//8 4
//1 2 3 1 2 3 1 2
//1 2
//2 3
//4 5
//6 7


Measured memory_bytes: 9552