import bisect
n = int(input())
L = sorted(map(int, input().split()))
m = L[-1]
ans = 0
for i in range(n):
    for j in range(i + 1, n):
        k = L[i] + L[j]
        ans += bisect.bisect_left(L, k) - j-1
print(ans) import bisect bisect 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 m = L[-1] m L[-1] L -1 ans = 0 ans 0 for i in range(n):
    for j in range(i + 1, n):
        k = L[i] + L[j]
        ans += bisect.bisect_left(L, k) - j-1 i range(n) range n for j in range(i + 1, n):
        k = L[i] + L[j]
        ans += bisect.bisect_left(L, k) - j-1 j range(i + 1, n) range i + 1 i 1 n k = L[i] + L[j] k L[i] + L[j] L[i] L i L[j] L j ans += bisect.bisect_left(L, k) - j-1 ans bisect.bisect_left(L, k) - j-1 bisect.bisect_left(L, k) - j bisect.bisect_left(L, k) bisect.bisect_left bisect bisect_left L k j 1 print(ans) print ans ans = 0 0 ans k = L[i] + L[j] L[i] + L[j] k ans += bisect.bisect_left(L, k) - j-1 bisect.bisect_left(L, k) - j-1 ans n = int(input()) int(input()) n L = sorted(map(int, input().split())) sorted(map(int, input().split())) L m = L[-1] L[-1] m
import bisect
n = int(input())
L = sorted(map(int, input().split()))
m = L[-1]
ans = 0
for i in range(n):
    for j in range(i + 1, n):
        k = L[i] + L[j]
        ans += bisect.bisect_left(L, k) - j-1
print(ans)
