#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
const int N=200010;
const double eps=1e-10;
int n,maxf,f[N],o2[N],o5[N],cnt[20][20];
double a[N];
ll ans;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%lf",a+i);
		double ep=eps;
		while(a[i]-(ll)a[i]>=ep&&f[i]<9){
			f[i]++;
			a[i]*=10;
			ep*=10;
		}
		maxf=max(maxf,f[i]);
		while((ll)(a[i]+0.5)%2==0){
			o2[i]++;
			a[i]/=2;
		}
		while((ll)(a[i]+0.5)%5==0){
			o5[i]++;
			a[i]/=5;
		}
	}
	for(int i=1;i<=n;i++){
		while(f[i]<maxf){
			o2[i]++;
			o5[i]++;
			f[i]++;
		}
	}
	maxf*=2;
	for(int i=1;i<=n;i++){
		o2[i]=min(o2[i],maxf);
		o5[i]=min(o5[i],maxf);
		for(int j=maxf-o2[i];j<=maxf;j++)
			for(int k=maxf-o5[i];k<=maxf;k++)
				ans+=cnt[j][k];
		cnt[o2[i]][o5[i]]++;
	}
	printf("%lld\n",ans);
	return 0;
}