n = int(eval(input()))

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



l.sort(reverse=True)

m = sorted(l)

#print(l)

# print(m)



import bisect



ans = 0

for i in range(n-2):

  a = l[i]

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

    b = l[j]

    x = a-b

    ind = bisect.bisect_right(m,x)

    #print(a, b, j, ind)

    if n-1-j-ind >= 0:

      ans += n-1-j-ind



print(ans)

n = int(eval(input()))

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



L.sort()

import bisect

ans = 0

for i in range(n-2):

    b = L[i]

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

        c = L[j]

        p = bisect.bisect_left(L, b+c)

        #print(b, c, j, p, p-j-1)

        ans += max(p-j-1, 0)

print(ans)
n = int(eval(input()))
l = list(map(int, input().split()))
l.sort(reverse=True)
m = sorted(l)
# print(l)
# print(m)
import bisect

ans = 0
for i in range(n - 2):
    a = l[i]
    for j in range(i + 1, n - 1):
        b = l[j]
        x = a - b
        ind = bisect.bisect_right(m, x)
        # print(a, b, j, ind)
        if n - 1 - j - ind >= 0:
            ans += n - 1 - j - ind
print(ans)

n = int(eval(input()))
L = list(map(int, input().split()))
L.sort()
import bisect

ans = 0
for i in range(n - 2):
    b = L[i]
    for j in range(i + 1, n - 1):
        c = L[j]
        p = bisect.bisect_left(L, b + c)
        # print(b, c, j, p, p-j-1)
        ans += max(p - j - 1, 0)
print(ans)

-l = list(map(int, input().split())) -l.sort(reverse=True) -m = sorted(l) -# print(l) -# print(m) +L = list(map(int, input().split())) +L.sort() -    a = l[i] +    b = L[i] -        b = l[j] -        x = a - b -        ind = bisect.bisect_right(m, x) -        # print(a, b, j, ind) -        if n - 1 - j - ind >= 0: -            ans += n - 1 - j - ind +        c = L[j] +        p = bisect.bisect_left(L, b + c) +        # print(b, c, j, p, p-j-1) +        ans += max(p - j - 1, 0)