require 'rational'

n=gets.to_i
a=ARGF.map{|s| Rational(s)}

count=0
(0...n).each{|i|
    (i+1...n).each{|k|
        #x = a[i]*a[k]
        
        if(a[i].numerator%a[k].denominator == 0 && a[k].numerator%a[i].denominator == 0)
            count+=1
        end
        }
    }
p count