import bisect

n = int(eval(input()))

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

l.sort()

ans = 0



for i in range(n):

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

        length = l[i] + l[j]



        index = bisect.bisect_left(l[j+1:], length)

        ans += index



print(ans)
import bisect

n = int(eval(input()))

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

ans = 0



for i in range(n):

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

        ans += bisect.bisect_left(l[j+1:], l[i] + l[j])



print(ans)
import bisect

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

import bisect

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

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