require 'bigdecimal'
require 'bigdecimal/util'
fline = readlines
len = fline.length
i = 0

while i < len
  fline[i] = fline[i].chomp
  i += 1
end

n = 1
counter = 0

while n < fline[0].to_i
m = 1
  while n + m <= fline[0].to_i
    a = fline[n].to_d * fline[n + m].to_d
    if a == a.to_i
      counter += 1
    else
    end
    m += 1
  end
n += 1
end

p counter