n=int(input())
L=sorted(list(map(int,input().split())))
ans=0
for i in range(n):
  for j in range(i+1,n):
    l=j;r=n
    while abs(l-r)>1:
      mid=(r+l)//2
      if L[i]<L[j]+L[mid] and L[j]<L[i]+L[mid] and L[mid]<L[i]+L[j]:
        l=mid
      else: r=mid
    ans+=l-j
print(ans) n=int(input()) n int(input()) int input() input L=sorted(list(map(int,input().split()))) L sorted(list(map(int,input().split()))) sorted list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split ans=0 ans 0 for i in range(n):
  for j in range(i+1,n):
    l=j;r=n
    while abs(l-r)>1:
      mid=(r+l)//2
      if L[i]<L[j]+L[mid] and L[j]<L[i]+L[mid] and L[mid]<L[i]+L[j]:
        l=mid
      else: r=mid
    ans+=l-j i range(n) range n for j in range(i+1,n):
    l=j;r=n
    while abs(l-r)>1:
      mid=(r+l)//2
      if L[i]<L[j]+L[mid] and L[j]<L[i]+L[mid] and L[mid]<L[i]+L[j]:
        l=mid
      else: r=mid
    ans+=l-j j range(i+1,n) range i+1 i 1 n l=j l j r=n r n while abs(l-r)>1:
      mid=(r+l)//2
      if L[i]<L[j]+L[mid] and L[j]<L[i]+L[mid] and L[mid]<L[i]+L[j]:
        l=mid
      else: r=mid
     abs(l-r)>1 abs(l-r) abs l-r l r 1 mid=(r+l)//2 mid (r+l)//2 r+l r l 2 if L[i]<L[j]+L[mid] and L[j]<L[i]+L[mid] and L[mid]<L[i]+L[j]:
        l=mid
      else: r=mid
     L[i]<L[j]+L[mid] and L[j]<L[i]+L[mid] and L[mid]<L[i]+L[j] L[i]<L[j]+L[mid] and L[j]<L[i]+L[mid] L[i]<L[j]+L[mid] L[i] L i L[j]+L[mid] L[j] L j L[mid] L mid L[j]<L[i]+L[mid] L[j] L j L[i]+L[mid] L[i] L i L[mid] L mid L[mid]<L[i]+L[j] L[mid] L mid L[i]+L[j] L[i] L i L[j] L j l=mid l mid ans+=l-j ans l-j l j print(ans) print ans ans=0 0 ans n=int(input()) int(input()) n l=mid mid l ans+=l-j l-j ans l=j j l r=n n r mid=(r+l)//2 (r+l)//2 mid L=sorted(list(map(int,input().split()))) sorted(list(map(int,input().split()))) L
n=int(input())
L=sorted(list(map(int,input().split())))
ans=0
for i in range(n):
  for j in range(i+1,n):
    l=j;r=n
    while abs(l-r)>1:
      mid=(r+l)//2
      if L[i]<L[j]+L[mid] and L[j]<L[i]+L[mid] and L[mid]<L[i]+L[j]:
        l=mid
      else: r=mid
    ans+=l-j
print(ans)