n = int(eval(input()))

xs = list(map(int, input().split()))

xs = sorted(list(xs))

ts = []

for i in range(n):

    for j in range(i+1, n):

        ts.append(xs[i] + xs[j])

ts.sort()

i = 0

j = 0

r = 0

xs.append(10**18)

while True:

    if j == len(xs) or i == len(ts):

        break

    if ts[i] <= xs[j]:

        i += 1

        r += n-j

    else:

        j += 1

print((n*(n-1)*(n-2)//6-r))

n = int(eval(input()))

X = list(map(int, input().split()))

X.sort()

k=r=0

for i in range(n):

    k = i

    for j in range(i+1, n):

        while k<n and X[i]+X[j]>X[k]:

            k +=1

        r += k-j-1

print(r)

n = int(eval(input()))
xs = list(map(int, input().split()))
xs = sorted(list(xs))
ts = []
for i in range(n):
    for j in range(i + 1, n):
        ts.append(xs[i] + xs[j])
ts.sort()
i = 0
j = 0
r = 0
xs.append(10**18)
while True:
    if j == len(xs) or i == len(ts):
        break
    if ts[i] <= xs[j]:
        i += 1
        r += n - j
    else:
        j += 1
print((n * (n - 1) * (n - 2) // 6 - r))

n = int(eval(input()))
X = list(map(int, input().split()))
X.sort()
k = r = 0
for i in range(n):
    k = i
    for j in range(i + 1, n):
        while k < n and X[i] + X[j] > X[k]:
            k += 1
        r += k - j - 1
print(r)

-xs = list(map(int, input().split())) -xs = sorted(list(xs)) -ts = [] +X = list(map(int, input().split())) +X.sort() +k = r = 0 +    k = i -        ts.append(xs[i] + xs[j]) -ts.sort() -i = 0 -j = 0 -r = 0 -xs.append(10**18) -while True: -    if j == len(xs) or i == len(ts): -        break -    if ts[i] <= xs[j]: -        i += 1 -        r += n - j -    else: -        j += 1 -print((n * (n - 1) * (n - 2) // 6 - r)) +        while k < n and X[i] + X[j] > X[k]: +            k += 1 +        r += k - j - 1 +print(r)