N, *A = open(0).read().split()





class BIT():

    def __init__(self, n, x=1):

        self.n = n

        self.T = [[0]*20 for _ in [0]*20]



    def add(self, i, y, x):

        i += 1

        y += 1

        while i <= self.n:

            j = y

            while j <= self.n:

                self.T[i][j] += x

                j += j & -j

            i += i & -i



    def _sum(self, i, y):

        i += 1

        y += 1

        ret = 0

        while i > 0:

            j = y

            while j > 0:

                ret += self.T[i][j]

                j ^= j & -j

            i ^= i & -i

        return ret



    def sum(self, i, j):

        return self._sum(18, 18) - self._sum(i-1, 18) - self._sum(18, j-1) + self._sum(i-1, j-1)





ans = 0

B = BIT(19)





def fact(n):

    cnt2 = cnt5 = 0

    for _ in range(18):

        if n % 2:

            break

        n //= 2

        cnt2 += 1

    for _ in range(18):

        if n % 5:

            break

        n //= 5

        cnt5 += 1

    return cnt2, cnt5





for a in A:

    if '.' in a:

        a, b = a.split('.')

        cnt2 = cnt5 = 9 - len(b)



        a = int(a) * (10**len(b)) + int(b)

        c2, c5 = fact(a)

        cnt2 += c2

        cnt5 += c5

    else:

        cnt2 = 9

        cnt5 = 9



        a = int(a)

        c2, c5 = fact(a)

        cnt2 += c2

        cnt5 += c5



    cnt2 = min(18, cnt2)

    cnt5 = min(18, cnt5)



    ans += B.sum(18-cnt2, 18-cnt5)

    B.add(cnt2, cnt5, 1)



print(ans)

import sys

input = sys.stdin.readline

N = int(eval(input()))

T = [[0]*19 for _ in [0]*19]





def count25(x):

    c2 = c5 = 0

    while x % 2 == 0:

        x //= 2

        c2 += 1

    while x % 5 == 0:

        x //= 5

        c5 += 1

    return c2, c5





for _ in range(N):

    a, *b = input().split('.')

    x = int(a) * 10**9

    if b:

        x += int(b[0])*10**(10-len(b[0]))

    c2, c5 = count25(x)

    T[min(18, c2)][min(18, c5)] += 1



ans = 0

for c2 in range(19):

    for c5 in range(19):

        tt = T[c2][c5]

        if tt == 0:

            continue



        for i in range(18-c2, 19):

            for j in range(18-c5, 19):

                if c2 == i and c5 == j:

                    ans += tt*(tt-1)

                else:

                    ans += tt * T[i][j]



print((ans//2))

N, *A = open(0).read().split()


class BIT:
    def __init__(self, n, x=1):
        self.n = n
        self.T = [[0] * 20 for _ in [0] * 20]

    def add(self, i, y, x):
        i += 1
        y += 1
        while i <= self.n:
            j = y
            while j <= self.n:
                self.T[i][j] += x
                j += j & -j
            i += i & -i

    def _sum(self, i, y):
        i += 1
        y += 1
        ret = 0
        while i > 0:
            j = y
            while j > 0:
                ret += self.T[i][j]
                j ^= j & -j
            i ^= i & -i
        return ret

    def sum(self, i, j):
        return (
            self._sum(18, 18)
            - self._sum(i - 1, 18)
            - self._sum(18, j - 1)
            + self._sum(i - 1, j - 1)
        )


ans = 0
B = BIT(19)


def fact(n):
    cnt2 = cnt5 = 0
    for _ in range(18):
        if n % 2:
            break
        n //= 2
        cnt2 += 1
    for _ in range(18):
        if n % 5:
            break
        n //= 5
        cnt5 += 1
    return cnt2, cnt5


for a in A:
    if "." in a:
        a, b = a.split(".")
        cnt2 = cnt5 = 9 - len(b)
        a = int(a) * (10 ** len(b)) + int(b)
        c2, c5 = fact(a)
        cnt2 += c2
        cnt5 += c5
    else:
        cnt2 = 9
        cnt5 = 9
        a = int(a)
        c2, c5 = fact(a)
        cnt2 += c2
        cnt5 += c5
    cnt2 = min(18, cnt2)
    cnt5 = min(18, cnt5)
    ans += B.sum(18 - cnt2, 18 - cnt5)
    B.add(cnt2, cnt5, 1)
print(ans)

import sys

input = sys.stdin.readline
N = int(eval(input()))
T = [[0] * 19 for _ in [0] * 19]


def count25(x):
    c2 = c5 = 0
    while x % 2 == 0:
        x //= 2
        c2 += 1
    while x % 5 == 0:
        x //= 5
        c5 += 1
    return c2, c5


for _ in range(N):
    a, *b = input().split(".")
    x = int(a) * 10**9
    if b:
        x += int(b[0]) * 10 ** (10 - len(b[0]))
    c2, c5 = count25(x)
    T[min(18, c2)][min(18, c5)] += 1
ans = 0
for c2 in range(19):
    for c5 in range(19):
        tt = T[c2][c5]
        if tt == 0:
            continue
        for i in range(18 - c2, 19):
            for j in range(18 - c5, 19):
                if c2 == i and c5 == j:
                    ans += tt * (tt - 1)
                else:
                    ans += tt * T[i][j]
print((ans // 2))

-N, *A = open(0).read().split() +import sys + +input = sys.stdin.readline +N = int(eval(input())) +T = [[0] * 19 for _ in [0] * 19] -class BIT: -    def __init__(self, n, x=1): -        self.n = n -        self.T = [[0] * 20 for _ in [0] * 20] - -    def add(self, i, y, x): -        i += 1 -        y += 1 -        while i <= self.n: -            j = y -            while j <= self.n: -                self.T[i][j] += x -                j += j & -j -            i += i & -i - -    def _sum(self, i, y): -        i += 1 -        y += 1 -        ret = 0 -        while i > 0: -            j = y -            while j > 0: -                ret += self.T[i][j] -                j ^= j & -j -            i ^= i & -i -        return ret - -    def sum(self, i, j): -        return ( -            self._sum(18, 18) -            - self._sum(i - 1, 18) -            - self._sum(18, j - 1) -            + self._sum(i - 1, j - 1) -        ) +def count25(x): +    c2 = c5 = 0 +    while x % 2 == 0: +        x //= 2 +        c2 += 1 +    while x % 5 == 0: +        x //= 5 +        c5 += 1 +    return c2, c5 +for _ in range(N): +    a, *b = input().split(".") +    x = int(a) * 10**9 +    if b: +        x += int(b[0]) * 10 ** (10 - len(b[0])) +    c2, c5 = count25(x) +    T[min(18, c2)][min(18, c5)] += 1 -B = BIT(19) - - -def fact(n): -    cnt2 = cnt5 = 0 -    for _ in range(18): -        if n % 2: -            break -        n //= 2 -        cnt2 += 1 -    for _ in range(18): -        if n % 5: -            break -        n //= 5 -        cnt5 += 1 -    return cnt2, cnt5 - - -for a in A: -    if "." in a: -        a, b = a.split(".") -        cnt2 = cnt5 = 9 - len(b) -        a = int(a) * (10 ** len(b)) + int(b) -        c2, c5 = fact(a) -        cnt2 += c2 -        cnt5 += c5 -    else: -        cnt2 = 9 -        cnt5 = 9 -        a = int(a) -        c2, c5 = fact(a) -        cnt2 += c2 -        cnt5 += c5 -    cnt2 = min(18, cnt2) -    cnt5 = min(18, cnt5) -    ans += B.sum(18 - cnt2, 18 - cnt5) -    B.add(cnt2, cnt5, 1) -print(ans) +for c2 in range(19): +    for c5 in range(19): +        tt = T[c2][c5] +        if tt == 0: +            continue +        for i in range(18 - c2, 19): +            for j in range(18 - c5, 19): +                if c2 == i and c5 == j: +                    ans += tt * (tt - 1) +                else: +                    ans += tt * T[i][j] +print((ans // 2))