import bisect

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

ans = 0
L = sorted(L)

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

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

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

ans = 0
L = sorted(L)

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

print(ans)