N, *LS = $stdin.read.split.map(&:to_i) 
LS.sort!
ans = 0
for i in 0..(N-2)
  a = LS[i]
  for j in (i+1)...N
    b = LS[j]
    sum = a+b
    abs = (a-b).abs
    for k in 0...N
      #p i: i, j: j, k: k
      next if k == i || k == j
      c = LS[k]
      next if c <= abs
      break if c >= sum
      #p [i, j, k, a, b, c]
      ans += 1
    end
  end
end
p ans/3
