n=int(eval(input()))

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

l.sort()

ans=0

import bisect

for i in range(n):

    for j in range(n):

        if i<j:

            a=l[i]

            b=l[j]

            x=bisect.bisect_left(l,a+b)

            y=bisect.bisect_right(l,b-a)

            if b-a>=a:

                ans+=max(0,x-y-1)

            else:

                ans+=max(0,x-y-2)

print((ans//3))

n=int(eval(input()))

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

l.sort()

from bisect import bisect_left

ans=0

for i in range(n):

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

        a=l[i]

        b=l[j]

        ans+=max(0,bisect_left(l,a+b)-j-1)

print(ans)

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

for i in range(n):
    for j in range(n):
        if i < j:
            a = l[i]
            b = l[j]
            x = bisect.bisect_left(l, a + b)
            y = bisect.bisect_right(l, b - a)
            if b - a >= a:
                ans += max(0, x - y - 1)
            else:
                ans += max(0, x - y - 2)
print((ans // 3))

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

ans = 0
for i in range(n):
    for j in range(i + 1, n):
        a = l[i]
        b = l[j]
        ans += max(0, bisect_left(l, a + b) - j - 1)
print(ans)

+from bisect import bisect_left + -import bisect - -    for j in range(n): -        if i < j: -            a = l[i] -            b = l[j] -            x = bisect.bisect_left(l, a + b) -            y = bisect.bisect_right(l, b - a) -            if b - a >= a: -                ans += max(0, x - y - 1) -            else: -                ans += max(0, x - y - 2) -print((ans // 3)) +    for j in range(i + 1, n): +        a = l[i] +        b = l[j] +        ans += max(0, bisect_left(l, a + b) - j - 1) +print(ans)