N=int(input())
L=list(map(int,input().split()))
L.sort()
from bisect import bisect_left
ans = 0
for i1 in range(N-2):
  for i2 in range(i1+1,N-1):
    l1,l2 = L[i1],L[i2]
    #th = bisect_left(L[i2+1:],l1+l2)
    #print(l1,l2,L[i2+1:],(l2-l1+1)*(-1),th)
    th = bisect_left(L,l1+l2)
    ans += max(th-i2-1,0)
print(ans) N=int(input()) N int(input()) int input() input L=list(map(int,input().split())) L list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split L.sort() L.sort L sort from bisect import bisect_left ans = 0 ans 0 for i1 in range(N-2):
  for i2 in range(i1+1,N-1):
    l1,l2 = L[i1],L[i2]
    #th = bisect_left(L[i2+1:],l1+l2)
    #print(l1,l2,L[i2+1:],(l2-l1+1)*(-1),th)
    th = bisect_left(L,l1+l2)
    ans += max(th-i2-1,0) i1 range(N-2) range N-2 N 2 for i2 in range(i1+1,N-1):
    l1,l2 = L[i1],L[i2]
    #th = bisect_left(L[i2+1:],l1+l2)
    #print(l1,l2,L[i2+1:],(l2-l1+1)*(-1),th)
    th = bisect_left(L,l1+l2)
    ans += max(th-i2-1,0) i2 range(i1+1,N-1) range i1+1 i1 1 N-1 N 1 l1,l2 = L[i1],L[i2] l1 L[i1] L i1 l2 L[i2] L i2 th = bisect_left(L,l1+l2) th bisect_left(L,l1+l2) bisect_left L l1+l2 l1 l2 ans += max(th-i2-1,0) ans max(th-i2-1,0) max th-i2-1 th-i2 th i2 1 0 print(ans) print ans l2 = L[i1],L[i2] L[i2] l2 ans = 0 0 ans l1,l2 = L[i1],L[i2] L[i1] l1 ans += max(th-i2-1,0) max(th-i2-1,0) ans L=list(map(int,input().split())) list(map(int,input().split())) L th = bisect_left(L,l1+l2) bisect_left(L,l1+l2) th N=int(input()) int(input()) N
N=int(input())
L=list(map(int,input().split()))
L.sort()
from bisect import bisect_left
ans = 0
for i1 in range(N-2):
  for i2 in range(i1+1,N-1):
    l1,l2 = L[i1],L[i2]
    #th = bisect_left(L[i2+1:],l1+l2)
    #print(l1,l2,L[i2+1:],(l2-l1+1)*(-1),th)
    th = bisect_left(L,l1+l2)
    ans += max(th-i2-1,0)
print(ans)