N = int(eval(input()))

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

res = 0

for i in range(N - 1, 1, - 1):

    j = i - 1

    k = 0

    while j > k:

        while j > k and L[i] >= L[j] + L[k]:

            k += 1

        res += j - k

        j -= 1

print(res)
N = int(eval(input()))

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

res = 0

for i in range(N - 1, 1, - 1):

    j = i - 1

    k = 0

    while j > k:

        if L[i] < L[j] + L[k]:

            res += j - k

            j -= 1

        else:

            k += 1

print(res)
N = int(eval(input()))
L = sorted(list(map(int, input().split())))
res = 0
for i in range(N - 1, 1, -1):
    j = i - 1
    k = 0
    while j > k:
        while j > k and L[i] >= L[j] + L[k]:
            k += 1
        res += j - k
        j -= 1
print(res)

N = int(eval(input()))
L = sorted(list(map(int, input().split())))
res = 0
for i in range(N - 1, 1, -1):
    j = i - 1
    k = 0
    while j > k:
        if L[i] < L[j] + L[k]:
            res += j - k
            j -= 1
        else:
            k += 1
print(res)

-        while j > k and L[i] >= L[j] + L[k]: +        if L[i] < L[j] + L[k]: +            res += j - k +            j -= 1 +        else: -        res += j - k -        j -= 1