N = gets.chomp.to_i
edges = gets.chomp.split(' ').map(&:to_i)

if N < 3 then
    puts 0
    exit
end

ans = 0

edges.combination(3).to_a.each do |threeEdges|
    next if threeEdges.size != threeEdges.uniq.size
    if threeEdges[0] + threeEdges[1] > threeEdges[2] && threeEdges[0] + threeEdges[2] > threeEdges[1] && threeEdges[1] + threeEdges[2] > threeEdges[0] then
        ans += 1
    end
end

puts ans