END { load __FILE__ unless $stdin.eof? }

def e25(n)
  e2 = e5 = 0
  loop do
    d, m = n.divmod(2)
    break if m != 0
    e2 += 1
    n = d
  end
  loop do
    d, m = n.divmod(5)
    break if m != 0
    e5 += 1
    n = d
  end
  [e2, e5]
end

n = gets.to_i
a = Array.new(n) do
  x, y = gets.chomp.split(".")
  y ||= "0"
  z = (x << (y << "000000000")[0, 9]).to_i
  e25(z)
end

b = a.tally.map { |k, v| k << v }.sort!
b.reject! { |e2, e5, *| e2 < 5 || e5 < 5 }

cnt = 0
until b.empty?
  e2, e5, m = b.shift
  cnt += m * m.pred / 2 if e2 >= 9 && e5 >= 9
  l = b.select { |f2, f5, *| e2 + f2 >= 18 && e5 + f5 >= 18 }.sum(&:last)
  cnt += m * l
end

p cnt
