n = gets.to_i
l = gets.split(" ", n).map(&:to_i)

ans = 0
0.upto(l.length-3) do |i|
  (i+1).upto(l.length-1) do |j|
    i.upto(j-1) do |k|
      if i == k || j == k
        next
      end
      if l[i] < l[j] + l[k] && l[j] < l[i] + l[k] && l[k] < l[i] + l[j]
        ans += 1
      end
    end
  end
end
p ans