CodeEff/ECCO huggingface dataset:
# Original solution
import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  #空白あり
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし

N = I()
A = []
for _ in range(N):
    a = LS2()
    if not '.' in a:
        a = int(''.join(a))
        a *= 10**9
        b,c = 0,0
        while a % 2 == 0:
            a //= 2
            b += 1
        while a % 5 == 0:
            a //= 5
            c += 1
        A.append((b-9,c-9))
    else:
        i = a.index('.')
        l = len(a)
        del a[i]
        a += ['0']*(9-l+1+i)
        a = int(''.join(a))
        b, c = 0, 0
        while a % 2 == 0:
            a //= 2
            b += 1
        while a % 5 == 0:
            a //= 5
            c += 1
        A.append((b - 9, c - 9))


from collections import defaultdict
d = defaultdict(int)
for i in range(N):
    d[A[i]] += 1

ans = 0
for a in list(d.keys()):
    b,c = a
    x = 0
    for e in list(d.keys()):
        f,g = e
        if f >= -b and g >= -c:
            x += d[e]
    ans += d[a]*x

for a in list(d.keys()):
    b,c = a
    if b >= 0 and c >= 0:
        ans -= d[a]

print((ans//2))


# Optimized solution
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし

N = I()
A = []  # A[i] = A_iが2,5で各々何回割り切れるか
for _ in range(N):
    a = LS2()
    if not '.' in a:
        a = int(''.join(a))
        b,c = 0,0
        while a % 2 == 0:
            a //= 2
            b += 1
        while a % 5 == 0:
            a //= 5
            c += 1
        A.append((b,c))
    else:
        i = a.index('.')
        l = len(a)
        del a[i]
        a += ['0']*(9-l+1+i)
        a = int(''.join(a))  # 与えられた実数を10**9倍したもの
        b,c = 0,0
        while a % 2 == 0:
            a //= 2
            b += 1
        while a % 5 == 0:
            a //= 5
            c += 1
        A.append((b-9,c-9))

from collections import defaultdict
d = defaultdict(int)
for i in range(N):
    d[A[i]] += 1

ans = 0
for a in list(d.keys()):
    b,c = a
    x = 0
    for e in list(d.keys()):
        f,g = e
        if f >= -b and g >= -c:  # 積が整数
            x += d[e]
    ans += d[a]*x

# 自分自身どうしの積が整数となるものを取り除く

for a in list(d.keys()):
    b,c = a
    if b >= 0 and c >= 0:
        ans -= d[a]

print((ans//2))
# Original solution
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def exit(*argv, **kwarg):
    print(*argv, **kwarg)
    sys.exit()


def mina(*argv, sub=1): return list(map(lambda x: x - sub, argv))
# 受け渡されたすべての要素からsubだけ引く.リストを*をつけて展開しておくこと


def a_int(): return int(read())


def ints(): return list(map(int, read().split()))


def read_col(H):
    '''H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) #一列の場合'''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret)))


def read_tuple(H):
    '''H is number of rows'''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_matrix(H):
    '''H is number of rows'''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    # return [list(map(int, read().split())) for _ in range(H)] # 内包表記はpypyでは遅いため


MOD = 10**9 + 7
INF = 2**31  # 2147483648 > 10**9
# default import
from collections import defaultdict, Counter, deque
from operator import itemgetter, xor, add
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  # , insort_left, insort_right
from functools import reduce


# 画像でおいた自分の解説見て
N = a_int()
B = []
for _ in ra(N):
    A = read()[:-1]  # floatで扱うと誤差で死ぬ
    if '.' not in A:
        A += '.'
    for _ in range(9 - A[::-1].index('.')):
        A += '0'
    B.append(int(A[:-10] + A[-9:]))

N = []
M = []
for b in B:
    n = 0
    while ~b & 1:  # 偶数である限り
        b >>= 1
        n += 1
    N.append(n)

    m = 0
    while b % 5 == 0:  # 5で割れる限り
        b //= 5
        m += 1
    M.append(m)

cnt = [[0] * 19 for _ in ra(19)]
ans = 0
for n, m in zip(N, M):
    x = max(18 - n, 0)
    y = max(18 - m, 0)
    for i, j in product(range(x, 19), range(y, 19)):
        ans += cnt[i][j]

    # このデータをcntに追加
    cnt[min(n, 18)][min(m, 18)] += 1

print(ans)


# Optimized solution
import sys
read = sys.stdin.readline
ra = range
enu = enumerate


def a_int(): return int(read())


from itertools import product


# 画像でおいた自分の解説見て
N = a_int()
B = []
for _ in ra(N):
    A = read()[:-1]  # floatで扱うと誤差で死ぬ
    if '.' not in A:
        A += '.'
    for _ in range(9 - A[::-1].index('.')):
        A += '0'
    B.append(int(A[:-10] + A[-9:]))

N = []
M = []
for b in B:
    n = 0
    while ~b & 1:  # 偶数である限り
        b >>= 1
        n += 1
    N.append(n)

    m = 0
    while b % 5 == 0:  # 5で割れる限り
        b //= 5
        m += 1
    M.append(m)

cnt = [[0] * 19 for _ in ra(19)]
ans = 0
for n, m in zip(N, M):
    x = max(18 - n, 0)
    y = max(18 - m, 0)
    for i, j in product(list(range(x, 19)), list(range(y, 19))):
        ans += cnt[i][j]
    # このデータをcntに追加
    cnt[min(n, 18)][min(m, 18)] += 1

print(ans)
# Original solution
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)


# Optimized solution
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))
# Original solution
from collections import defaultdict
def decomp(m):
    pf=defaultdict(int)
    for i in range(2,int(m**0.5)+1):
        while m%i==0:
            pf[i]+=1
            m//=i
    if m>1:pf[m]=1
    return (pf[2], pf[5])

n=int(eval(input()))
table=[[0]*50 for _ in range(50)]
ans=0
for i in range(n):
    a=eval(input())
    ax=round(float(a)*(10**9))
    p2,p5=decomp(ax)
    if i!=0:
        for j in range(18-p2,19):
            ans+=sum(table[j][18-p5:])
    table[p2][p5]+=1

print(ans)

# Optimized solution
def decomp(m):
    p2=0
    p5=0
    while m%2==0:
        m//=2
        p2+=1
    while m%5==0:
        m//=5
        p5+=1
    return p2,p5

n=int(eval(input()))
table=[[0]*50 for _ in range(50)]
ans=0
for i in range(n):
    a=input().split('.')
    if len(a)==1:
        ax=int(a[0]+'0'*9)
    else:
        ax=int(a[0]+a[1]+'0'*(9-len(a[1])))
    p2,p5=decomp(ax)
    if i!=0:
        for j in range(18-p2,50):
            ans+=sum(table[j][18-p5:])
    table[p2][p5]+=1

print(ans)
# Original solution
def five(x):
    cnt1 = 0
    while x%5==0:
        cnt1+= 1
        x = x//5
    cnt2 = 0
    while x%2==0:
        cnt2+= 1
        x = x//2
    return (min(cnt1,18), min(cnt2,18))

N = int(eval(input()))

F = []
for i in range(N):
    A = float(eval(input()))
    A = round(A*(10**9))
    F.append(five(A))

F.sort()
# print(F)
j = 0
temp = 0
dp = [0]*19
k = 0
for i in range(N-1):
    if N-1-j < i:
        dp[min(F[i][1], 18)] -= 1
        # print(i, N - j - 1, dp)
    while N-1-j> i and F[i][0]+F[N-1-j][0] >= 18:
        dp[min(F[N-1-j][1],18)] += 1
        # print(i, N - j - 1, dp)
        j += 1
    k = sum(dp[:18-F[i][1]])
    temp += min(j, N-i-1) - k
    # print(j, N-i-1, k, temp)

print(temp)

"""
5
1
1
1
1
1
"""

# Optimized solution
def five(x):
    cnt1 = 0
    while x%5==0:
        cnt1+= 1
        x = x//5
    cnt2 = 0
    while x%2==0:
        cnt2+= 1
        x = x//2
    return (min2(cnt1,18), min2(cnt2,18))

def min2(x,y):
    return x if x < y else y

import sys
input = sys.stdin.readline

N = int(eval(input()))
F = []
for i in range(N):
    A = float(eval(input()))
    A = round(A*(10**9))
    F.append(five(A))

F.sort()
j = 0
temp = 0
dp = [0]*19
k = 0
for i in range(N-1):
    if N-1-j < i:
        dp[min2(F[i][1], 18)] -= 1
    while N-1-j> i and F[i][0]+F[N-1-j][0] >= 18:
        dp[min2(F[N-1-j][1],18)] += 1
        j += 1
    k = sum(dp[:18-F[i][1]])
    temp += min2(j, N-i-1) - k

print(temp)
# Original solution
import sys
readline = sys.stdin.readline
from math import floor
from decimal import Decimal

N = int(readline())
A = [Decimal(readline()) for _ in range(N)]


G = 10**10
Aint = [int(a) for a in A if int(a) == a]
Afl = [int(a*G) for a in A if int(a) != a]


H = 200
geta = 100
Grid = [[0]*H for _ in range(H)]


i25 = []
for ai in Aint:
    i2 = 0
    i5 = 0
    while ai%2 == 0:
        ai //= 2
        i2 += 1
    while ai%5 == 0:
        ai //= 5
        i5 += 1
    i25.append((i2, i5)) 

for af in Afl:
    i2 = -10
    i5 = -10
    while af%2 == 0:
        af //= 2
        i2 += 1
    while af%5 == 0:
        af //= 5
        i5 += 1
    i25.append((i2, i5)) 


for i2, i5 in i25:
    Grid[geta+i2][geta+i5] += 1

for i in range(geta+90, geta-90, -1):
    for j in range(geta+90, geta-90, -1):
        Grid[i][j] += Grid[i][j+1]

for j in range(geta+90, geta-90, -1):
    for i in range(geta+90, geta-90, -1):
        Grid[i][j] += Grid[i+1][j]


lai = len(Aint)
ans = 0
for i2, i5 in i25:
    ans += Grid[geta-i2][geta-i5]
    #print(i2, i5, Grid[geta-i2][geta-i5])
print(((ans-lai)//2))

# Optimized solution
import sys
readline = sys.stdin.readline

G = 10**10
lai = 0
def Decimal(x):
    global lai
    a = x.strip().split('.')
    if len(a) == 1 or all([ai == '0' for ai in a[1]]):
        lai += 1
        return int(a[0])*G
        
    lf = len(a[1])
    i, f = list(map(int, a))
    return (i*10**(lf) + f)*10**(10-lf)
    
    
N = int(readline())
A = [Decimal(readline()) for _ in range(N)]

H = 200
geta = 100
Grid = [[0]*H for _ in range(H)]
i25 = []


for af in A:
    i2 = -10
    i5 = -10
    while af%2 == 0:
        af //= 2
        i2 += 1
    while af%5 == 0:
        af //= 5
        i5 += 1
    i25.append((i2, i5)) 


for i2, i5 in i25:
    Grid[geta+i2][geta+i5] += 1

for i in range(geta+90, geta-90, -1):
    for j in range(geta+90, geta-90, -1):
        Grid[i][j] += Grid[i][j+1]

for j in range(geta+90, geta-90, -1):
    for i in range(geta+90, geta-90, -1):
        Grid[i][j] += Grid[i+1][j]


ans = 0
for i2, i5 in i25:
    ans += Grid[geta-i2][geta-i5]
    #print(i2, i5, Grid[geta-i2][geta-i5])
print(((ans-lai)//2))
# Original solution
#AGC047-A Integer Product
"""
小数または整数が与えられるので、その積が整数となるペアの個数を求めよ。

まず入力に10**9をかけることで、
問題を「その積が10**18の倍数となるペアの個数を求めよ」
とする。
その場合、とりあえず10**18を素因数分解すると2**18と5**18なので、
片方が因数分解済みであるとした時に、
dp[i][j] : 2**iかつ5**jの個数
として、もう片方を2**aかつ5**bであると考えた時に、
2**(i+a)>=18かつ5**(j+b)>=18となるならば、それは条件を満たす
と考えられる。

よってこの個数を数えることで問題が解けた。
"""
import sys
from decimal import Decimal
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0
n = int(readline())
lst1  = [] 
for i in range(n):
    s = readline().rstrip().decode('utf-8')
    lst1.append(int(Decimal(s)*(10**9)))

dp = [[0]*20 for _ in range(50)]

ans = 0

for i in range(n):
    res = lst1[i]
    t,f = 0,0
    while True:
        if res%2==0:
            res //= 2
            t += 1
        else:
            break
    while True:
        if res%5==0:
            res //= 5
            f += 1
        else:
            break
    #i+t>=18かつj+f>=18であるような場所からカウント
    for i in range(18-t,50):
        for j in range(18-f,20):
            ans += dp[i][j]
    dp[t][f] += 1

print(ans)


# Optimized solution
#AGC047-A Integer Product
"""
小数または整数が与えられるので、その積が整数となるペアの個数を求めよ。

まず入力に10**9をかけることで、
問題を「その積が10**18の倍数となるペアの個数を求めよ」
とする。
その場合、とりあえず10**18を素因数分解すると2**18と5**18なので、
片方が因数分解済みであるとした時に、
dp[i][j] : 2**iかつ5**jの個数
として、もう片方を2**aかつ5**bであると考えた時に、
2**(i+a)>=18かつ5**(j+b)>=18となるならば、それは条件を満たす
と考えられる。

よってこの個数を数えることで問題が解けた。
"""
import sys
from decimal import Decimal
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0
n = int(readline())
lst1  = [] 
for i in range(n):
    s = readline().rstrip().decode('utf-8')
    lst1.append(int(Decimal(s)*(10**9)))

dp = [[0]*20 for _ in range(45)]

ans = 0

for i in range(n):
    res = lst1[i]
    t,f = 0,0
    while True:
        if res%2==0:
            res //= 2
            t += 1
        else:
            break
    while True:
        if res%5==0:
            res //= 5
            f += 1
        else:
            break
    #i+t>=18かつj+f>=18であるような場所からカウント
    for i in range(18-t,45):
        for j in range(18-f,20):
            ans += dp[i][j]
    dp[t][f] += 1

print(ans)
# Original solution
from collections import defaultdict

N = int(eval(input()))
b = 10**9
A = [int(round(float(eval(input()))*b)) for i in range(N)]
dic = defaultdict(int)
for a in A:
    c2, c5 = 0, 0
    while a % 2 == 0:
        c2 += 1
        a //= 2
    while a % 5 == 0:
        c5 += 1
        a //= 5
    dic[(c2, c5)] += 1
ans = 0
for i in range(50):
    for j in range(25):
        for k in range(50):
            for l in range(25):
                if i+k >= 18 and j+l >= 18:
                    if i == k and j == l:
                        ans += dic[(i, j)] * (dic[(i, j)] - 1)
                    else:
                        ans += dic[(i, j)] * dic[(k, l)]
print((ans//2))


# Optimized solution
from collections import defaultdict

N = int(eval(input()))
b = 10**9
A = [int(round(float(eval(input()))*b)) for i in range(N)]
dic = defaultdict(int)
for a in A:
    c2, c5 = 0, 0
    while a % 2 == 0 and c2 < 18:
        c2 += 1
        a //= 2
    while a % 5 == 0 and c5 < 18: 
        c5 += 1
        a //= 5
    dic[(c2, c5)] += 1
ans = 0
for i in range(50):
    for j in range(25):
        for k in range(50):
            for l in range(25):
                if i+k >= 18 and j+l >= 18:
                    if i == k and j == l:
                        ans += dic[(i, j)] * (dic[(i, j)] - 1)
                    else:
                        ans += dic[(i, j)] * dic[(k, l)]
print((ans//2))
# Original solution
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7
MAX = 50


def resolve():
    n = int(eval(input()))

    D = [[0] * MAX for _ in range(MAX)]
    for _ in range(n):
        a = int(round(float(eval(input())) * 10 ** 9))
        t = a
        x = 0
        while t % 2 == 0:
            t //= 2
            x += 1
        t = a
        y = 0
        while t % 5 == 0:
            t //= 5
            y += 1
        D[x][y] += 1

    res = 0
    for x1 in range(MAX):
        for y1 in range(MAX):
            for x2 in range(max(0, 18 - x1), MAX):
                for y2 in range(max(0, 18 - y1), MAX):
                    if x1 == x2 and y1 == y2:
                        res += D[x1][y1] * (D[x1][y1] - 1)
                    else:
                        res += D[x1][y1] * D[x2][y2]
    print((res // 2))


if __name__ == '__main__':
    resolve()


# Optimized solution
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 998244353


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

    L = [[0] * 25 for _ in range(45)]
    D = []
    for a in A:
        tmp = a
        ex2 = ex5 = 0
        while tmp % 2 == 0:
            tmp //= 2
            ex2 += 1
        tmp = a
        while tmp % 5 == 0:
            tmp //= 5
            ex5 += 1
        L[ex2][ex5] += 1
        D.append((ex2, ex5))

    res = 0
    check = [[False] * 25 for _ in range(45)]
    for i in range(45):
        for j in range(25):
            if L[i][j] == 0:
                check[i][j] = True
                continue
            for k in range(18 - i, 45):
                for l in range(18 - j, 25):
                    if check[k][l]:
                        continue
                    if k == i and l == j:
                        res += L[i][j] * (L[k][l] - 1) // 2
                    else:
                        res += L[i][j] * L[k][l]
            check[i][j] = True
    print(res)


if __name__ == '__main__':
    resolve()
# Original solution
N = int(eval(input()))
A = [0] * N
for i in range(N):
    A[i] = round(float(eval(input()))*(10**9))
from itertools import combinations
base = list(combinations(A,2))
floatans=0
for i in range(len(base)):
    a=base[i][0]*base[i][1]
    if a%(10**18)==0:
        floatans+=1
print(floatans)

# Optimized solution
N = int(eval(input()))
A = [0] * N
for i in range(N):
    A[i] = round(float(eval(input()))*(10**9))
floatans=0
for i in range(N):
    for j in range(i+1,N):
        if (A[i]*A[j])%(10**18)==0:
            floatans+=1
print(floatans)
# Original solution

from fractions import Fraction
from decimal import Decimal
n = int(eval(input()))
a = []
b = []
for i in range(0,n):
	c = float(eval(input()))
	a.append(c)
	d = str(a[i])
	f = Fraction(Decimal(d))
	b.append(f)

x = []
y = []

for i in range(0,n):
	x.append(b[i].numerator)
	y.append(b[i].denominator)

count = 0

for i in range(0,n)	:
	for j in range(i+1,n):
		if (x[i]*x[j]) % (y[i]*y[j]) == 0:
			count += 1

print(count)

# Optimized solution
from math import gcd
from collections import Counter
import sys

N = int(eval(input()))
K = 10**9
L = 10**18
A = [0] * N
C = Counter()
ans = 0

for i in range(N):
	A[i] = round(K * float(eval(input())))
	C[gcd(A[i],L)] += 1 
	
for k1,v1 in list(C.items()):
	for k2 ,v2 in list(C.items()):
		if k1 == k2:
			if k1*k2 % L == 0:
				ans += v1*(v1-1)/2
		elif k1 < k2:
			if k1*k2 % L == 0:
				ans += v1 * v2

print((int(ans)))
# Original solution
import sys, math
from collections import defaultdict, deque, Counter
from bisect import bisect_left, bisect_right
from itertools import combinations, permutations, product
from heapq import heappush, heappop
from functools import lru_cache
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(eval(input()))
rl = lambda: list(map(int, input().split()))
mod = 1000000007
sys.setrecursionlimit(1000000)

from decimal import Decimal

def get_primes(n):
	divs = defaultdict(int)
	if n == 0: return divs
	for i in [2,5]:
		c = 0
		while n % i == 0:
			n = n // i
			c += 1
		if c > 0:
			divs[i] = c
	return divs

L = 10**9
N = ri()
A = []
for i in range(N):
	d = Decimal(rs())
	A.append(int(d*L))
#print(A)

R = [0] * N
for i, a in enumerate(A):
	R[i] = A[i] % L
#print(R)

M = 18
K = 0
C = []
D = []
for i in range(N):
	r = R[i]
	a = A[i]
	if r > 0:
		ps = get_primes(a)
		C.append([min(ps[2], M), min(ps[5], M)])
	else:
		ps = get_primes(a)
		D.append([min(ps[2], M), min(ps[5], M)])
#print('C',C)
#print('D',D)

h = defaultdict(int)
ans0 = 0
for c in C:
	d = [M-c[0], M-c[1]]
	i, j = d[0], d[1]
	for i in range(d[0], M+1):
		for j in range(d[1], M+1):
			if (i, j) in h:
				ans0 += h[(i,j)] - (c == (i,j))
	h[tuple(c)] += 1

ans1 = len(D)*(len(D)-1)//2

ans2 = 0
for c in D:
	d = [M-c[0], M-c[1]]
	for i in range(d[0], M+1):
		for j in range(d[1], M+1):
			if (i, j) in h:
				ans2 += h[(i,j)] - (c == (i,j))
#print(ans0, ans1, ans2)
ans = ans0 + ans1 + ans2
print(ans)


# Optimized solution
import sys, math
from collections import defaultdict, deque, Counter
from bisect import bisect_left, bisect_right
from itertools import combinations, permutations, product
from heapq import heappush, heappop
from functools import lru_cache
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(eval(input()))
rl = lambda: list(map(int, input().split()))
mod = 1000000007
sys.setrecursionlimit(1000000)

from decimal import Decimal

def gcd(a, b):
	return gcd(b, a%b) if b else a

L = 10**9
LL = 10**18
N = ri()
A = []
for i in range(N):
	d = Decimal(rs())
	A.append(int(d*L))

h = defaultdict(int)
for i in range(N):
	g = gcd(A[i], LL)
	h[g] += 1

ans = 0
for g, c in list(h.items()):
	for g2, c2 in list(h.items()):
		if g == g2:
			if g*g % LL == 0:
				ans += c*(c-1)//2
		elif g < g2:
			if g*g2 % LL == 0:
				ans += c * c2
print(ans)
# Original solution
N, *A = open(0).read().split()

S = [[0] * 21 for _ in range(21)]

ans = 0
for a in A:
    if (idx := a.find(".")) == -1:
        c2 = c5 = 0
    else:
        c2 = c5 = -(len(a) - idx - 1)

    a = int(a.replace(".", ""))
    while a % 2 == 0:
        c2 += 1
        a //= 2
    while a % 5 == 0:
        c5 += 1
        a //= 5
    c2 = min(c2, 10)
    c5 = min(c5, 10)
    ans += sum(S[i][j] for i in range(10 - c2, 21) for j in range(10 - c5, 21))

    S[c2 + 10][c5 + 10] += 1

print(ans)

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

S = [[0] * 21 for _ in range(21)]

ans = 0
for a in A:
    idx = a.find(".")
    if idx == -1:
        c2 = c5 = 0
    else:
        c2 = c5 = -(len(a) - idx - 1)

    a = int(a.replace(".", ""))
    while a % 2 == 0:
        c2 += 1
        a //= 2
    while a % 5 == 0:
        c5 += 1
        a //= 5
    c2 = min(c2, 10)
    c5 = min(c5, 10)
    ans += sum(S[i][j] for i in range(10 - c2, 21) for j in range(10 - c5, 21))

    S[c2 + 10][c5 + 10] += 1

print(ans)