Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub


import sys
# sys.setrecursionlimit(10**6)
# buff_readline = sys.stdin.buffer.readline
buff_readline = sys.stdin.readline
readline = sys.stdin.readline
readline = input

INF = 2**62-1


def read_int():
    return int(buff_readline())


def read_int_n():
    return list(map(int, buff_readline().split()))


def read_float():
    return float(buff_readline())


def read_float_n():
    return list(map(float, buff_readline().split()))


def read_str():
    return readline().strip()


def read_str_n():
    return readline().strip().split()

def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap

from fractions import Fraction

@mt
def slv(N, A):
    d = defaultdict(Counter)
    d5 = defaultdict(Counter)
    de = defaultdict(Counter)
    nd = Counter()
    for a in A:
        a += '.0'
        t = a.split('.')
        b = int(t[0]) * 10**9 + int(t[1]) * 10**(9- len(t[1]))
        e = str(b)
        for i in range(100):
            if e[-(i+1)] != '0':
                break

        d[i][b] += 1
        if e[-(i+1)] == '5':
            d5[i][b] += 1
        elif int(e[-(i+1)]) % 2 == 0:
            de[i][b] += 1
        nd[i] += 1

    ans = 0
    rk = sorted(d.keys(), reverse=True)
    for k, kk in combinations(rk, r=2):
        nk = nd[k]
        nkk = nd[kk]
        if k + kk >= 18:
            ans += nk * nkk
        elif k + kk > 10:
            for av, an in d5[k].items():
                for bv, bn in de[kk].items():
                    if (av * bv) % 10**18 == 0:
                        ans += an * bn
            for av, an in de[k].items():
                for bv, bn in d5[kk].items():
                    if (av * bv) % 10**18 == 0:
                        ans += an * bn
    for k in rk:
        nk = nd[k]
        if 2*k >= 18:
            ans += nk * (nk-1) // 2
        elif k + kk > 10:
            for av, an in d5[k].items():
                for bv, bn in de[k].items():
                    if (av * bv) % 10**18 == 0:
                        ans += an * bn
    return ans


def ref(N, A):
    B = []
    for a in A:
        t = a.split('.')
        b = 0
        if len(t) == 1:
            b = int(t[0]) * 10**9
        else:
            b = int(t[0]) * 10**9 + int(t[1]) * 10**(9 - len(t[1]))
        B.append(b)

    ans = 0
    for a, b in combinations(B, r=2):
        if (a * b ) % 10**18 == 0:
            print(a, b)
            ans += 1
    return ans

def main():
    N = read_int()
    A = [input() for _ in range(N)]
    print(slv(N, A))
    # print(ref(N, A))

    # N = 2 * 10**5
    # for _ in range(1000):
    #     A = []
    #     for _ in range(N):
    #         b = str(random.randint(1, 10)) + '.' + str(random.randint(0, 10**9))
    #         A.append(b)

    #     a = slv(N, A)
    #     # b = ref(N, A)
    #     # print(a, b)
    #     # if a != b:
    #     #     print(a, b)
    #     #     print(A)
    #     #     break



if __name__ == '__main__':
    main()


Fixed submission:
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub


import sys
# sys.setrecursionlimit(10**6)
# buff_readline = sys.stdin.buffer.readline
buff_readline = sys.stdin.readline
readline = sys.stdin.readline
readline = input

INF = 2**62-1


def read_int():
    return int(buff_readline())


def read_int_n():
    return list(map(int, buff_readline().split()))


def read_float():
    return float(buff_readline())


def read_float_n():
    return list(map(float, buff_readline().split()))


def read_str():
    return readline().strip()


def read_str_n():
    return readline().strip().split()

def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap

from fractions import Fraction

@mt
def slv(N, A):
    c = Counter()
    for a in A:
        a += '.0'
        t = a.split('.')
        b = int(t[0]) * 10**9 + int(t[1]) * 10**(9-len(t[1]))
        n5 = 0
        n2 = 0
        while b % 2 == 0:
            n2 += 1
            b //= 2
        while b % 5 == 0:
            n5 += 1
            b //= 5
        c[(n2, n5)] += 1

    ans = 0
    for k, kk in combinations_with_replacement(c.keys(), r=2):
        if k[0] + kk[0] >= 18 and k[1] + kk[1] >= 18:
            if k == kk:
                ans += c[k] * (c[k]-1) // 2
            else:
                ans += c[k] * c[kk]

    return ans



def main():
    N = read_int()
    A = [input() for _ in range(N)]
    print(slv(N, A))



if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub


import sys
# sys.setrecursionlimit(10**6)
# buff_readline = sys.stdin.buffer.readline
buff_readline = sys.stdin.readline
readline = sys.stdin.readline
readline = input

INF = 2**62-1


def read_int():
    return int(buff_readline())


def read_int_n():
    return list(map(int, buff_readline().split()))


def read_float():
    return float(buff_readline())


def read_float_n():
    return list(map(float, buff_readline().split()))


def read_str():
    return readline().strip()


def read_str_n():
    return readline().strip().split()

def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap

from fractions import Fraction

@mt
def slv(N, A):
    d = defaultdict(Counter)
    d5 = defaultdict(Counter)
    de = defaultdict(Counter)
    nd = Counter()
    for a in A:
        a += '.0'
        t = a.split('.')
        b = int(t[0]) * 10**9 + int(t[1]) * 10**(9- len(t[1]))
        e = str(b)
        for i in range(100):
            if e[-(i+1)] != '0':
                break

        d[i][b] += 1
        if e[-(i+1)] == '5':
            d5[i][b] += 1
        elif int(e[-(i+1)]) % 2 == 0:
            de[i][b] += 1
        nd[i] += 1

    ans = 0
    rk = sorted(d.keys(), reverse=True)
    for k, kk in combinations(rk, r=2):
        nk = nd[k]
        nkk = nd[kk]
        if k + kk >= 18:
            ans += nk * nkk
        else:
            for av, an in d5[k].items():
                for bv, bn in de[kk].items():
                    if (av * bv) % 10**18 == 0:
                        ans += an * bn
            for av, an in de[k].items():
                for bv, bn in d5[kk].items():
                    if (av * bv) % 10**18 == 0:
                        ans += an * bn
    for k in rk:
        nk = nd[k]
        if 2*k >= 18:
            ans += nk * (nk-1) // 2
        else:
            for av, an in d5[k].items():
                for bv, bn in de[k].items():
                    if (av * bv) % 10**18 == 0:
                        ans += an * bn
    return ans


def ref(N, A):
    B = []
    for a in A:
        t = a.split('.')
        b = 0
        if len(t) == 1:
            b = int(t[0]) * 10**9
        else:
            b = int(t[0]) * 10**9 + int(t[1]) * 10**(9 - len(t[1]))
        B.append(b)

    ans = 0
    for a, b in combinations(B, r=2):
        if (a * b ) % 10**18 == 0:
            print(a, b)
            ans += 1
    return ans

def main():
    N = read_int()
    A = [input() for _ in range(N)]
    print(slv(N, A))
    # print(ref(N, A))

    # N = 2 * 10**5
    # for _ in range(1000):
    #     A = []
    #     for _ in range(N):
    #         b = str(random.randint(1, 10)) + '.' + str(random.randint(0, 10**2))
    #         A.append(b)

    #     a = slv(N, A)
    #     # b = ref(N, A)
    #     # print(a, b)
    #     # if a != b:
    #     #     print(a, b)
    #     #     print(A)
    #     #     break



if __name__ == '__main__':
    main()


Fixed submission:
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub


import sys
# sys.setrecursionlimit(10**6)
# buff_readline = sys.stdin.buffer.readline
buff_readline = sys.stdin.readline
readline = sys.stdin.readline
readline = input

INF = 2**62-1


def read_int():
    return int(buff_readline())


def read_int_n():
    return list(map(int, buff_readline().split()))


def read_float():
    return float(buff_readline())


def read_float_n():
    return list(map(float, buff_readline().split()))


def read_str():
    return readline().strip()


def read_str_n():
    return readline().strip().split()

def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap

from fractions import Fraction

@mt
def slv(N, A):
    c = Counter()
    for a in A:
        a += '.0'
        t = a.split('.')
        b = int(t[0]) * 10**9 + int(t[1]) * 10**(9-len(t[1]))
        n5 = 0
        n2 = 0
        while b % 2 == 0:
            n2 += 1
            b //= 2
        while b % 5 == 0:
            n5 += 1
            b //= 5
        c[(n2, n5)] += 1

    ans = 0
    for k, kk in combinations_with_replacement(c.keys(), r=2):
        if k[0] + kk[0] >= 18 and k[1] + kk[1] >= 18:
            if k == kk:
                ans += c[k] * (c[k]-1) // 2
            else:
                ans += c[k] * c[kk]

    return ans



def main():
    N = read_int()
    A = [input() for _ in range(N)]
    print(slv(N, A))



if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub


import sys
# sys.setrecursionlimit(10**6)
# buff_readline = sys.stdin.buffer.readline
buff_readline = sys.stdin.readline
readline = sys.stdin.readline
readline = input

INF = 2**62-1


def read_int():
    return int(buff_readline())


def read_int_n():
    return list(map(int, buff_readline().split()))


def read_float():
    return float(buff_readline())


def read_float_n():
    return list(map(float, buff_readline().split()))


def read_str():
    return readline().strip()


def read_str_n():
    return readline().strip().split()

def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap

from fractions import Fraction

@mt
def slv(N, A):
    d = defaultdict(Counter)
    nd = Counter()
    for a in A:
        t = a.split('.')
        b = 0
        if len(t) == 1:
            b = int(t[0]) * 10**9
        else:
            b = int(t[0]) * 10**9 + int(t[1]) * 10**(9- len(t[1]))
        e = str(b)
        for i in range(100):
            if e[-(i+1)] != '0':
                break
        d[i][b] += 1
        nd[i] += 1

    ans = 0
    rk = sorted(d.keys(), reverse=True)
    for k, kk in combinations(rk, r=2):
        nk = nd[k]
        nkk = nd[kk]
        if k + kk >= 18:
            ans += nk * nkk
        else:
            for av, an in d[k].items():
                for bv, bn in d[kk].items():
                    if (av * bv) % 10**18 == 0:
                        ans += an * bn
    for k in rk:
        nk = nd[k]
        if 2*k >= 18:
            ans += nk * (nk-1) // 2
        else:
            for av, bv in combinations_with_replacement(d[k], r=2):
                an = d[k][av]
                bn = d[k][bv]
                if (av * bv) % 10**18 == 0:
                    if av == bv:
                        ans += an * (an-1) // 2
                    else:
                        ans += an * bn
    return ans


def ref(N, A):
    B = []
    for a in A:
        t = a.split('.')
        b = 0
        if len(t) == 1:
            b = int(t[0]) * 10**9
        else:
            b = int(t[0]) * 10**9 + int(t[1]) * 10**(9 - len(t[1]))
        B.append(b)

    ans = 0
    for a, b in combinations(B, r=2):
        if (a * b ) % 10**18 == 0:
            print(a, b)
            ans += 1
    return ans

def main():
    N = read_int()
    A = [input() for _ in range(N)]
    print(slv(N, A))
    # print(ref(N, A))

    # N = 1000
    # for _ in range(1000):
    #     A = []
    #     # A = ['7.8', '7.36', '1.79', '7.83', '1.89', '3.16', '4.40', '7.42', '5.2', '4.98', '1.15', '5.66', '5.49', '6.51', '3.50', '1.96', '5.76', '1.32', '10.59', '4.58', '2.52', '3.32', '10.69', '7.97', '2.74', '7.17', '1.76', '5.33', '4.77', '10.20', '2.36', '5.60', '3.0', '5.44', '9.21', '9.52', '5.29', '6.28', '3.46', '10.58', '7.79', '1.50', '6.56', '7.56', '6.13', '10.9', '4.94', '4.49', '9.24', '4.1', '4.70', '5.56', '5.45', '2.91', '7.54', '3.79', '7.71', '5.13', '2.19', '1.76', '8.65', '8.14', '5.7', '10.50', '9.66', '4.21', '8.14', '7.59', '1.35', '8.79', '4.99', '1.63', '7.72', '7.41', '1.18', '1.13', '10.63', '3.68', '4.20', '9.71', '1.89', '7.8', '8.56', '10.30', '1.13', '5.90', '7.79', '4.18', '7.14', '8.80', '4.93', '10.60', '2.58', '3.75', '10.74', '6.24', '2.77', '5.88', '1.4', '6.4']
    #     for _ in range(N):
    #         b = str(random.randint(1, 1000)) + '.' + str(random.randint(0, 10**7))
    #         A.append(b)

    #     a = slv(N, A)
    #     b = ref(N, A)
    #     print(a, b)
    #     if a != b:
    #         print(a, b)
    #         print(A)
    #         break



if __name__ == '__main__':
    main()


Fixed submission:
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub


import sys
# sys.setrecursionlimit(10**6)
# buff_readline = sys.stdin.buffer.readline
buff_readline = sys.stdin.readline
readline = sys.stdin.readline
readline = input

INF = 2**62-1


def read_int():
    return int(buff_readline())


def read_int_n():
    return list(map(int, buff_readline().split()))


def read_float():
    return float(buff_readline())


def read_float_n():
    return list(map(float, buff_readline().split()))


def read_str():
    return readline().strip()


def read_str_n():
    return readline().strip().split()

def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap

from fractions import Fraction

@mt
def slv(N, A):
    c = Counter()
    for a in A:
        a += '.0'
        t = a.split('.')
        b = int(t[0]) * 10**9 + int(t[1]) * 10**(9-len(t[1]))
        n5 = 0
        n2 = 0
        while b % 2 == 0:
            n2 += 1
            b //= 2
        while b % 5 == 0:
            n5 += 1
            b //= 5
        c[(n2, n5)] += 1

    ans = 0
    for k, kk in combinations_with_replacement(c.keys(), r=2):
        if k[0] + kk[0] >= 18 and k[1] + kk[1] >= 18:
            if k == kk:
                ans += c[k] * (c[k]-1) // 2
            else:
                ans += c[k] * c[kk]

    return ans



def main():
    N = read_int()
    A = [input() for _ in range(N)]
    print(slv(N, A))



if __name__ == '__main__':
    main()