N = gets.to_i
l = gets.split.map(&:to_i)
cnt = 0
(0..N-1).each do |i|
  (i+1..N-1).each do |j|
    (j+1..N-1).each do |k|
      next if i == j || j == k || i == k
      if l[i] != l[j] && l[j] != l[k] && l[i] != l[k] && 
        l[i] + l[j] > l[k] && l[j] + l[k] > l[i] && l[i] + l[k] > l[j]
        cnt = cnt.succ
      end
    end
  end
end
puts cnt