n = gets.to_i
lines = gets.split.map(&:to_i).uniq

answer = 0
lines.each do |a|
  lines.each do |b|
    lines.each do |c|
      next if a == b || b == c || a == c

      a, b, c = [a, b, c].sort
      answer += 1 if a + b < c
    end
  end
end

puts answer
