N = gets.to_i
A = []
max = 0
N.times{
    a = Rational(gets)
    A << a
    if max < a
        max = a
    end
}
#warn A.inspect
A.reject!{|x|x.denominator > max}
A.sort_by!{|x|x.denominator}
#warn A.inspect
count = 0
(0 .. A.size - 2).each{|i|
    (i + 1 .. A.size - 1).each{|j|
        if A[i].numerator < A[j].denominator
            break
        end
        r = A[i] * A[j]
        if r.denominator == 1
            count += 1
        end
    }
}
puts count
