N = gets.to_i
array = gets.split(' ').map(&:to_i)
array.sort!

ans = 0

(0..N-3).each do |i|
  (i+1..N-2).each do |j|
    (j+1..N-1).each do |k|
      a = array[i]
      b = array[j]
      c = array[k]
      if a + b > c
        ans += 1 if (a != b) && (b != c)
      else
        break
      end
    end
  end
end
puts ans
