from bisect import bisect_left
N = int(input())
L = sorted(list(map(int,input().split())))
cnt = 0
for i in range(N-2):
    for j in range(i+1,N-1):
        a = L[i]
        b = L[j]
        ind = bisect_left(L,a+b)
        cnt += ind-j-1
print(cnt) from bisect import bisect_left N = int(input()) N int(input()) int input() input L = sorted(list(map(int,input().split()))) L sorted(list(map(int,input().split()))) sorted list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split cnt = 0 cnt 0 for i in range(N-2):
    for j in range(i+1,N-1):
        a = L[i]
        b = L[j]
        ind = bisect_left(L,a+b)
        cnt += ind-j-1 i range(N-2) range N-2 N 2 for j in range(i+1,N-1):
        a = L[i]
        b = L[j]
        ind = bisect_left(L,a+b)
        cnt += ind-j-1 j range(i+1,N-1) range i+1 i 1 N-1 N 1 a = L[i] a L[i] L i b = L[j] b L[j] L j ind = bisect_left(L,a+b) ind bisect_left(L,a+b) bisect_left L a+b a b cnt += ind-j-1 cnt ind-j-1 ind-j ind j 1 print(cnt) print cnt L = sorted(list(map(int,input().split()))) sorted(list(map(int,input().split()))) L cnt += ind-j-1 ind-j-1 cnt ind = bisect_left(L,a+b) bisect_left(L,a+b) ind b = L[j] L[j] b a = L[i] L[i] a N = int(input()) int(input()) N cnt = 0 0 cnt
from bisect import bisect_left
N = int(input())
L = sorted(list(map(int,input().split())))
cnt = 0
for i in range(N-2):
    for j in range(i+1,N-1):
        a = L[i]
        b = L[j]
        ind = bisect_left(L,a+b)
        cnt += ind-j-1
print(cnt)