from bisect import bisect_left,bisect_right
N=int(input())
A=list(map(int, input().split()))
A.sort()
ans=0
for i in range(N):
    for j in range(i+1,N):
        a,b=A[i],A[j]
        B=A[j+1:]
        l=abs(a-b)
        r=a+b
        # print(bisect_left(B,r)-bisect_right(B,l))
        ans+=bisect_left(B,r)-bisect_right(B,l)
print(ans) from bisect import bisect_left,bisect_right N=int(input()) N int(input()) int input() input A=list(map(int, input().split())) A list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split A.sort() A.sort A sort ans=0 ans 0 for i in range(N):
    for j in range(i+1,N):
        a,b=A[i],A[j]
        B=A[j+1:]
        l=abs(a-b)
        r=a+b
        # print(bisect_left(B,r)-bisect_right(B,l))
        ans+=bisect_left(B,r)-bisect_right(B,l) i range(N) range N for j in range(i+1,N):
        a,b=A[i],A[j]
        B=A[j+1:]
        l=abs(a-b)
        r=a+b
        # print(bisect_left(B,r)-bisect_right(B,l))
        ans+=bisect_left(B,r)-bisect_right(B,l) j range(i+1,N) range i+1 i 1 N a,b=A[i],A[j] a A[i] A i b A[j] A j B=A[j+1:] B A[j+1:] A j+1: j+1 j 1 l=abs(a-b) l abs(a-b) abs a-b a b r=a+b r a+b a b ans+=bisect_left(B,r)-bisect_right(B,l) ans bisect_left(B,r)-bisect_right(B,l) bisect_left(B,r) bisect_left B r bisect_right(B,l) bisect_right B l print(ans) print ans N=int(input()) int(input()) N l=abs(a-b) abs(a-b) l a,b=A[i],A[j] A[i] a b=A[i],A[j] A[j] b B=A[j+1:] A[j+1:] B ans+=bisect_left(B,r)-bisect_right(B,l) bisect_left(B,r)-bisect_right(B,l) ans A=list(map(int, input().split())) list(map(int, input().split())) A ans=0 0 ans r=a+b a+b r
from bisect import bisect_left,bisect_right
N=int(input())
A=list(map(int, input().split()))
A.sort()
ans=0
for i in range(N):
    for j in range(i+1,N):
        a,b=A[i],A[j]
        B=A[j+1:]
        l=abs(a-b)
        r=a+b
        # print(bisect_left(B,r)-bisect_right(B,l))
        ans+=bisect_left(B,r)-bisect_right(B,l)
print(ans)