N = gets.strip.to_i
L = gets.split(/\s+/).map(&:to_i)

ls = L.sort
n = ls.size

s = 0
for i in 0...(n-2) do
  li = ls[i]
  for j in (i+1)...(n-1) do
    lj = ls[j]
    next if li == lj
    for k in (j+1)...(n) do
      lk = ls[k]
      next if lj == lk
      if li + lj > lk
        s += 1
      else
        break
      end
    end
  end
end

puts s
