Buggy python submission (verdict: Time Limit Exceeded):
import decimal
n = int(input())
a=[input() for i in range(n)]
biga=[]
for i in range(n):
    num = decimal.Decimal(a[i])
    biga.append(int(num*10**9))
def fact25(n):
    cnt2=0
    cnt5=0
    while n%2==0:
        n//=2
        cnt2+=1
    while n%5==0:
        n//=5
        cnt5+=1
    return cnt2,cnt5

arr = [[0 for _ in range(20)] for _ in range(20)]
p25 = []
for i in range(n):
    cnt2,cnt5=fact25(biga[i])
    p25.append([cnt2,cnt5])
    cnt2=min(19,cnt2)
    cnt5=min(19,cnt5)
    arr[cnt2][cnt5]+=1
ans=0
for i in range(n):
    cnt2,cnt5=p25[i]
    n2=18-cnt2
    n5=18-cnt5
    cnt2=min(19,cnt2)
    cnt5=min(19,cnt5)
    arr[cnt2][cnt5]-=1
    for j in range(20): # 2
        for k in range(20): # 5
            if j>=n2 and k>=n5:
                ans+=arr[j][k]
    arr[cnt2][cnt5]+=1

print(ans//2)

Fixed submission:
import decimal
n = int(input())
a=[input() for i in range(n)]
biga=[]
for i in range(n):
    num = decimal.Decimal(a[i])
    biga.append(int(num*10**9))
def fact25(n):
    cnt2=0
    cnt5=0
    while n%2==0:
        n//=2
        cnt2+=1
    while n%5==0:
        n//=5
        cnt5+=1
    return cnt2,cnt5

arr = [[0 for _ in range(20)] for _ in range(20)]
p25 = []
for i in range(n):
    cnt2,cnt5=fact25(biga[i])
    p25.append([cnt2,cnt5])
    cnt2=min(19,cnt2)
    cnt5=min(19,cnt5)
    arr[cnt2][cnt5]+=1

ans=0
for i in range(20): # 2
    for j in range(20): # 5
        if arr[i][j]==0:
            continue
        for k in range(20): # 2
            for l in range(20): # 5
                if i+k>=18 and j+l>=18:
                    if i==k and j==l:
                        ans+= (arr[i][j]-1)*arr[k][l]
                    else:
                        ans+= arr[i][j]*arr[k][l]

print(ans//2)

Buggy python submission (verdict: Time Limit Exceeded):
import decimal
n = int(input())
a=[input() for i in range(n)]
biga=[]
for i in range(n):
    num = decimal.Decimal(a[i])
    biga.append(int(num*10**9))
def fact25(n):
    cnt2=0
    cnt5=0
    while True:
        if n%2==0:
            n//=2
            cnt2+=1
        else:
            break
    while True:
        if n%5==0:
            n//=5
            cnt5+=1
        else:
            break
    return cnt2,cnt5
arr = [[0 for _ in range(50)] for _ in range(50)]
p25 = []
for i in range(n):
    cnt2,cnt5=fact25(biga[i])
    p25.append([cnt2,cnt5])
    arr[cnt2][cnt5]+=1
ans=0
for i in range(n):
    cnt2,cnt5=p25[i]
    n2=18-cnt2
    n5=18-cnt5
    arr[cnt2][cnt5]-=1
    for j in range(40): # 2
        for k in range(40): # 5
            if j>=n2 and k>=n5:
                ans+=arr[j][k]
    arr[cnt2][cnt5]+=1

print(ans//2)

Fixed submission:
import decimal
n = int(input())
a=[input() for i in range(n)]
biga=[]
for i in range(n):
    num = decimal.Decimal(a[i])
    biga.append(int(num*10**9))
def fact25(n):
    cnt2=0
    cnt5=0
    while n%2==0:
        n//=2
        cnt2+=1
    while n%5==0:
        n//=5
        cnt5+=1
    return cnt2,cnt5

arr = [[0 for _ in range(20)] for _ in range(20)]
p25 = []
for i in range(n):
    cnt2,cnt5=fact25(biga[i])
    p25.append([cnt2,cnt5])
    cnt2=min(19,cnt2)
    cnt5=min(19,cnt5)
    arr[cnt2][cnt5]+=1

ans=0
for i in range(20): # 2
    for j in range(20): # 5
        if arr[i][j]==0:
            continue
        for k in range(20): # 2
            for l in range(20): # 5
                if i+k>=18 and j+l>=18:
                    if i==k and j==l:
                        ans+= (arr[i][j]-1)*arr[k][l]
                    else:
                        ans+= arr[i][j]*arr[k][l]

print(ans//2)

Buggy python submission (verdict: Time Limit Exceeded):
import decimal
n = int(input())
a=[input() for i in range(n)]
biga=[]
for i in range(n):
    num = decimal.Decimal(a[i])
    biga.append(int(num*10**9))

def fact25(n):
    cnt2=0
    cnt5=0
    while True:
        if n%2==0:
            n//=2
            cnt2+=1
        else:
            break
    while True:
        if n%5==0:
            n//=5
            cnt5+=1
        else:
            break
    return cnt2,cnt5

arr = [[0 for _ in range(50)] for _ in range(50)]
for i in range(n):
    cnt2,cnt5=fact25(biga[i])
    arr[cnt2][cnt5]+=1
ans=0
for i in range(n):
    cnt2,cnt5=fact25(biga[i])
    n2=18-cnt2
    n5=18-cnt5
    arr[cnt2][cnt5]-=1
    for j in range(50): # 2
        for k in range(50): # 5
            if j>=n2 and k>=n5:
                ans+=arr[j][k]
    arr[cnt2][cnt5]+=1

print(ans//2)

Fixed submission:
import decimal
n = int(input())
a=[input() for i in range(n)]
biga=[]
for i in range(n):
    num = decimal.Decimal(a[i])
    biga.append(int(num*10**9))
def fact25(n):
    cnt2=0
    cnt5=0
    while n%2==0:
        n//=2
        cnt2+=1
    while n%5==0:
        n//=5
        cnt5+=1
    return cnt2,cnt5

arr = [[0 for _ in range(20)] for _ in range(20)]
p25 = []
for i in range(n):
    cnt2,cnt5=fact25(biga[i])
    p25.append([cnt2,cnt5])
    cnt2=min(19,cnt2)
    cnt5=min(19,cnt5)
    arr[cnt2][cnt5]+=1

ans=0
for i in range(20): # 2
    for j in range(20): # 5
        if arr[i][j]==0:
            continue
        for k in range(20): # 2
            for l in range(20): # 5
                if i+k>=18 and j+l>=18:
                    if i==k and j==l:
                        ans+= (arr[i][j]-1)*arr[k][l]
                    else:
                        ans+= arr[i][j]*arr[k][l]

print(ans//2)