#include <cstdio>
#include <cstring>
#include <cctype>

typedef long long LL;

int N;
int buk[19][19];
LL Ans;

int main() {
	scanf("%d", &N);
	for (int i = 1; i <= N; ++i) {
		char S[19];
		scanf("%s", S + 1);
		int len = strlen(S + 1);
		int pos = len;
		while (pos > 1 && isdigit(S[pos - 1])) --pos;
		if (pos == 1) pos = len + 2;
		LL x = 0;
		for (int j = 1; j < pos - 1; ++j)
			x = x * 10 + (S[j] - '0');
		for (int j = 0; j < 9; ++j)
			x = x * 10 + (pos + j <= len ? S[pos + j] - '0' : 0);
		int c2 = 0, c5 = 0;
		while (x % 2 == 0) ++c2, x /= 2;
		while (x % 5 == 0) ++c5, x /= 5;
		if (c2 > 18) c2 = 18;
		if (c5 > 18) c5 = 18;
		int t2 = 18 - c2, t5 = 18 - c5;
		for (int i2 = t2; i2 <= 18; ++i2)
			for (int i5 = t5; i5 <= 18; ++i5)
				Ans += buk[i2][i5];
		++buk[c2][c5];
	}
	printf("%lld\n", Ans);
	return 0;
}