n = gets.chomp.to_i
ls = gets.chomp.split(' ').map(&:to_i)

if n < 3
  puts 0
  exit
end

ts = 0
(0..n-1).each do |i|
  
  ((i+1)..n-1).each do |j|
    break if j >= n
    next if ls[j] == ls[i]
    
    ((j+1)..n-1).each do |k|
      next if [ls[i], ls[j]].include?(ls[k])
     
      lls = [ls[i], ls[j], ls[k]].sort
      if lls[0] + lls[1] <= lls[2]
        next   # 三角形にならない
      end
      
      ts += 1
    end
  end
  
end

puts ts
