from bisect import bisect_left,bisect_right

from itertools import combinations

N = int(eval(input()))

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

cnt = 0

for x in combinations(list(range(N)),2):

    i,j = x[0],x[1]

    if j<i:

        i,j = j,i

    indr = bisect_left(L,L[i]+L[j])

    indl = bisect_right(L,abs(L[i]-L[j]))

    if j<indl or i>indr:

        cnt += indr-indl

    elif indr>j>=indl and i<indl:

        cnt += indr-indl-1

    elif indr>j and i>=indl:

        cnt += indr-indl-2

    elif j>=indr and indr>i>=indl:

        cnt += indr-indl-1

print((cnt//3))
from bisect import bisect_right,bisect_left

N = int(eval(input()))

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

cnt = 0

for i in range(N-1):

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

        a = L[i]

        b = L[j]

        indU = bisect_left(L,a+b)

        indL = bisect_right(L,b-a)

        if j<indU and i>= indL:

            cnt += indU-indL-2

        elif indL<=i<indU and j>=indU or i<indL and indL<=j<indU:

            cnt += indU-indL-1

        elif j<indL or i>=indU:

            cnt += indU-indL

print((cnt//3))
from bisect import bisect_left, bisect_right
from itertools import combinations

N = int(eval(input()))
L = sorted(list(map(int, input().split())))
cnt = 0
for x in combinations(list(range(N)), 2):
    i, j = x[0], x[1]
    if j < i:
        i, j = j, i
    indr = bisect_left(L, L[i] + L[j])
    indl = bisect_right(L, abs(L[i] - L[j]))
    if j < indl or i > indr:
        cnt += indr - indl
    elif indr > j >= indl and i < indl:
        cnt += indr - indl - 1
    elif indr > j and i >= indl:
        cnt += indr - indl - 2
    elif j >= indr and indr > i >= indl:
        cnt += indr - indl - 1
print((cnt // 3))

from bisect import bisect_right, bisect_left

N = int(eval(input()))
L = sorted(list(map(int, input().split())))
cnt = 0
for i in range(N - 1):
    for j in range(i + 1, N):
        a = L[i]
        b = L[j]
        indU = bisect_left(L, a + b)
        indL = bisect_right(L, b - a)
        if j < indU and i >= indL:
            cnt += indU - indL - 2
        elif indL <= i < indU and j >= indU or i < indL and indL <= j < indU:
            cnt += indU - indL - 1
        elif j < indL or i >= indU:
            cnt += indU - indL
print((cnt // 3))

-from bisect import bisect_left, bisect_right -from itertools import combinations +from bisect import bisect_right, bisect_left -for x in combinations(list(range(N)), 2): -    i, j = x[0], x[1] -    if j < i: -        i, j = j, i -    indr = bisect_left(L, L[i] + L[j]) -    indl = bisect_right(L, abs(L[i] - L[j])) -    if j < indl or i > indr: -        cnt += indr - indl -    elif indr > j >= indl and i < indl: -        cnt += indr - indl - 1 -    elif indr > j and i >= indl: -        cnt += indr - indl - 2 -    elif j >= indr and indr > i >= indl: -        cnt += indr - indl - 1 +for i in range(N - 1): +    for j in range(i + 1, N): +        a = L[i] +        b = L[j] +        indU = bisect_left(L, a + b) +        indL = bisect_right(L, b - a) +        if j < indU and i >= indL: +            cnt += indU - indL - 2 +        elif indL <= i < indU and j >= indU or i < indL and indL <= j < indU: +            cnt += indU - indL - 1 +        elif j < indL or i >= indU: +            cnt += indU - indL