You are given N real values A_1, A_2, ..., A_N. Compute the number of pairs of indices (i, j) such that i < j and the product A_i * A_j is an integer. Constraints: 2 <= N <= 200,000, 0 < A_i < 10^4, A_i is given with at most 9 digits after the decimal. Input is given in the format: N, A_1, A_2, ..., A_N. Output the number of pairs with integer product A_i * A_j (and i < j).

# Buggy version:
MOD=10**9
from decimal import Decimal
import sys
input=sys.stdin.readline
    
def w(i,m):
    cnt=0
    while(i>0 and i%m==0):
        i//=m
        cnt+=1
    return cnt

N=int(input())
A=[int(Decimal(input())*Decimal(MOD)) for i in range(N)]
dic=[{} for i in range(N)]
dp=[[0]*51 for i in range(51)]

for i in range(N):
    dic[i][2],dic[i][5]=w(A[i],2),w(A[i],5)
    dp[dic[i][2]][dic[i][5]]+=1

for i in reversed(range(51)):
    for j in reversed(range(51)):
        if i==50 and j==50:
            continue
        if i==50:
            dp[i][j]+=dp[i][j+1]
        elif j==50:
            dp[i][j]+=dp[i+1][j]
        else:
            dp[i][j]+=dp[i][j+1]+dp[i+1][j]-dp[i+1][j+1]
ans=0

for i in range(N):
    t,f=max(18-dic[i][2],0),max(18-dic[i][5],0)
    res=dp[t][f]
    if t<=a and f<=b:
        res-=1
    ans+=res
print(ans//2)

# Fixed version:
from decimal import Decimal
import sys
input=sys.stdin.readline

    
def w(i,m):
    cnt=0
    while(i>0 and i%m==0):
        i//=m
        cnt+=1
    return cnt

N=int(input())
A=[int(Decimal(input())*Decimal(1000000000)) for i in range(N)]
dic=[None for i in range(N)]
dp=[[0]*51 for i in range(51)]

for i in range(N):
    d={}
    d[2],d[5]=w(A[i],2),w(A[i],5)
    dp[d[2]][d[5]]+=1
    dic[i]=d

for i in reversed(range(51)):
    for j in reversed(range(51)):
        if i==50 and j==50:
            continue
        if i==50:
            dp[i][j]+=dp[i][j+1]
        elif j==50:
            dp[i][j]+=dp[i+1][j]
        else:
            dp[i][j]+=dp[i][j+1]+dp[i+1][j]-dp[i+1][j+1]
ans=0

for i in range(N):
    d=dic[i]
    a,b=d[2],d[5]
    t,f=max(18-a,0),max(18-b,0)
    res=dp[t][f]
    if t<=a and f<=b:
        res-=1
    ans+=res
print(ans//2)

# Buggy version:
N=int(input())
D={}
from decimal import Decimal
A=[Decimal(input()) for _ in range(N)]
A=[int(i*10**9) for i in A]
for i in range(N):
  x=A[i]
  y=x
  tcnt,fcnt=0,0
  while x%2==0 and tcnt<18:
    tcnt+=1
    x=x//2
  while y%5==0 and fcnt<18:
    fcnt+=1
    y=y//5
  A[fcnt][tcnt]+=1

cnt=0
for i in range(19):
  for j in range(19):
    for k in range(19):
      for l in range(19):
        if i+k>=18 and j+l>=18:
          if i!=k and j!=l:
            d=A[i][j]
            e=A[k][l]
            p=d*e
          elif i==k and j==l:
            d=A[i][j]
            p=d*(d-1)
          else:
            d=A[i][j]
            e=A[k][l]
            p=d*e
          cnt+=p
print(cnt//2)

# Fixed version:
N=int(input())
D={}
from decimal import Decimal
B=[Decimal(input()) for _ in range(N)]
B=[int(i*10**9) for i in B]
A=[[0]*19 for i in range(19)]
for i in range(N):
  x=B[i]
  y=x
  tcnt,fcnt=0,0
  while x%2==0 and tcnt<18:
    tcnt+=1
    x=x//2
  while y%5==0 and fcnt<18:
    fcnt+=1
    y=y//5
  A[fcnt][tcnt]+=1

cnt=0
for i in range(19):
  for j in range(19):
    for k in range(19):
      for l in range(19):
        if i+k>=18 and j+l>=18:
          if i!=k and j!=l:
            d=A[i][j]
            e=A[k][l]
            p=d*e
          elif i==k and j==l:
            d=A[i][j]
            p=d*(d-1)
          else:
            d=A[i][j]
            e=A[k][l]
            p=d*e
          cnt+=p
print(cnt//2)

# Buggy version:
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=tf-8
#

"""
"""

from collections import defaultdict
import bisect

import sys
input = sys.stdin.readline
from decimal import *
from collections import Counter


def solve(n):
    cnt = Counter()
    n_int = 0
    for _ in range(n):
        getcontext().prec = 20
        a = input()
        da = Decimal(a)
        ia = int(da*(10**9))
        if ia%10**9 == 0:
            n_int += 1
        pmul_2 = 0
        pmul_5 = 0
        ia2 = ia
        while ((ia2 & 1) == 0 and pmul_2 < 18): 
            ia2 = ia2 >> 1
            pmul_2 += 1
        ia5 = ia
        while 1:
            if ia5 % 5 ==0:
                pmul_5 += 1
                ia5 = ia5//5
            else:
                break
        cnt[(pmul_2,pmul_5)] += 1
    ans = 0
    print(cnt)
    for pm2_1 in range(0,19):
        for pm2_2 in range(18-pm2_1,19):
            for pm5_1 in range(1,19):
                for pm5_2 in range(18-pm5_1,19):
                    ans += cnt[(pm2_1,pm5_1)]*cnt[(pm2_2,pm5_2)]
    ans -= n_int
    ans = ans//2

    print(ans)
                






def main():
    n = int(input())
    solve(n)


if __name__ == "__main__":
    main()

# Fixed version:
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=tf-8
#

"""
"""

from collections import defaultdict
import bisect

import sys
input = sys.stdin.readline
from decimal import *
from collections import Counter


def solve(n):
    cnt = Counter()
    n_int = 0
    for _ in range(n):
        getcontext().prec = 22
        a = input().rstrip()
        da = Decimal(a)
        ia = int(da.shift(9))
        #print(a,ia)
        if ia%10**9 == 0:
            n_int += 1
        pmul_2 = 0
        pmul_5 = 0
        ia2 = ia
        while ((ia2 & 1) == 0 and pmul_2 < 18): 
            ia2 = ia2 >> 1
            pmul_2 += 1
        ia5 = ia
        while 1:
            if (ia5 % 5 ==0 and pmul_5 < 18):
                pmul_5 += 1
                ia5 = ia5//5
            else:
                break
        cnt[(pmul_2,pmul_5)] += 1
    ans = 0
    #print(cnt)
    for pm2_1 in range(0,19):
        for pm2_2 in range(18-pm2_1,19):
            for pm5_1 in range(0,19):
                for pm5_2 in range(18-pm5_1,19):
                    ans += cnt[(pm2_1,pm5_1)]*cnt[(pm2_2,pm5_2)]
    ans -= n_int
    ans = ans//2
    
    print(ans)
                






def main():
    n = int(input())
    solve(n)


if __name__ == "__main__":
    main()

# Buggy version:
import collections
import sys
input = sys.stdin.readline
N = int(input())
A = [input() for i in range(N)]

C = collections.defaultdict(int)
for i, x in enumerate(A):
    idx = 0
    x = x[:-1]
    if '.' in x:
        idx = x[::-1].index('.')
        x = x.replace('.', '')
    x = int(x)
    count2 = -idx
    count5 = -idx
    print(x, idx)
    while(x % 2 == 0):
        x = x // 2
        count2 += 1

    while(x % 5 == 0):
        x = x // 5
        count5 += 1
    C[(count2, count5)] += 1
ans = 0
for a, b in C:
    for a2, b2 in C:
        if a+a2 >= 0 and b+b2 >= 0:
            if a == a2 and b == b2:
                ans += C[(a, b)]*(C[(a, b)]-1)
            else:
                ans += C[(a, b)]*C[(a2, b2)]
print(ans//2)


# Fixed version:
import collections
import sys
input = sys.stdin.readline
N = int(input())
A = [input() for i in range(N)]

C = collections.defaultdict(int)
for i, x in enumerate(A):
    idx = 0
    x = x[:-1]
    if '.' in x:
        idx = x[::-1].index('.')
        x = x.replace('.', '')
    x = int(x)
    count2 = -idx
    count5 = -idx
    while(x % 2 == 0):
        x = x // 2
        count2 += 1

    while(x % 5 == 0):
        x = x // 5
        count5 += 1
    C[(count2, count5)] += 1
ans = 0
for a, b in C:
    for a2, b2 in C:
        if a+a2 >= 0 and b+b2 >= 0:
            if a == a2 and b == b2:
                ans += C[(a, b)]*(C[(a, b)]-1)
            else:
                ans += C[(a, b)]*C[(a2, b2)]
print(ans//2)

# Buggy version:
#mult 10**9 
from decimal import Decimal
from math import gcd
from collections import Counter
n=int(input())
a=[int(Decimal(input())*10**9) for _ in range(n)]

tf = []

for i in range(n):
    t=0;f=0;
    while a[i]%2==0:
        t+=1
        a[i]//=2
    while a[i]%5==0:
        f+=1
        a[i]//=5
    tf.append((t-9,f-9))

ctf = Counter(tf)
ans=0
for t,f in ctf:
    for t2,f2 in ctf:
        if t+t2>=0 and f+f2>=0:
            if t!=t2 or f!=f2:
                ans+= ctf[(t,f)]*ctf[(t2,f2)]
            else:
                ans+= ctf[(t,f)]*(ctf[(t,f)]-1)
print(ans) 




# Fixed version:
#mult 10**9 
import sys
input = sys.stdin.readline
from decimal import Decimal
from math import gcd
from collections import Counter
n=int(input())
a=[int(Decimal(input())*10**9) for _ in range(n)]

tf = []

for i in range(n):
    t=0;f=0;
    while a[i]%2==0:
        t+=1
        a[i]//=2
    while a[i]%5==0:
        f+=1
        a[i]//=5
    tf.append((t-9,f-9))

ctf = Counter(tf)
ans=0
for t,f in ctf:
    for t2,f2 in ctf:
        if t+t2>=0 and f+f2>=0:
            if t!=t2 or f!=f2:
                ans+= ctf[(t,f)]*ctf[(t2,f2)]
            else:
                ans+= ctf[(t,f)]*(ctf[(t,f)]-1)
print(ans//2)

# Buggy version:
import collections
import sys
input=sys.stdin.readline

def calc(n):
  cnt_2=0
  cnt_5=0
  while n%2==0 and cnt_2<18:
    cnt_2+=1
    n//=2
  while n%5==0 and cnt_5<18:
    cnt_5+=1
    n//=5
  return [cnt_2,cnt_5]

n=int(input())
dic=collections.defaultdict(int)
ans=0
for _ in range(n):
  tmp=input()
  if '.' in tmp:
    pos=tmp.index('.')
    d=len(tmp)-(pos+1)
    tmp=tmp[:pos]+tmp[pos+1:]+'0'*(9-d)
  else:
    tmp+='0'*9
  tmp=int(tmp)
  cnt_2,cnt_5=calc(tmp)
  dic[(cnt_2,cnt_5)]+=1
  if 18<=min(cnt_2*2,cnt_5*2):
    ans-=1
for a1,b1 in dic.keys():
  for a2,b2 in dic.keys():
    if min(a1+a2,b1+b2)>=18:
      ans+=dic[(a1,b1)]*dic[(a2,b2)]
print(ans//2)

# Fixed version:
import collections

def calc(n):
  cnt_2=0
  cnt_5=0
  while n%2==0 and cnt_2<18:
    cnt_2+=1
    n//=2
  while n%5==0 and cnt_5<18:
    cnt_5+=1
    n//=5
  return [cnt_2,cnt_5]

n=int(input())
dic=collections.defaultdict(int)
ans=0
for _ in range(n):
  tmp=input()
  if '.' in tmp:
    pos=tmp.index('.')
    d=len(tmp)-(pos+1)
    tmp=tmp[:pos]+tmp[pos+1:]+'0'*(9-d)
  else:
    tmp+='0'*9
  tmp=int(tmp)
  cnt_2,cnt_5=calc(tmp)
  dic[(cnt_2,cnt_5)]+=1
  if 18<=min(cnt_2*2,cnt_5*2):
    ans-=1
for a1,b1 in dic.keys():
  for a2,b2 in dic.keys():
    if min(a1+a2,b1+b2)>=18:
      ans+=dic[(a1,b1)]*dic[(a2,b2)]
print(ans//2)

# Buggy version:
c=[[0]*50for _ in range(50)]
r=0
for a in[*open(0)][1:]:
  a=round(float(a)*10**9)
  x=y=0
  while a&1<1:
    a>>=1
    x+=1
  while a%5<1:
    a//=5
    y+=1
  r+=sum(sum(d[max(0,18-x):])for d in c[max(0,18-y):])
  c[x][y]+=1
print(r)

# Fixed version:
c=[[0]*50for _ in range(50)]
r=0
for a in[*open(0)][1:]:
  a=round(float(a)*10**9)
  x=y=0
  while a%2<1:
    a//=2
    x+=1
  while a%5<1:
    a//=5
    y+=1
  r+=sum(sum(d[max(0,18-y):])for d in c[max(0,18-x):])
  c[x][y]+=1
print(r)

# Buggy version:
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
from collections import defaultdict
dic = defaultdict(int)
for _ in range(N):
    a = float(input())*(10**9)
    a = int(a+0.1)
    num2, num5 = 0, 0
    while a%2==0:
        a//=2
        num2+=1
        if num2>18: break
    while a%5==0:
        a//=5
        num5+=1
        if num5>18: break
    dic[(num2, num5)] += 1

keys = list(dic.keys())
length = len(keys)
print(keys)
ans = 0
for i in range(length):
    a2, a5 = keys[i]
    a_cnt = dic[(a2, a5)]
    for j in range(i, length):
        b2, b5 = keys[j]
        b_cnt = dic[(b2, b5)]
        if a2+b2>=18 and a5+b5>=18:
            if i==j:
                ans += (a_cnt)*(b_cnt-1)//2
            else:
                ans += a_cnt*b_cnt
print(ans)

# Fixed version:
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
from collections import defaultdict
dic = defaultdict(int)
for _ in range(N):
    a = float(input())*(10**9)
    a = int(a+0.1)
    num2, num5 = 0, 0
    while a%2==0:
        a//=2
        num2+=1
        if num2>18: break
    while a%5==0:
        a//=5
        num5+=1
        if num5>18: break
    dic[(num2, num5)] += 1

keys = list(dic.keys())
length = len(keys)
ans = 0
for i in range(length):
    a2, a5 = keys[i]
    a_cnt = dic[(a2, a5)]
    for j in range(i, length):
        b2, b5 = keys[j]
        b_cnt = dic[(b2, b5)]
        if a2+b2>=18 and a5+b5>=18:
            if i==j:
                ans += (a_cnt)*(b_cnt-1)//2
            else:
                ans += a_cnt*b_cnt
print(ans)

# Buggy version:
import math
n = int(input())

alist = []
for i in range(n):
    alist.append(round(float(input())*10**9))

def two_five_power(n):
    a = 0
    b = 0
    while n % 2 == 0:
        n /=2
        a += 1
    while n % 5 == 0:
        n /= 5
        b += 1
    return (a,b)

ab_dict = dict()
for i in range(n):
    ab = two_five_power(alist[i])
    if ab in ab_dict:  
        ab_dict[ab] += 1
    else:
        ab_dict[ab] = 1

prev = 0
count = 0
for one in ab_dict:
    for two in ab_dict:
        if one[0] + two[0] >= 18 and one[1] + two[1] >= 18:    
            if one < two:
                count += ab_dict[one] * ab_dict[two]
            else: 
                count += ab_dict[one] * (ab_dict[two]-1) / 2

print(int(count))

# Fixed version:
import math
n = int(input())

alist = []
for i in range(n):
    alist.append(int(round(float(input())*10**9)))

def two_five_power(n):
    a = 0
    b = 0
    while n % 2 == 0:
        n /=2
        a += 1
    while n % 5 == 0:
        n /= 5
        b += 1
    return (a,b)

ab_dict = dict()
for i in range(n):
    ab = two_five_power(alist[i])
    if ab in ab_dict:  
        ab_dict[ab] += 1
    else:
        ab_dict[ab] = 1

prev = 0
count = 0
for one in ab_dict:
    for two in ab_dict:
        if one[0] + two[0] >= 18 and one[1] + two[1] >= 18:    
            if one < two:
                count += ab_dict[one] * ab_dict[two]
            else: 
                if one == two:
                    count += ab_dict[one] * (ab_dict[two]-1) // 2

print(count)

# Buggy version:
from decimal import Decimal

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

d = {}
for a in A:
    a = int(a * (10 ** 9))
    x = -9
    while a % 2 == 0:
        x += 1
        a %= 2
    y = -9
    while a % 5 == 0:
        y += 1
        a %= 5
    t = (x, y)
    d.setdefault(t, 0)
    d[t] += 1

result = 0
xs = d.values()
for i in range(len(xs)):
    x, y = xs[i]
    for j in range(i + 1, len(xs)):
        m, n = xs[j]
        if x + m >= 0 and y + n >= 0:
            result += d[xs[i]] * d[xs[j]]
print(result)


# Fixed version:
from decimal import Decimal

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

d = {}
for a in A:
    a = int(a * (10 ** 9))
    if a == 0:
        t = (0, 0)
    else:
        x = -9
        while a % 2 == 0:
            x += 1
            a //= 2
        y = -9
        while a % 5 == 0:
            y += 1
            a //= 5
        t = (x, y)
    d.setdefault(t, 0)
    d[t] += 1


result = 0
xs = list(d.keys())
for i in range(len(xs)):
    x, y = xs[i]
    t = d[xs[i]]
    if x >= 0 and y >= 0:
        result += t * (t - 1) // 2
    for j in range(i + 1, len(xs)):
        m, n = xs[j]
        if x + m >= 0 and y + n >= 0:
            result += t * d[xs[j]]
print(result)

# Buggy version:
from collections import defaultdict
from decimal import Decimal
N = int(input())
T = defaultdict(int)
a = 0
b = 0
for i in range(N):
    A = Decimal((input()))
    A *= 10**9
    A = int(A)
    t = 0
    f = 0
    while(True):
        if A % 2 != 0:
            break
        A = A // 2
        t += 1
    while (True):
        if A % 5 != 0:
            break
        A = A // 5
        f += 1
    T[(t, f)] += 1
    a = max(a, t)
    b = max(b, f)

print(T)
ans = 0
for k, v in T.items():
    for i in range(18-k[0], a+1):
        for j in range(18-k[1], b+1):
            if (i, j) in T:
                if k[0] == i and k[1] == j:
                    ans += v * (v-1)
                else:
                    ans += v * T[(i, j)]
print(ans//2)

# Fixed version:
from collections import defaultdict
from decimal import Decimal
N = int(input())
T = defaultdict(int)
a = 0
b = 0
for i in range(N):
    A = Decimal((input()))
    A *= 10**9
    A = int(A)
    t = 0
    f = 0
    while(True):
        if A % 2 != 0:
            break
        A = A // 2
        t += 1
    while (True):
        if A % 5 != 0:
            break
        A = A // 5
        f += 1
    T[(t, f)] += 1
    a = max(a, t)
    b = max(b, f)

ans = 0
for k, v in T.items():
    for i in range(18-k[0], a+1):
        for j in range(18-k[1], b+1):
            if (i, j) in T:
                if k[0] == i and k[1] == j:
                    ans += v * (v-1)
                else:
                    ans += v * T[(i, j)]
print(ans//2)

# Buggy version:
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 (cnt1, cnt2)

N = int(input())

F = []
for i in range(N):
    A = float(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
"""

# Fixed version:
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(input())

F = []
for i in range(N):
    A = float(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
"""

# Buggy version:
n=int(input())
from decimal import Decimal as D
# A=[]
excel=[[0]*20 for i in range(50)]
query=[]
for i in range(n):
    q=input()
    q=D(q)
    q=int(q*10**9)
    num2=0 ;num5=0
    k=q
    for i in range(50):
        if k%2==0:
            k//=2
            num2+=1
        else:break
    k=q
    for i in range(20):
        if k%5==0:
            k//=5
            num5+=1
        else:break
    excel[num2][num5]+=1
    query.append([max(0,18-num2),max(0,18-num5)])

A=[[0] * 20 for i in range(50)] #累積和
for i in range(49,-1,-1):
    for j in range(19,-1,-1):
        if i==49 and j==19:
            A[i][j]=excel[i][j]
        elif i==49:
            A[i][j]=A[i][j+1]+excel[i][j]
        elif j==19:
            A[i][j]=A[i+1][j] + excel[i][j]
        else:
            A[i][j]=excel[i][j]+ A[i+1][j]+A[i][j+1]-A[i+1][j+1]

ans=0
for l in query:
    num2,num5=l
    if num2<=9 and num5<=9:
        ans+=A[num2][num5]-1
    else:a
        ans+=A[num2][num5]

#for i in range(50):
 #   print(excel[:][i] , A[:][i])
print(ans//2)


# Fixed version:
n=int(input())
from decimal import Decimal as D
# A=[]
excel=[[0]*20 for i in range(50)]
query=[]
for i in range(n):
    q=input()
    q=D(q)
    q=int(q*10**9)
    num2=0 ;num5=0
    k=q
    for i in range(50):
        if k%2==0:
            k//=2
            num2+=1
        else:break
    k=q
    for i in range(20):
        if k%5==0:
            k//=5
            num5+=1
        else:break
    excel[num2][num5]+=1
    query.append([max(0,18-num2),max(0,18-num5)])

A=[[0] * 20 for i in range(50)] #累積和
for i in range(49,-1,-1):
    for j in range(19,-1,-1):
        if i==49 and j==19:
            A[i][j]=excel[i][j]
        elif i==49:
            A[i][j]=A[i][j+1]+excel[i][j]
        elif j==19:
            A[i][j]=A[i+1][j] + excel[i][j]
        else:
            A[i][j]=excel[i][j]+ A[i+1][j]+A[i][j+1]-A[i+1][j+1]

ans=0
for l in query:
    num2,num5=l
    if num2<=9 and num5<=9:
        ans+=A[num2][num5]-1
    else:
        ans+=A[num2][num5]

#for i in range(50):
 #   print(excel[:][i] , A[:][i])
print(ans//2)

# Buggy version:
N = int(input())
A = [input() for _ in [0]*N]

for i,a in enumerate(A):
    b = a.split(".")
    if len(b)==1:
        A[i] = int(a)*10**9
        continue
    c = b[1]
    n = len(c)
    c += "0"*(9-n)
    A[i] = int(b[0] + c)
exit()
cnt = [[0]*20 for _ in [0]*20]
B = [(0,0)]*N
for k,a in enumerate(A):
    i = 0
    j = 0
    while a%2==0:
        a//=2
        i+=1
    while a%5==0:
        a//=5
        j+=1
    B[k] = (i,j)
    cnt[i][j] += 1

for i in range(1,20):
    i = 19-i
    for j in range(20):
        j = 19-j
        cnt[i][j] += cnt[i+1][j]

for i in range(20):
    i = 19-i
    for j in range(1,20):
        j = 19-j
        cnt[i][j] += cnt[i][j+1]

ans = 0
for i,j in B:
    me = int(i>=9 and j>=9)
    ans += cnt[18-i][18-j]-me

print(ans//2)

# Fixed version:
N = int(input())
A = [input() for _ in [0]*N]

for i,a in enumerate(A):
    b = a.split(".")
    if len(b)==1:
        A[i] = int(a)*10**9
        continue
    c = b[1]
    n = len(c)
    c += "0"*(9-n)
    A[i] = int(b[0] + c)

cnt = [[0]*20 for _ in [0]*20]
B = [(0,0)]*N
for k,a in enumerate(A):
    i = 0
    j = 0
    while a%2==0:
        a//=2
        i+=1
    while a%5==0:
        a//=5
        j+=1
    i = min(19,i)
    j = min(19,j)
    B[k] = (i,j)
    cnt[i][j] += 1

for i in range(1,20):
    i = 19-i
    for j in range(20):
        j = 19-j
        cnt[i][j] += cnt[i+1][j]

for i in range(20):
    i = 19-i
    for j in range(1,20):
        j = 19-j
        cnt[i][j] += cnt[i][j+1]

ans = 0
for i,j in B:
    me = int(i>=9 and j>=9)
    ans += cnt[max(0,18-i)][max(0,18-j)]-me

print(ans//2)

# Buggy version:
N = int(input())
A = [input() for _ in [0]*N]

for i,a in enumerate(A):
    b = a.split(".")
    if len(b)==1:
        A[i] = int(a)*10**9
        continue
    c = b[1]
    n = len(c)
    c += "0"*(9-n)
    A[i] = int(b[0] + c)

cnt = [[0]*20 for _ in [0]*20]
B = [(0,0)]*N
for k,a in enumerate(A):
    i = 0
    j = 0
    while a%2==0:
        a//=2
        i+=1
    while a%5==0:
        a//=5
        j+=1
    B[k] = (max(19,i),max(19,j))
    cnt[i][j] += 1

for i in range(1,20):
    i = 19-i
    for j in range(20):
        j = 19-j
        cnt[i][j] += cnt[i+1][j]

for i in range(20):
    i = 19-i
    for j in range(1,20):
        j = 19-j
        cnt[i][j] += cnt[i][j+1]

ans = 0
for i,j in B:
    me = int(i>=9 and j>=9)
    ans += cnt[18-i][18-j]-me

print(ans//2)

# Fixed version:
N = int(input())
A = [input() for _ in [0]*N]

for i,a in enumerate(A):
    b = a.split(".")
    if len(b)==1:
        A[i] = int(a)*10**9
        continue
    c = b[1]
    n = len(c)
    c += "0"*(9-n)
    A[i] = int(b[0] + c)

cnt = [[0]*40 for _ in [0]*40]
B = [(0,0)]*N
for k,a in enumerate(A):
    i = 0
    j = 0
    while a%2==0:
        a//=2
        i+=1
    while a%5==0:
        a//=5
        j+=1
    B[k] = (i,j)
    cnt[i][j] += 1

for i in range(1,40):
    i = 39-i
    for j in range(40):
        j = 39-j
        cnt[i][j] += cnt[i+1][j]

for i in range(40):
    i = 39-i
    for j in range(1,40):
        j = 39-j
        cnt[i][j] += cnt[i][j+1]

ans = 0
for i,j in B:
    me = int(i>=9 and j>=9)
    ans += cnt[max(0,18-i)][max(0,18-j)]-me

print(ans//2)

# Buggy version:
import sys
input = sys.stdin.readline
n = int(input())
a = [input().rstrip() for i in range(n)]
ls0 = []
ls25 = []
for i in range(n):
  s = a[i]
  l = len(s)
  if "." in s:
    pt = s.index(".")
    ls0.append(l-pt-1)
    x = s[:pt]+s[pt+1:]
  else:
    ls0.append(0)
    x = s
  ix = int(x)
  c2 = 0
  while ix%2 == 0:
    c2 += 1
    ix //= 2
  c5 = 0
  ix = int(x)
  while ix%5 == 0:
    c5 += 1
    ix //= 5
  ls25.append((c2-ls0[-1],c5-ls0[-1]))
ls25.sort()
ls2 = list(zip(*ls25))[0]
from collections import defaultdict
import bisect
dic5 = defaultdict(int)
ans = 0
for i in range(n)[::-1]:
  if ls2[i] < 0:
    break
  ind = bisect.bisect_left(ls2,-ls2[i])
  if i == n-1:
    for j in range(n-2,ind-1,-1):
      dic5[ls25[j][1]] += 1
    ptr = ind
  else:
    for j in range(ptr,ind):
      dic5[ls25[j][1]] -= 1
    dic5[ls25[i+1][1]] -= 1
    ptr = ind
  for v,num in dic5.items():
    if v+ls25[i][1] >= 0:
      ans += num
print(ans)
print(ls25)

# Fixed version:
import sys
input = sys.stdin.readline
n = int(input())
a = [input().rstrip() for i in range(n)]
ls0 = []
ls25 = []
for i in range(n):
  s = a[i]
  l = len(s)
  if "." in s:
    pt = s.index(".")
    ls0.append(l-pt-1)
    x = s[:pt]+s[pt+1:]
  else:
    ls0.append(0)
    x = s
  ix = int(x)
  c2 = 0
  while ix%2 == 0:
    c2 += 1
    ix //= 2
  c5 = 0
  ix = int(x)
  while ix%5 == 0:
    c5 += 1
    ix //= 5
  ls25.append((c2-ls0[-1],c5-ls0[-1]))
ls25.sort()
ls2 = list(zip(*ls25))[0]
from collections import defaultdict
import bisect
dic5 = defaultdict(int)
ans = 0
for i in range(n)[::-1]:
  if ls2[i] < 0:
    break
  ind = bisect.bisect_left(ls2,-ls2[i])
  if i == n-1:
    for j in range(ind,n-1):
      dic5[ls25[j][1]] += 1
    ptr = ind
  else:
    for j in range(ptr,ind):
      dic5[ls25[j][1]] -= 1
    dic5[ls25[i][1]] -= 1
    ptr = ind
  for v,num in dic5.items():
    if v+ls25[i][1] >= 0:
      ans += num
print(ans)

# Buggy version:
from collections import defaultdict

N = int(input())

AS = [input().strip() for _ in range(N)]

nums = [int(a.replace('.', '')) for a in AS]
dens = [1 if '.' not in a else 10**(len(a) - a.index('.') - 1) for a in AS]

print(nums, dens)

def gcd(a, b):
    if a < b:
        return gcd(b, a)
    if b == 0:
        return a
    return gcd(b, a%b)

gs = [gcd(num, den) for num, den in zip(nums, dens)]
nums = [num // g for num, g in zip(nums, gs)]
dens = [den // g for den, g in zip(dens, gs)]

def signature(n):
    e2, e5 = 0, 0
    while n % 2 == 0:
        n //= 2
        e2 += 1
    while n % 5 == 0:
        n //= 2
        e5 += 1
    return (e2, e5)

lookup = defaultdict(int)
for num, den in zip(nums, dens):
    n2, n5 = signature(num)
    d2, d5 = signature(den)
    lookup[(n2-d2, n5-d5)]+=1

ans = 0
for k1 in lookup:
    for k2 in lookup:
        v1, v2 = lookup[k1], lookup[k2]
        x1, y1 = k1
        x2, y2 = k2
        if x1 + x2 >= 0 and y1 + y2 >=0:
            if k1 == k2:
                ans += v1*(v1-1)
            else:
                ans += v1*v2

ans //= 2
print(ans)





# Fixed version:
from collections import defaultdict

N = int(input())

AS = [input().strip() for _ in range(N)]

nums = [int(a.replace('.', '')) for a in AS]
dens = [1 if '.' not in a else 10**(len(a) - a.index('.') - 1) for a in AS]

# print(nums, dens)

def gcd(a, b):
    if a < b:
        return gcd(b, a)
    if b == 0:
        return a
    return gcd(b, a%b)

gs = [gcd(num, den) for num, den in zip(nums, dens)]
nums = [num // g for num, g in zip(nums, gs)]
dens = [den // g for den, g in zip(dens, gs)]

def signature(n):
    e2, e5 = 0, 0
    while n % 2 == 0:
        n //= 2
        e2 += 1
    while n % 5 == 0:
        n //= 5
        e5 += 1
    return (e2, e5)

lookup = defaultdict(int)
for num, den in zip(nums, dens):
    n2, n5 = signature(num)
    d2, d5 = signature(den)
    lookup[(n2-d2, n5-d5)]+=1

ans = 0
for k1 in lookup:
    for k2 in lookup:
        v1, v2 = lookup[k1], lookup[k2]
        x1, y1 = k1
        x2, y2 = k2
        if x1 + x2 >= 0 and y1 + y2 >=0:
            if k1 == k2:
                ans += v1*(v1-1)
            else:
                ans += v1*v2

ans //= 2
print(ans)

# Buggy version:
from collections import defaultdict
import sys

input = sys.stdin.buffer.readline

n = int(input())
jisho = defaultdict(int)
for _ in range(n):
    s = input()
    if int(float(s)) == float(s):
        num = int(float(s))
        cnt2 = 0
        cnt5 = 0
    else:
        a, b = s.split(".")
        keta = len(b)
        cnt2 = -keta
        cnt5 = -keta
        a = int(a)
        b = int(b)
        num = a * pow(10, keta) + b
    while True:
        if num % 5 == 0:
            num //= 5
            cnt5 += 1
        else:
            break
    while True:
        if num % 2 == 0:
            num //= 2
            cnt2 += 1
        else:
            break
    if cnt5 <= -11 or cnt2 <= -11:
        continue
    cnt2 = min(10, cnt2)
    cnt5 = min(10, cnt5)
    jisho[(cnt2, cnt5)] += 1
ans = 0
for i in range(21):
    i -= 10
    for j in range(21):
        j -= 10
        kouho1 = jisho[(i, j)]
        if kouho1 == 0:
            continue
        for k in range(21):
            k -= 10
            for l in range(21):
                l -= 10
                kouho2 = jisho[(k, l)]
                if kouho2 == 0:
                    continue

                if i + k >= 0 and j + l >= 0:
                    if (i, j) == (k, l):
                        ans += kouho1 * (kouho2 - 1)
                    else:
                        ans += kouho1 * kouho2

print(ans // 2)


# Fixed version:
from collections import defaultdict


n = int(input())
jisho = defaultdict(int)
for _ in range(n):
    s = input()
    if int(float(s)) == float(s):
        num = int(float(s))
        cnt2 = 0
        cnt5 = 0
    else:
        a, b = s.split(".")
        keta = len(b)
        cnt2 = -keta
        cnt5 = -keta
        a = int(a)
        b = int(b)
        num = a * pow(10, keta) + b
    while True:
        if num % 5 == 0:
            num //= 5
            cnt5 += 1
        else:
            break
    while True:
        if num % 2 == 0:
            num //= 2
            cnt2 += 1
        else:
            break
    if cnt5 <= -11 or cnt2 <= -11:
        continue
    cnt2 = min(10, cnt2)
    cnt5 = min(10, cnt5)
    jisho[(cnt2, cnt5)] += 1
ans = 0
for i in range(21):
    i -= 10
    for j in range(21):
        j -= 10
        kouho1 = jisho[(i, j)]
        if kouho1 == 0:
            continue
        for k in range(21):
            k -= 10
            for l in range(21):
                l -= 10
                kouho2 = jisho[(k, l)]
                if kouho2 == 0:
                    continue

                if i + k >= 0 and j + l >= 0:
                    if (i, j) == (k, l):
                        ans += kouho1 * (kouho2 - 1)
                    else:
                        ans += kouho1 * kouho2

print(ans // 2)

# Buggy version:
from decimal import *

n = int(input())
ans = 0
vec = [Decimal(input()) for i in range(n)]
vec25 = [[0 for i in range(50)] for i in range(50)]  # 整数にするのに余っている2,5の数
for i in range(n):
    a = vec[i] * 1000000000
    num2 = -9
    num5 = -9
    while a%2 == 0:
        a //= 2
        num2 += 1
    while a%5 == 0:
        a //= 5
        num5 += 1
    vec25[num2][num5] += 1
for i in range(-9, 40): 
    for j in range(-9, 40):
        for k in range(max(-9, -i), 40):
            for l in range(max(-9, -j), 40):
                if i+k >= 0 and j+l >= 0 :
                    if i != k or j != l :
                        ans += vec25[i][j] * vec25[k][l]
                    else :
                        ans += vec25[i][j] * (vec25[i][j] - 1)

print(ans)

# Fixed version:
from decimal import *

n = int(input())
ans = 0
vec = [Decimal(input()) for i in range(n)]
vec25 = [[0 for i in range(50)] for i in range(50)]  # 整数にするのに余っている2,5の数
for i in range(n):
    a = int(vec[i] * 1000000000)
    num2 = -9
    num5 = -9
    while a%2 == 0:
        a //= 2
        num2 += 1
    while a%5 == 0:
        a //= 5
        num5 += 1
    vec25[num2][num5] += 1
for i in range(-9, 40): 
    for j in range(-9, 20):
        for k in range(max(-9, -i), 40):
            for l in range(max(-9, -j), 20):
                if i+k >= 0 and j+l >= 0 :
                    if i != k or j != l :
                        ans += vec25[i][j] * vec25[k][l]
                    else :
                        ans += vec25[i][j] * (vec25[i][j] - 1)
ans //= 2
print(ans)

# Buggy version:
class BIT:
    def __init__(self, n):
        #A1 ... AnのBIT(1-indexed)
        self.BIT = [0] * (n + 1)
        self.n = n

    #A1 ~ Aiまでの和 O(logN)
    def query(self, idx):
        res_sum = 0
        while idx > 0:
            res_sum += self.BIT[idx]
            idx -= idx & (-idx)
        return res_sum

    #Ai += x O(logN)
    def add(self, idx, x):
        while idx <= self.n:
            self.BIT[idx] += x
            idx += idx&(-idx)
        return
def get_int(f):
    if "." not in f:
        return int(f),0
    return int(f.replace(".","")),len(f)-f.index(".")-1
n = int(input())
p = []
for i in range(n):
    a, b = get_int(input())
    c, d = 0, 0
    while a % 2 == 0:
        c += 1
        a //= 2
    while a % 5 == 0:
        d += 1
        a //= 5
    c -= b
    d -= b
    p.append(c * 300000 + d)
p.sort()
for i in range(n):
    p[i] = (p[i] // 300000, p[i] % 300000)
now = n - 1
t = BIT(50)
ans = 0
for i in range(n):
    for j in range(now, i, -1):
        if p[i][0] + p[j][0] >= 0:
            t.add(-p[j][1] + 25, 1)
            now -= 1
        else:
            break
    if now < i:
        t.add(-p[i][1] + 25, -1)
    ans += max(0, t.query(25 + p[i][1]))

print(ans)

# Fixed version:
class BIT:
    def __init__(self, n):
        #A1 ... AnのBIT(1-indexed)
        self.BIT = [0] * (n + 1)
        self.n = n

    #A1 ~ Aiまでの和 O(logN)
    def query(self, idx):
        res_sum = 0
        while idx > 0:
            res_sum += self.BIT[idx]
            idx -= idx & (-idx)
        return res_sum

    #Ai += x O(logN)
    def add(self, idx, x):
        while idx <= self.n:
            self.BIT[idx] += x
            idx += idx&(-idx)
        return
def get_int(f):
    if "." not in f:
        return int(f),0
    return int(f.replace(".","")),len(f)-f.index(".")-1
n = int(input())
p = []
for i in range(n):
    a, b = get_int(input())
    c, d = 0, 0
    while a % 2 == 0:
        c += 1
        a //= 2
    while a % 5 == 0:
        d += 1
        a //= 5
    c -= b
    d -= b
    p.append((c, d))
p.sort()
now = n - 1
t = BIT(200)
ans = 0
for i in range(n):
    for j in range(now, i, -1):
        if p[i][0] + p[j][0] >= 0:
            t.add(-p[j][1] + 100, 1)
            now -= 1
        else:
            break
    if now < i:
        t.add(-p[i][1] + 100, -1)
    ans += max(0, t.query(100 + p[i][1]))

print(ans)

# Buggy version:
N = int(input())
A = [input() for _ in range(N)]

from collections import Counter
ctr = Counter()

for a in A:
    of = 0
    if '.' in a:
        of = a[::-1].index('.')
        a = a.replace('.', '')
    a = int(a)
    ni = go = -of
    while a%2==0:
        a//=2
        ni += 1
    while a%5==0:
        a//=5
        go += 1
    ctr[(ni,go)] += 1

ans = 0
for (ni1,go1),v1 in ctr.items():
    for (ni2,go2),v2 in ctr.items():
        if ni1+ni2 < 0 or go1+go2 < 0: continue
        print(ni1,go1, ni2,go2)
        if ni1==ni2 and go1==go2:
            ans += v1*(v1-1)
        else:
            ans += v1*v2
print(ans//2)

# Fixed version:
N = int(input())
A = [input() for _ in range(N)]

from collections import Counter
ctr = Counter()

for a in A:
    of = 0
    if '.' in a:
        of = a[::-1].index('.')
        a = a.replace('.', '')
    a = int(a)
    ni = go = -of
    while a%2==0:
        a//=2
        ni += 1
    while a%5==0:
        a//=5
        go += 1
    ctr[(ni,go)] += 1

ans = 0
for (ni1,go1),v1 in ctr.items():
    for (ni2,go2),v2 in ctr.items():
        if ni1+ni2 < 0 or go1+go2 < 0: continue
        if ni1==ni2 and go1==go2:
            ans += v1*(v1-1)
        else:
            ans += v1*v2
print(ans//2)