n = gets.to_i
a = gets.split.map(&:to_i).sort
sum = 0
(n-2).times do |i|
  ((i+1)...(n-1)).each do |j|
    next if a[i] == a[j]
    ((j+1)...n).each do |k|
      next if a[i] + a[j] <= a[k] || a[j] == a[k] 
      sum += 1
    end
  end
end
puts sum