c=eval('[0]*50,'*50)

r=0

for a in[*open(0)][1:]:

 a=round(float(a)*1e9);x=y=1

 while a%2**x<1:x+=1

 while a%5**y<1:y+=1

 r+=sum(sum(d[max(0,20-y):])for d in c[max(0,20-x):]);c[x][y]+=1

print(r)
c=eval('[0]*50,'*50)

r=0

for a in[*open(0)][1:]:

 a=round(float(a)*1e9);y=1

 while a%5**y<1:y+=1

 x=len(bin(a&-a));r+=sum(sum(d[max(0,20-y):])for d in c[max(0,24-x):]);c[x][y]+=1

print(r)
c = eval("[0]*50," * 50)
r = 0
for a in [*open(0)][1:]:
    a = round(float(a) * 1e9)
    x = y = 1
    while a % 2**x < 1:
        x += 1
    while a % 5**y < 1:
        y += 1
    r += sum(sum(d[max(0, 20 - y) :]) for d in c[max(0, 20 - x) :])
    c[x][y] += 1
print(r)

c = eval("[0]*50," * 50)
r = 0
for a in [*open(0)][1:]:
    a = round(float(a) * 1e9)
    y = 1
    while a % 5**y < 1:
        y += 1
    x = len(bin(a & -a))
    r += sum(sum(d[max(0, 20 - y) :]) for d in c[max(0, 24 - x) :])
    c[x][y] += 1
print(r)

-    x = y = 1 -    while a % 2**x < 1: -        x += 1 +    y = 1 -    r += sum(sum(d[max(0, 20 - y) :]) for d in c[max(0, 20 - x) :]) +    x = len(bin(a & -a)) +    r += sum(sum(d[max(0, 20 - y) :]) for d in c[max(0, 24 - x) :])