n=int(input())
l=list(map(int,input().split()))

l.sort(reverse=True)
ans=0

for i in range(0,n-2):
  for j in range(i+1,n-1):
    left = j
    right = n
    while right-left>1:
      mid = (left + right)//2
      
      if l[i]+l[j]>l[mid] and l[i]+l[mid]>l[j] and l[mid]+l[j]>l[i]:
        left = mid
      else:
        right = mid
    #print(i,j,left)
    ans+=(left-j)
      
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(reverse=True) l.sort l sort reverse=True reverse True ans=0 ans 0 for i in range(0,n-2):
  for j in range(i+1,n-1):
    left = j
    right = n
    while right-left>1:
      mid = (left + right)//2
      
      if l[i]+l[j]>l[mid] and l[i]+l[mid]>l[j] and l[mid]+l[j]>l[i]:
        left = mid
      else:
        right = mid
    #print(i,j,left)
    ans+=(left-j)
       i range(0,n-2) range 0 n-2 n 2 for j in range(i+1,n-1):
    left = j
    right = n
    while right-left>1:
      mid = (left + right)//2
      
      if l[i]+l[j]>l[mid] and l[i]+l[mid]>l[j] and l[mid]+l[j]>l[i]:
        left = mid
      else:
        right = mid
    #print(i,j,left)
    ans+=(left-j)
       j range(i+1,n-1) range i+1 i 1 n-1 n 1 left = j left j right = n right n while right-left>1:
      mid = (left + right)//2
      
      if l[i]+l[j]>l[mid] and l[i]+l[mid]>l[j] and l[mid]+l[j]>l[i]:
        left = mid
      else:
        right = mid
    #print(i,j,left)
     right-left>1 right-left right left 1 mid = (left + right)//2 mid (left + right)//2 left + right left right 2 if l[i]+l[j]>l[mid] and l[i]+l[mid]>l[j] and l[mid]+l[j]>l[i]:
        left = mid
      else:
        right = mid
    #print(i,j,left)
     l[i]+l[j]>l[mid] and l[i]+l[mid]>l[j] and l[mid]+l[j]>l[i] l[i]+l[j]>l[mid] and l[i]+l[mid]>l[j] l[i]+l[j]>l[mid] l[i]+l[j] l[i] l i l[j] l j l[mid] l mid l[i]+l[mid]>l[j] l[i]+l[mid] l[i] l i l[mid] l mid l[j] l j l[mid]+l[j]>l[i] l[mid]+l[j] l[mid] l mid l[j] l j l[i] l i left = mid left mid right = mid right mid ans+=(left-j) ans left-j left j print(ans) print ans right = n n right ans+=(left-j) left-j ans n=int(input()) int(input()) n left = mid mid left l=list(map(int,input().split())) list(map(int,input().split())) l ans=0 0 ans right = mid mid right left = j j left mid = (left + right)//2 (left + right)//2 mid
n=int(input())
l=list(map(int,input().split()))

l.sort(reverse=True)
ans=0

for i in range(0,n-2):
  for j in range(i+1,n-1):
    left = j
    right = n
    while right-left>1:
      mid = (left + right)//2
      
      if l[i]+l[j]>l[mid] and l[i]+l[mid]>l[j] and l[mid]+l[j]>l[i]:
        left = mid
      else:
        right = mid
    #print(i,j,left)
    ans+=(left-j)
      
print(ans)