n = gets.chomp.to_i
list = gets.chomp.split(' ').map(&:to_i).sort
count = 0
n.times do |i|
  (i+1..(n-1)).each do |j|
    (j+1..(n-1)).each do |k|
      if list[i] != list[j] && list[j] != list[k] && list[i] != list[k] && list[i] + list[j] > list[k]
        count += 1
      end
    end
  end
end

print count