import decimal

n = int(eval(input()))

a=[eval(input()) for i in range(n)]

biga=[]

for i in range(n):

    num = decimal.Decimal(a[i])

    biga.append(int(num*10**9))

def fact25(n):

    cnt2=0

    cnt5=0

    while n%2==0:

        n//=2

        cnt2+=1

    while n%5==0:

        n//=5

        cnt5+=1

    return cnt2,cnt5



arr = [[0 for _ in range(20)] for _ in range(20)]

p25 = []

for i in range(n):

    cnt2,cnt5=fact25(biga[i])

    p25.append([cnt2,cnt5])

    cnt2=min(19,cnt2)

    cnt5=min(19,cnt5)

    arr[cnt2][cnt5]+=1



ans=0

for i in range(20): # 2

    for j in range(20): # 5

        if arr[i][j]==0:

            continue

        for k in range(20): # 2

            for l in range(20): # 5

                if i+k>=18 and j+l>=18:

                    if i==k and j==l:

                        ans+= (arr[i][j]-1)*arr[k][l]

                    else:

                        ans+= arr[i][j]*arr[k][l]



print((ans//2))
n = int(eval(input()))

biga = []

for _ in range(n):

    a = float(eval(input()))

    a = round(a * 10 ** 9 + 0.1)

    biga.append(a)



def fact25(n):

    cnt2=0

    cnt5=0

    while n%2==0:

        n//=2

        cnt2+=1

    while n%5==0:

        n//=5

        cnt5+=1

    return cnt2,cnt5



arr = [[0 for _ in range(20)] for _ in range(20)]

p25 = []

for i in range(n):

    cnt2,cnt5=fact25(biga[i])

    p25.append([cnt2,cnt5])

    cnt2=min(19,cnt2)

    cnt5=min(19,cnt5)

    arr[cnt2][cnt5]+=1



ans=0

for i in range(20): # 2

    for j in range(20): # 5

        if arr[i][j]==0:

            continue

        for k in range(20): # 2

            for l in range(20): # 5

                if i+k>=18 and j+l>=18:

                    if i==k and j==l:

                        ans+= (arr[i][j]-1)*arr[k][l]

                    else:

                        ans+= arr[i][j]*arr[k][l]



print((ans//2))
import decimal

n = int(eval(input()))
a = [eval(input()) for i in range(n)]
biga = []
for i in range(n):
    num = decimal.Decimal(a[i])
    biga.append(int(num * 10**9))


def fact25(n):
    cnt2 = 0
    cnt5 = 0
    while n % 2 == 0:
        n //= 2
        cnt2 += 1
    while n % 5 == 0:
        n //= 5
        cnt5 += 1
    return cnt2, cnt5


arr = [[0 for _ in range(20)] for _ in range(20)]
p25 = []
for i in range(n):
    cnt2, cnt5 = fact25(biga[i])
    p25.append([cnt2, cnt5])
    cnt2 = min(19, cnt2)
    cnt5 = min(19, cnt5)
    arr[cnt2][cnt5] += 1
ans = 0
for i in range(20):  # 2
    for j in range(20):  # 5
        if arr[i][j] == 0:
            continue
        for k in range(20):  # 2
            for l in range(20):  # 5
                if i + k >= 18 and j + l >= 18:
                    if i == k and j == l:
                        ans += (arr[i][j] - 1) * arr[k][l]
                    else:
                        ans += arr[i][j] * arr[k][l]
print((ans // 2))

n = int(eval(input()))
biga = []
for _ in range(n):
    a = float(eval(input()))
    a = round(a * 10**9 + 0.1)
    biga.append(a)


def fact25(n):
    cnt2 = 0
    cnt5 = 0
    while n % 2 == 0:
        n //= 2
        cnt2 += 1
    while n % 5 == 0:
        n //= 5
        cnt5 += 1
    return cnt2, cnt5


arr = [[0 for _ in range(20)] for _ in range(20)]
p25 = []
for i in range(n):
    cnt2, cnt5 = fact25(biga[i])
    p25.append([cnt2, cnt5])
    cnt2 = min(19, cnt2)
    cnt5 = min(19, cnt5)
    arr[cnt2][cnt5] += 1
ans = 0
for i in range(20):  # 2
    for j in range(20):  # 5
        if arr[i][j] == 0:
            continue
        for k in range(20):  # 2
            for l in range(20):  # 5
                if i + k >= 18 and j + l >= 18:
                    if i == k and j == l:
                        ans += (arr[i][j] - 1) * arr[k][l]
                    else:
                        ans += arr[i][j] * arr[k][l]
print((ans // 2))

-import decimal - -a = [eval(input()) for i in range(n)] -for i in range(n): -    num = decimal.Decimal(a[i]) -    biga.append(int(num * 10**9)) +for _ in range(n): +    a = float(eval(input())) +    a = round(a * 10**9 + 0.1) +    biga.append(a)