import bisect
n,*l = map(int,open(0).read().split())
l.sort()
ans = 0
for i in range(n-2):
  for j in range(i+1,n-1):
    ans += bisect.bisect_left(l,l[i]+l[j],j+1)-bisect.bisect_right(l,abs(l[i]-l[j]),j+1)
print(ans) import bisect bisect n,*l = map(int,open(0).read().split()) n map(int,open(0).read().split()) map int open(0).read().split() (0).read().split (0).read() (0).read (0) open 0 read split *l l l.sort() l.sort l sort ans = 0 ans 0 for i in range(n-2):
  for j in range(i+1,n-1):
    ans += bisect.bisect_left(l,l[i]+l[j],j+1)-bisect.bisect_right(l,abs(l[i]-l[j]),j+1) i range(n-2) range n-2 n 2 for j in range(i+1,n-1):
    ans += bisect.bisect_left(l,l[i]+l[j],j+1)-bisect.bisect_right(l,abs(l[i]-l[j]),j+1) j range(i+1,n-1) range i+1 i 1 n-1 n 1 ans += bisect.bisect_left(l,l[i]+l[j],j+1)-bisect.bisect_right(l,abs(l[i]-l[j]),j+1) ans bisect.bisect_left(l,l[i]+l[j],j+1)-bisect.bisect_right(l,abs(l[i]-l[j]),j+1) bisect.bisect_left(l,l[i]+l[j],j+1) bisect.bisect_left bisect bisect_left l l[i]+l[j] l[i] l i l[j] l j j+1 j 1 bisect.bisect_right(l,abs(l[i]-l[j]),j+1) bisect.bisect_right bisect bisect_right l abs(l[i]-l[j]) abs l[i]-l[j] l[i] l i l[j] l j j+1 j 1 print(ans) print ans ans = 0 0 ans n,*l = map(int,open(0).read().split()) map(int,open(0).read().split()) n ans += bisect.bisect_left(l,l[i]+l[j],j+1)-bisect.bisect_right(l,abs(l[i]-l[j]),j+1) bisect.bisect_left(l,l[i]+l[j],j+1)-bisect.bisect_right(l,abs(l[i]-l[j]),j+1) ans
import bisect
n,*l = map(int,open(0).read().split())
l.sort()
ans = 0
for i in range(n-2):
  for j in range(i+1,n-1):
    ans += bisect.bisect_left(l,l[i]+l[j],j+1)-bisect.bisect_right(l,abs(l[i]-l[j]),j+1)
print(ans)