n=int(input())
l=list(map(int,input().split()))
from bisect import bisect_left
l.sort()
ans=0
for i in range(n-2):
  for j in range(i+1,n-1):
    t=l[i]+l[j]
    idx=bisect_left(l,t)
    ans+=max(idx-j-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 from bisect import bisect_left l.sort() l.sort l sort ans=0 ans 0 for i in range(n-2):
  for j in range(i+1,n-1):
    t=l[i]+l[j]
    idx=bisect_left(l,t)
    ans+=max(idx-j-1,0) i range(n-2) range n-2 n 2 for j in range(i+1,n-1):
    t=l[i]+l[j]
    idx=bisect_left(l,t)
    ans+=max(idx-j-1,0) j range(i+1,n-1) range i+1 i 1 n-1 n 1 t=l[i]+l[j] t l[i]+l[j] l[i] l i l[j] l j idx=bisect_left(l,t) idx bisect_left(l,t) bisect_left l t ans+=max(idx-j-1,0) ans max(idx-j-1,0) max idx-j-1 idx-j idx j 1 0 print(ans) print ans idx=bisect_left(l,t) bisect_left(l,t) idx ans=0 0 ans t=l[i]+l[j] l[i]+l[j] t ans+=max(idx-j-1,0) max(idx-j-1,0) ans l=list(map(int,input().split())) list(map(int,input().split())) l n=int(input()) int(input()) n
n=int(input())
l=list(map(int,input().split()))
from bisect import bisect_left
l.sort()
ans=0
for i in range(n-2):
  for j in range(i+1,n-1):
    t=l[i]+l[j]
    idx=bisect_left(l,t)
    ans+=max(idx-j-1,0)
print(ans)
