*A = $<.read.split
N = A.shift.to_i
C = (0...19).map { [0]*19 }
s = 0
A.each {|a|
  a = (a.to_r * 10**9).to_i
  i = 0
  i += 1  while a[i] == 0
  a >>= i
  i = [i,18].min
  j,r = -1,0
  (j += 1; a,r = a.divmod 5)  while r == 0
  j = [j,18].min
  s += C[18-i,18].sum {|c| c[18-j,18].sum }
  C[i][j] += 1
}
p s