import bisect
from copy import deepcopy
N = int(input())
L = sorted(map(int, input().split()))

ans = 0
for i in range(N):
    for j in range(i + 1, N - 1):
        b = L[j] + L[i]
        x = bisect.bisect_left(L, b) - j - 1
        if x > 0:
            ans += x

print(ans) import bisect bisect from copy import deepcopy N = int(input()) N int(input()) int input() input L = sorted(map(int, input().split())) L sorted(map(int, input().split())) sorted map(int, input().split()) map int input().split() ().split () input split ans = 0 ans 0 for i in range(N):
    for j in range(i + 1, N - 1):
        b = L[j] + L[i]
        x = bisect.bisect_left(L, b) - j - 1
        if x > 0:
            ans += x i range(N) range N for j in range(i + 1, N - 1):
        b = L[j] + L[i]
        x = bisect.bisect_left(L, b) - j - 1
        if x > 0:
            ans += x j range(i + 1, N - 1) range i + 1 i 1 N - 1 N 1 b = L[j] + L[i] b L[j] + L[i] L[j] L j L[i] L i x = bisect.bisect_left(L, b) - j - 1 x bisect.bisect_left(L, b) - j - 1 bisect.bisect_left(L, b) - j bisect.bisect_left(L, b) bisect.bisect_left bisect bisect_left L b j 1 if x > 0:
            ans += x x > 0 x 0 ans += x ans x print(ans) print ans ans = 0 0 ans b = L[j] + L[i] L[j] + L[i] b N = int(input()) int(input()) N L = sorted(map(int, input().split())) sorted(map(int, input().split())) L ans += x x ans x = bisect.bisect_left(L, b) - j - 1 bisect.bisect_left(L, b) - j - 1 x
import bisect
from copy import deepcopy
N = int(input())
L = sorted(map(int, input().split()))

ans = 0
for i in range(N):
    for j in range(i + 1, N - 1):
        b = L[j] + L[i]
        x = bisect.bisect_left(L, b) - j - 1
        if x > 0:
            ans += x

print(ans)
