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

arr = []

(0...n).each do |a|
  (a+1...n).each do |b|
    (b+1...n).each do |c|
      if l[a] + l[b] > l[c] && l[b] + l[c] > l[a] && l[c] + l[a] > l[b]
        aa = [a, b, c].sort
        arr.push(aa)
      end
    end
  end
end
arr.uniq!
puts arr.size