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