import bisect

n = int(eval(input()))

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

cnt = 0

l.sort()



for i in range(n):

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

        k = bisect.bisect_left(l,l[i]+l[j])

        if k > j:

            cnt += k - j - 1

        else:

            pass

            

print(cnt)
n = int(eval(input()))

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



import bisect

l.sort()

cnt = 0

for i in range(n):

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

        idx = bisect.bisect_left(l,l[i]+l[j])

        #print('idx',idx)

        if j < idx:

            cnt += idx - j - 1





print(cnt)
import bisect

n = int(eval(input()))
l = list(map(int, input().split()))
cnt = 0
l.sort()
for i in range(n):
    for j in range(i + 1, n):
        k = bisect.bisect_left(l, l[i] + l[j])
        if k > j:
            cnt += k - j - 1
        else:
            pass
print(cnt)

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

l.sort()
cnt = 0
for i in range(n):
    for j in range(i + 1, n):
        idx = bisect.bisect_left(l, l[i] + l[j])
        # print('idx',idx)
        if j < idx:
            cnt += idx - j - 1
print(cnt)

+n = int(eval(input())) +l = list(map(int, input().split())) -n = int(eval(input())) -l = list(map(int, input().split())) +l.sort() -l.sort() -        k = bisect.bisect_left(l, l[i] + l[j]) -        if k > j: -            cnt += k - j - 1 -        else: -            pass +        idx = bisect.bisect_left(l, l[i] + l[j]) +        # print('idx',idx) +        if j < idx: +            cnt += idx - j - 1