n=int(input())
l=list(map(int,input().split()))
l.sort(reverse=True)
c=0
for i in range(n-2):
  for j in range(i+1,n-1):
    u=l[i]-l[j]
    if l[j+1]<=u:
      break
    ok=j+1
    ng=n
    while ng-ok>1:
      center=(ok+ng)//2
      if l[center]>u:
        ok=center
      else:
        ng=center
    c+=ng-j-1
print(c)     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(reverse=True) l.sort l sort reverse=True reverse True c=0 c 0 for i in range(n-2):
  for j in range(i+1,n-1):
    u=l[i]-l[j]
    if l[j+1]<=u:
      break
    ok=j+1
    ng=n
    while ng-ok>1:
      center=(ok+ng)//2
      if l[center]>u:
        ok=center
      else:
        ng=center
    c+=ng-j-1 i range(n-2) range n-2 n 2 for j in range(i+1,n-1):
    u=l[i]-l[j]
    if l[j+1]<=u:
      break
    ok=j+1
    ng=n
    while ng-ok>1:
      center=(ok+ng)//2
      if l[center]>u:
        ok=center
      else:
        ng=center
    c+=ng-j-1 j range(i+1,n-1) range i+1 i 1 n-1 n 1 u=l[i]-l[j] u l[i]-l[j] l[i] l i l[j] l j if l[j+1]<=u:
      break
     l[j+1]<=u l[j+1] l j+1 j 1 u break ok=j+1 ok j+1 j 1 ng=n ng n while ng-ok>1:
      center=(ok+ng)//2
      if l[center]>u:
        ok=center
      else:
        ng=center
     ng-ok>1 ng-ok ng ok 1 center=(ok+ng)//2 center (ok+ng)//2 ok+ng ok ng 2 if l[center]>u:
        ok=center
      else:
        ng=center
     l[center]>u l[center] l center u ok=center ok center ng=center ng center c+=ng-j-1 c ng-j-1 ng-j ng j 1 print(c) print c c=0 0 c center=(ok+ng)//2 (ok+ng)//2 center ng=n n ng ok=center center ok u=l[i]-l[j] l[i]-l[j] u l=list(map(int,input().split())) list(map(int,input().split())) l c+=ng-j-1 ng-j-1 c ok=j+1 j+1 ok ng=center center ng n=int(input()) int(input()) n
n=int(input())
l=list(map(int,input().split()))
l.sort(reverse=True)
c=0
for i in range(n-2):
  for j in range(i+1,n-1):
    u=l[i]-l[j]
    if l[j+1]<=u:
      break
    ok=j+1
    ng=n
    while ng-ok>1:
      center=(ok+ng)//2
      if l[center]>u:
        ok=center
      else:
        ng=center
    c+=ng-j-1
print(c)    