from bisect import*

n,*l=list(map(int,open(0).read().split()))

l.sort()

print((sum(~j+bisect_left(l,l[i]+l[j],j+1)for i in range(n)for j in range(i+1,n))))
from bisect import*

_,l=open(0)

l=sorted(map(int,l.split()))

e=enumerate

print((sum(j-bisect(l,a-b,0,j)for i,a in e(l)for j,b in e(l[:i]))))
from bisect import *

n, *l = list(map(int, open(0).read().split()))
l.sort()
print(
    (
        sum(
            ~j + bisect_left(l, l[i] + l[j], j + 1)
            for i in range(n)
            for j in range(i + 1, n)
        )
    )
)

from bisect import *

_, l = open(0)
l = sorted(map(int, l.split()))
e = enumerate
print((sum(j - bisect(l, a - b, 0, j) for i, a in e(l) for j, b in e(l[:i]))))

-n, *l = list(map(int, open(0).read().split())) -l.sort() -print( -    ( -        sum( -            ~j + bisect_left(l, l[i] + l[j], j + 1) -            for i in range(n) -            for j in range(i + 1, n) -        ) -    ) -) +_, l = open(0) +l = sorted(map(int, l.split())) +e = enumerate +print((sum(j - bisect(l, a - b, 0, j) for i, a in e(l) for j, b in e(l[:i]))))