n=int(input())
l=list(map(int,input().split()))
l.sort()
ans=0
for i in range(n):
  k=i
  for j in range(i+1,n):
    while k<n and l[k]<l[i]+l[j]:
      k+=1
    ans+=k-(j+1)
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 ans=0 ans 0 for i in range(n):
  k=i
  for j in range(i+1,n):
    while k<n and l[k]<l[i]+l[j]:
      k+=1
    ans+=k-(j+1) i range(n) range n k=i k i for j in range(i+1,n):
    while k<n and l[k]<l[i]+l[j]:
      k+=1
    ans+=k-(j+1) j range(i+1,n) range i+1 i 1 n while k<n and l[k]<l[i]+l[j]:
      k+=1
     k<n and l[k]<l[i]+l[j] k<n k n l[k]<l[i]+l[j] l[k] l k l[i]+l[j] l[i] l i l[j] l j k+=1 k 1 ans+=k-(j+1) ans k-(j+1) k j+1 j 1 print(ans) print ans k+=1 1 k n=int(input()) int(input()) n k=i i k ans=0 0 ans l=list(map(int,input().split())) list(map(int,input().split())) l ans+=k-(j+1) k-(j+1) ans
n=int(input())
l=list(map(int,input().split()))
l.sort()
ans=0
for i in range(n):
  k=i
  for j in range(i+1,n):
    while k<n and l[k]<l[i]+l[j]:
      k+=1
    ans+=k-(j+1)
print(ans)