N=int(eval(input()))

A=[]

PRECISION_DIGITS=9

cnt={}





for n in range(N):

	tmpA = float(eval(input()))

	tmpA = round(tmpA*(10**PRECISION_DIGITS))

	#print(tmpA)



	two = 0

	five = 0

	while (tmpA % 2) == 0:

		two += 1

		tmpA /= 2

	while (tmpA % 5) == 0:

		five += 1

		tmpA /= 5



	if (two,five) in cnt:

		cnt[(two,five)]+=1

	else:

		cnt[(two,five)]=1



keys=sorted(cnt.keys())

# print(keys)

ans = 0

for t1 in keys:

	for t2 in keys:

		# 2**a(a>=0) and 5**b(b>=0) => integer

		if 18 <= t1[0]+t2[0] and 18 <= t1[1]+t2[1]:

			cnt1 = cnt[(t1[0],t1[1])]

			cnt2 = cnt[(t2[0],t2[1])]

			if t1 < t2:

				ans += int(cnt1*cnt2)

			elif t1 == t2:

				# same entry

				# Total number of combinations choose 2 items

				# nC2 = n*(n-1)/2

				ans += int(cnt1*(cnt1-1)/2)





print(ans)



N=int(eval(input()))

A=[]

PRECISION_DIGITS=9

cnt={}





for n in range(N):

	tmpA = float(eval(input()))

	tmpA = round(tmpA*10**PRECISION_DIGITS)

	#print(tmpA)



	five = 0

	two = 0

	while (tmpA % 2) == 0:

		two += 1

		tmpA //= 2

	while (tmpA % 5) == 0:

		five += 1

		tmpA //= 5



	# (10**9) -> (two,five)=(9,9)

	two -= PRECISION_DIGITS

	five -= PRECISION_DIGITS



	if (two,five) in cnt:

		cnt[(two,five)]+=1

	else:

		cnt[(two,five)]=1



# print(cnt)

ans = 0

for t1, cnt1 in list(cnt.items()):

	for t2, cnt2 in list(cnt.items()):

		# 2**a(a>=0) and 5**b(b>=0) => integer

		if 0 <= t1[0]+t2[0] and 0 <= t1[1]+t2[1]:

			if t1 < t2:

				ans += int(cnt1*cnt2)

			elif t1 == t2:

				# same entry

				# Total number of combinations choose 2 items

				# nC2 = n*(n-1)/2

				ans += int((cnt1*(cnt2-1))/2)





print(ans)



N = int(eval(input()))
A = []
PRECISION_DIGITS = 9
cnt = {}
for n in range(N):
    tmpA = float(eval(input()))
    tmpA = round(tmpA * (10**PRECISION_DIGITS))
    # print(tmpA)
    two = 0
    five = 0
    while (tmpA % 2) == 0:
        two += 1
        tmpA /= 2
    while (tmpA % 5) == 0:
        five += 1
        tmpA /= 5
    if (two, five) in cnt:
        cnt[(two, five)] += 1
    else:
        cnt[(two, five)] = 1
keys = sorted(cnt.keys())
# print(keys)
ans = 0
for t1 in keys:
    for t2 in keys:
        # 2**a(a>=0) and 5**b(b>=0) => integer
        if 18 <= t1[0] + t2[0] and 18 <= t1[1] + t2[1]:
            cnt1 = cnt[(t1[0], t1[1])]
            cnt2 = cnt[(t2[0], t2[1])]
            if t1 < t2:
                ans += int(cnt1 * cnt2)
            elif t1 == t2:
                # same entry
                # Total number of combinations choose 2 items
                # nC2 = n*(n-1)/2
                ans += int(cnt1 * (cnt1 - 1) / 2)
print(ans)

N = int(eval(input()))
A = []
PRECISION_DIGITS = 9
cnt = {}
for n in range(N):
    tmpA = float(eval(input()))
    tmpA = round(tmpA * 10**PRECISION_DIGITS)
    # print(tmpA)
    five = 0
    two = 0
    while (tmpA % 2) == 0:
        two += 1
        tmpA //= 2
    while (tmpA % 5) == 0:
        five += 1
        tmpA //= 5
    # (10**9) -> (two,five)=(9,9)
    two -= PRECISION_DIGITS
    five -= PRECISION_DIGITS
    if (two, five) in cnt:
        cnt[(two, five)] += 1
    else:
        cnt[(two, five)] = 1
# print(cnt)
ans = 0
for t1, cnt1 in list(cnt.items()):
    for t2, cnt2 in list(cnt.items()):
        # 2**a(a>=0) and 5**b(b>=0) => integer
        if 0 <= t1[0] + t2[0] and 0 <= t1[1] + t2[1]:
            if t1 < t2:
                ans += int(cnt1 * cnt2)
            elif t1 == t2:
                # same entry
                # Total number of combinations choose 2 items
                # nC2 = n*(n-1)/2
                ans += int((cnt1 * (cnt2 - 1)) / 2)
print(ans)

-    tmpA = round(tmpA * (10**PRECISION_DIGITS)) +    tmpA = round(tmpA * 10**PRECISION_DIGITS) +    five = 0 -    five = 0 -        tmpA /= 2 +        tmpA //= 2 -        tmpA /= 5 +        tmpA //= 5 +    # (10**9) -> (two,five)=(9,9) +    two -= PRECISION_DIGITS +    five -= PRECISION_DIGITS -keys = sorted(cnt.keys()) -# print(keys) +# print(cnt) -for t1 in keys: -    for t2 in keys: +for t1, cnt1 in list(cnt.items()): +    for t2, cnt2 in list(cnt.items()): -        if 18 <= t1[0] + t2[0] and 18 <= t1[1] + t2[1]: -            cnt1 = cnt[(t1[0], t1[1])] -            cnt2 = cnt[(t2[0], t2[1])] +        if 0 <= t1[0] + t2[0] and 0 <= t1[1] + t2[1]: -                ans += int(cnt1 * (cnt1 - 1) / 2) +                ans += int((cnt1 * (cnt2 - 1)) / 2)