from bisect import bisect_left



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):

    ans+=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):

    a=L[i]

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

        b=L[j]

        ans+=bisect.bisect_left(L, a+b)-(j+1)

print(ans)

from bisect import bisect_left

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):
        ans += 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):
    a = L[i]
    for j in range(i + 1, N):
        b = L[j]
        ans += bisect.bisect_left(L, a + b) - (j + 1)
print(ans)

-from bisect import bisect_left +import bisect +    a = L[i] -        ans += bisect_left(L[j + 1 :], L[i] + L[j]) +        b = L[j] +        ans += bisect.bisect_left(L, a + b) - (j + 1)