n = gets.to_i
l = gets.split.map(&:to_i)
l.sort!
h = {}
l.each do |m|
  if h.has_key?(m)
    h[m]+=1
  else
    h[m]=1
  end
end
keys = h.keys.sort!
a = keys.length
if a < 3
  puts 0
  exit
end
ans = 0
(0..a-3).each do |i|
  (i+1..a-2).each do |j|
    (j+1..a-1).each do |k|
      if keys[i] + keys[j] > keys[k]
        ans += h[keys[i]] * h[keys[j]] * h[keys[k]]
      end
    end
  end
end

puts ans