n = gets.to_i
l = gets.split(" ").map(&:to_i)
cnt = 0
if l.size < 3
  puts 0
  exit
end
l.combination(3) do |a,b,c|
  if a != b && b != c && a != c
    arr = [a,b,c].sort
    if arr[2] < arr[0] + arr[1]
      cnt += 1
    end
  end
end
puts cnt