n = gets.to_i
l = gets.split.map(&:to_i)

cmb = l.combination(3).map(&:uniq).select{|i|i.count == 3}
count = 0
cmb.each do |i|
    if (i[0] + i[1] > i[2]) && (i[0] + i[2] > i[1]) && (i[1] + i[2] > i[0])
        count += 1
    end
end
puts count
