#include <bits/stdc++.h>
#include <map>
#include <algorithm> 
#include <vector> 
#include <string.h> 
#include <math.h> 
#include <stdio.h> 
#include <stdlib.h> 
#include <chrono> 
#include <thread> 
#include <iomanip>
#include <typeinfo>
 
//define
#define trav(i,v)   for(auto i: v)
#define rep(i,n)    for(int i=0;i<n;i++)
#define repu(i,k,n) for(int i=k;i<=n;i++)
#define repd(i,k,n) for(int i=k;i>=n;i--)
#define se second
#define fi first
#define pb push_back
#define mp make_pair
#define all(v)  v.begin(), v.end()
#define itn int 

//typedef
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef std::pair<int, int> pii;
typedef std::vector<int> vi;
typedef std::vector< pii > vii;
typedef std::vector< ll > vll;
typedef std::vector< std::pair < pii, int > > vpp;
 
const long long MOD = 1000000007;
// const long long MOD = 998244353;
const long long inf = 1000000000000000000;
 
using namespace std;

ll modpow(ll x,ll n){
    ll res=1;
    while(n>0){
        if(n&1) res=res*x%MOD;
        x=x*x%MOD;
        n>>=1;
    }
    return res;
}
 
ll power(ll x, ll n)
{
    ll res=1;
    while(n>0){
        if(n&1) res=res*x;
        x=x*x;
        n>>=1;
    }
    return res;
}

void solve()
{
    int n;
    cin>>n;
    ld a[n], b[n];
    vll v(n);
    vi v1(n);
    rep(i,n)
    {
        string s;
        cin>>s;
        int f=0;
        int n1=s.length();
        rep(j,n1)
        if(s[j]=='.')
            f=1;
        if(!f)
        {
            n1++;
            s=s+'.';
        }
        int n2=0;
        n1--;
        int n3=s.length();
        rep(j,n3)
        {
            if(s[j]=='.')
            {
                n2=j;
            }
        }
        while((n1-n2)!=9)
        {
            n1++;
            s=s+'0';
        }
        // cout<<n1<<" "<<n2<<" ";
        int x=0;
        v[i]=b[i];
        while(x<=n1)
        {
            v[i]*=10;
            if(s[x]=='.')
                x++;
            v[i]+=(ll)(s[x]-'0');
            x++;
        }
        // cout<<v[i]<<endl;
        v1[i]=9;
    }
    // cout<<v[2]<<endl;
    vi two(n,0), five(n,0);
    rep(i,n)
    {
        while(v[i]%2==0)
        {
            v[i]/=2;
            two[i]++;
        }
        while(v[i]%5==0)
        {
            v[i]/=5;
            five[i]++;
        }
    }
    ll x[25][25][10];
    rep(i,25)
        rep(j,25)
            rep(k,10)
                x[i][j][k]=0;
    rep(i,n)
    {
        int x1=min(two[i],20), x2=min(five[i],20);
        x[x1][x2][v1[i]]++;
    }
    rep(k,10)
    {
        repd(i,22,0)
        {
            repd(j,22,0)
            {
                x[i][j][k]=x[i][j][k]+x[i+1][j][k]+x[i][j+1][k]-x[i+1][j+1][k];
            }
        }
    }
    ll ans=0;
    rep(i,n)
    {
        ll ans1=0;
        repu(j,9,9)
        {
            int x1=max(0,j+v1[i]-two[i]), x2=max(0,j+v1[i]-five[i]);
            // if(i==2)
                // cout<<x1<<" "<<x2<<" "<<v1[i]<<" "<<j<<" "<<two[i]<<endl;
            ans1+=x[x1][x2][j];
        }
        if(min(two[i],five[i])>=v1[i])
            ans1--;
        // cout<<ans1<<" ";
        ans+=ans1;
    }
    ans/=2;
    cout<<ans<<endl;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    int t = 1, tt=1;
    // cin>>t;
    while(tt<=t)
    {
        // cout<<"Case #"<<tt<<": ";
        solve();
        tt++;
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}

Measured memory_bytes: 7180