#include <bits/stdc++.h>
using namespace std;

using ll = long long;

#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define len(x) int((x).size())

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define randint(n) uniform_int_distribution<int>(1, (n))(rng)

ll ptens[19];
int cnt[2][21][21][11];

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);

	#ifdef ARTHUR_LOCAL
		ifstream cin("input.txt");
	#endif

	ptens[0]=1LL;
	for(int i=1; i<=18; i++) ptens[i]=10LL*ptens[i-1];

	int n;
	cin>>n;

	vector<pair<ll,ll>> fracs;

	for(int i=0; i<n; i++)
	{
		string s;
		cin>>s;
		int pos=-1;
		for(int j=0; j<len(s); j++)
		{
			if(s[j]=='.') pos=j;
		}

		if(pos==-1)
		{
			fracs.push_back({ll(stoi(s)),1LL});
			continue;
		}

		ll intpart=0LL;

		for(int j=0; j<pos; j++)
		{
			intpart*=10LL;
			intpart+=ll((int)s[j] - (int)'0');
		}

		ll decpart=0LL;

		for(int j=pos+1; j<len(s); j++)
		{
			decpart*=10LL;
			decpart+=ll((int)s[j] - (int)'0');
		}

		int trail = len(s)-pos-1;

		ll num = ptens[trail]*intpart + decpart;
		ll den = ptens[trail];

		ll g = __gcd(num,den);

		num/=g;
		den/=g;

		// cout << num << " " << den << endl;

		fracs.push_back({num,den});
	}

	for(int i=0; i<n; i++)
	{
		int n2=0;
		int n5=0;
		int d2=0;
		int d5=0;

		ll num=fracs[i].ff;
		ll den=fracs[i].ss;

		//cout << num << " " << den << endl;

		while(num%2LL==0LL)
		{
			n2++;
			num/=2LL;
		}

		while(num%5LL==0LL)
		{
			n5++;
			num/=5LL;
		}

		while(den%2LL==0LL)
		{
			d2++;
			den/=2LL;
		}

		while(den%5LL==0LL)
		{
			d5++;
			den/=5LL;
		}

		n2=min(n2,20);
		n5=min(n5,20);

		// cout << num << " "

		if(d2==0LL)
		{
			cnt[0][n2][n5][d5]++;

			//cout << 0 << " " << n2 << " " << n5 << " " << d5 << endl;
		}

		else
		{
			cnt[1][d2][n5][d5]++;

			//cout << 1 << " " << n2 << " " << n5 << " " << d2 << endl;
		}

		//if(n2>0&&d2>0) cout << i << endl;
		//if(n5>0&&d5>0) cout << i << " !!"<<endl;
	}

	ll ans=0LL;

	for(int t1=0; t1<2; t1++)
	{
		for(int nn=0; nn<=20; nn++)
		{
			for(int n51=0; n51<=20; n51++)
			{
				for(int d51=0; d51<=10; d51++)
				{
					int n21,d21;
					
					if(t1==0)
					{
						n21=nn;
						d21=0;
					}

					else
					{
						n21=0;
						d21=nn;
					}

					for(int t2=0; t2<2; t2++)
					{
						for(int nnn=0; nnn<=20; nnn++)
						{
							for(int n52=0; n52<=20; n52++)
							{
								for(int d52=0; d52<=10; d52++)
								{
									int n22,d22;

									if(t2==0)
									{
										n22=nnn;
										d22=0;
									}

									else
									{
										n22=0;
										d22=nnn;
									}

									if(n21+n22 >= d21+d22 && n51+n52 >= d51+d52)
									{
										// if(ll(cnt[t1][n21][n51][d])*ll(cnt[t2][n22][n52][dd]) > 0LL)
										// {
										// 	cout << t1 << " " << n21 << " " << n51 << " " << d << " " << t2 << " " << n22 << " " << n52 << " " << dd << endl;
										// 	cout << ll(cnt[t1][n21][n51][d]) << " " << ll(cnt[t2][n22][n52][dd]) << endl;
										// }

										if(t1==t2 && nn==nnn && n51==n52 && d51==d52)
										{
											ans += ll(cnt[t1][nn][n51][d51])*(ll(cnt[t1][nn][n51][d51])-1LL); // don't count doubles
										}

										else ans += ll(cnt[t1][nn][n51][d51])*ll(cnt[t2][nnn][n52][d52]);
									}
								}
							}
						}
					}
				}
			}
		}
	}

	cout << ll(ans/2LL) << "\n";
}

Measured memory_bytes: 7444