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

ans=0
for i in range(N-1):
    for j in range(i+1,N):
        a=L[i]
        b=L[j]
        upper = bisect.bisect_left(L,a+b)
        lower=max(j+1, bisect.bisect_right(L, a-b), bisect.bisect_right(L, b-a))
        #print(upper, lower)
        ans+=max(0, upper-lower)


print(ans) 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 L=sorted(L) L sorted(L) sorted L import bisect bisect ans=0 ans 0 for i in range(N-1):
    for j in range(i+1,N):
        a=L[i]
        b=L[j]
        upper = bisect.bisect_left(L,a+b)
        lower=max(j+1, bisect.bisect_right(L, a-b), bisect.bisect_right(L, b-a))
        #print(upper, lower)
        ans+=max(0, upper-lower) i range(N-1) range N-1 N 1 for j in range(i+1,N):
        a=L[i]
        b=L[j]
        upper = bisect.bisect_left(L,a+b)
        lower=max(j+1, bisect.bisect_right(L, a-b), bisect.bisect_right(L, b-a))
        #print(upper, lower)
        ans+=max(0, upper-lower) j range(i+1,N) range i+1 i 1 N a=L[i] a L[i] L i b=L[j] b L[j] L j upper = bisect.bisect_left(L,a+b) upper bisect.bisect_left(L,a+b) bisect.bisect_left bisect bisect_left L a+b a b lower=max(j+1, bisect.bisect_right(L, a-b), bisect.bisect_right(L, b-a)) lower max(j+1, bisect.bisect_right(L, a-b), bisect.bisect_right(L, b-a)) max j+1 j 1 bisect.bisect_right(L, a-b) bisect.bisect_right bisect bisect_right L a-b a b bisect.bisect_right(L, b-a) bisect.bisect_right bisect bisect_right L b-a b a ans+=max(0, upper-lower) ans max(0, upper-lower) max 0 upper-lower upper lower print(ans) print ans lower=max(j+1, bisect.bisect_right(L, a-b), bisect.bisect_right(L, b-a)) max(j+1, bisect.bisect_right(L, a-b), bisect.bisect_right(L, b-a)) lower b=L[j] L[j] b ans+=max(0, upper-lower) max(0, upper-lower) ans a=L[i] L[i] a ans=0 0 ans L=list(map(int, input().split())) list(map(int, input().split())) L upper = bisect.bisect_left(L,a+b) bisect.bisect_left(L,a+b) upper N=int(input()) int(input()) N L=sorted(L) sorted(L) L
N=int(input())
L=list(map(int, input().split()))
L=sorted(L)
import bisect

ans=0
for i in range(N-1):
    for j in range(i+1,N):
        a=L[i]
        b=L[j]
        upper = bisect.bisect_left(L,a+b)
        lower=max(j+1, bisect.bisect_right(L, a-b), bisect.bisect_right(L, b-a))
        #print(upper, lower)
        ans+=max(0, upper-lower)


print(ans)