n = gets.to_i
data = gets.split(" ").map(&:to_i).sort
cnt = 0

if data.size <= 2
  puts cnt
  exit
end

data = data.combination(3).to_a

data.each do |i|
  if i[0] == i[1] || i[1] == i[2] || i[0] == i[2]
    next
  end
  if i[0] + i[1] > i[2]
    cnt += 1
  end
end

puts cnt
