import bisect

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

L_sorted = sorted(L, reverse = False)#昇順

count = 0
for i in range(N):#aの選び方
    for j in range(i+1,N):#bの選び方
        a = L_sorted[i]
        b = L_sorted[j]#b <= c < a+b
        count += bisect.bisect_left(L_sorted, a+b) - j -1
print(count) import bisect bisect N = input() N input() input N = int(N) N int(N) int N L = list(map(int,input().split())) L list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split L_sorted = sorted(L, reverse = False) L_sorted sorted(L, reverse = False) sorted L reverse = False reverse False count = 0 count 0 for i in range(N):#aの選び方
    for j in range(i+1,N):#bの選び方
        a = L_sorted[i]
        b = L_sorted[j]#b <= c < a+b
        count += bisect.bisect_left(L_sorted, a+b) - j -1 i range(N) range N for j in range(i+1,N):#bの選び方
        a = L_sorted[i]
        b = L_sorted[j]#b <= c < a+b
        count += bisect.bisect_left(L_sorted, a+b) - j -1 j range(i+1,N) range i+1 i 1 N a = L_sorted[i] a L_sorted[i] L_sorted i b = L_sorted[j] b L_sorted[j] L_sorted j count += bisect.bisect_left(L_sorted, a+b) - j -1 count bisect.bisect_left(L_sorted, a+b) - j -1 bisect.bisect_left(L_sorted, a+b) - j bisect.bisect_left(L_sorted, a+b) bisect.bisect_left bisect bisect_left L_sorted a+b a b j 1 print(count) print count a = L_sorted[i] L_sorted[i] a N = int(N) int(N) N b = L_sorted[j] L_sorted[j] b L_sorted = sorted(L, reverse = False) sorted(L, reverse = False) L_sorted count += bisect.bisect_left(L_sorted, a+b) - j -1 bisect.bisect_left(L_sorted, a+b) - j -1 count count = 0 0 count N = input() input() N L = list(map(int,input().split())) list(map(int,input().split())) L
import bisect

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

L_sorted = sorted(L, reverse = False)#昇順

count = 0
for i in range(N):#aの選び方
    for j in range(i+1,N):#bの選び方
        a = L_sorted[i]
        b = L_sorted[j]#b <= c < a+b
        count += bisect.bisect_left(L_sorted, a+b) - j -1
print(count)