def divisors(n,x)
  i = 0
  while n % x == 0
    n = n / x
    i += 1
  end
  i
end
N = gets.to_i
a = N.times.map{gets.to_f}
arr = Array.new(14){Array.new(4){Hash.new(0)}}
a.each do |xx|
  bit = 0
  x = xx
  while x.floor != x.ceil && bit <= 8
    bit += 1
    x *= 10.0
  end
  y = x.to_i
  while y % 10 == 0
    bit -= 1
    y /= 10
  end
  if y % 5 == 0
    arr[bit%14][2][divisors(y,5)] += 1
  elsif y % 2 == 0
    arr[bit%14][1][divisors(y,2)] += 1
  else
    arr[bit%14][0][0] += 1
  end
  arr[bit%14][3][0] += 1
end
cnt = 0
(-4).upto(9) do |i|
  i.upto(9) do |j|
    be = cnt
    if i + j <= 0
      if i == j
        cnt += arr[i%14][3][0] * (arr[i%14][3][0]-1) / 2
      else
        cnt += arr[i%14][3][0] * arr[j%13][3][0]
      end
    else
      if i == j
        inum = 0
        jnum = 0
        arr[i%14][1].each do |k,v|
          if k >= i+j
            inum += v
          end
        end
        arr[i%14][2].each do |k,v|
          if k >= i+j
            jnum += v
          end
        end
        cnt += inum * jnum
      else
        inum = 0
        arr[i%14][1].each do |k,v|
          if k >= i+j
            inum += v
          end
        end
        jnum = 0
        arr[j%14][2].each do |k,v|
          if k >= i+j
            jnum += v
          end
        end
        cnt += inum * jnum
        inum = 0
        arr[i%14][2].each do |k,v|
          if k >= i+j
            inum += v
          end
        end
        jnum = 0
        arr[j%14][1].each do |k,v|
          if k >= i+j
            jnum += v
          end
        end
        cnt += inum * jnum
      end
    end
  end
end
puts cnt