
n=int(input())
l=list(map(int,input().split()))
from bisect import bisect_left
l.sort()

count=0
for a in range(n-2):
    for b in range(a+1,n-1):
        idx=bisect_left(l,l[a]+l[b],lo=b)
        count+=idx-(b+1)

print(count) 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 from bisect import bisect_left l.sort() l.sort l sort count=0 count 0 for a in range(n-2):
    for b in range(a+1,n-1):
        idx=bisect_left(l,l[a]+l[b],lo=b)
        count+=idx-(b+1) a range(n-2) range n-2 n 2 for b in range(a+1,n-1):
        idx=bisect_left(l,l[a]+l[b],lo=b)
        count+=idx-(b+1) b range(a+1,n-1) range a+1 a 1 n-1 n 1 idx=bisect_left(l,l[a]+l[b],lo=b) idx bisect_left(l,l[a]+l[b],lo=b) bisect_left l l[a]+l[b] l[a] l a l[b] l b lo=b lo b count+=idx-(b+1) count idx-(b+1) idx b+1 b 1 print(count) print count n=int(input()) int(input()) n idx=bisect_left(l,l[a]+l[b],lo=b) bisect_left(l,l[a]+l[b],lo=b) idx count+=idx-(b+1) idx-(b+1) count l=list(map(int,input().split())) list(map(int,input().split())) l count=0 0 count

n=int(input())
l=list(map(int,input().split()))
from bisect import bisect_left
l.sort()

count=0
for a in range(n-2):
    for b in range(a+1,n-1):
        idx=bisect_left(l,l[a]+l[b],lo=b)
        count+=idx-(b+1)

print(count)