from bisect import bisect_left

n = int(eval(input()))

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

l.sort()

ans = 0

for i in range(n - 2):

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

        ans += bisect_left(l, l[i] + l[j]) - j - 1

print(ans)
from bisect import bisect_left

n = int(eval(input()))

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

L = sorted(L)

ans = 0

for i in range(n - 2):

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

        ans += bisect_left(L, L[i] + L[j]) - j - 1

print(ans)
from bisect import bisect_left

n = int(eval(input()))
l = list(map(int, input().split()))
l.sort()
ans = 0
for i in range(n - 2):
    for j in range(i + 1, n - 1):
        ans += bisect_left(l, l[i] + l[j]) - j - 1
print(ans)

from bisect import bisect_left

n = int(eval(input()))
L = list(map(int, input().split()))
L = sorted(L)
ans = 0
for i in range(n - 2):
    for j in range(i + 1, n - 1):
        ans += bisect_left(L, L[i] + L[j]) - j - 1
print(ans)

-l = list(map(int, input().split())) -l.sort() +L = list(map(int, input().split())) +L = sorted(L) -        ans += bisect_left(l, l[i] + l[j]) - j - 1 +        ans += bisect_left(L, L[i] + L[j]) - j - 1