N=int(input())
L=list(map(int,input().split()))
ans=0
c=[0]*1001
for i in L:c[i]+=1
for i in range(1000):c[i+1]=c[i]+c[i+1]
for i in range(N-1):
    for j in range(i+1,N):
        l,r=abs(L[i]-L[j]),min(L[i]+L[j]-1,1000)
        ans+=c[r]-c[l]
        if l<L[i] and L[i]<=r:ans-=1
        if l<L[j] and L[j]<=r:ans-=1
print(ans//3) 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 ans=0 ans 0 c=[0]*1001 c [0]*1001 [0] 0 1001 for i in L:c[i]+=1 i L for i in range(1000):c[i+1]=c[i]+c[i+1] i range(1000) range 1000 for i in range(N-1):
    for j in range(i+1,N):
        l,r=abs(L[i]-L[j]),min(L[i]+L[j]-1,1000)
        ans+=c[r]-c[l]
        if l<L[i] and L[i]<=r:ans-=1
        if l<L[j] and L[j]<=r:ans-=1 i range(N-1) range N-1 N 1 for j in range(i+1,N):
        l,r=abs(L[i]-L[j]),min(L[i]+L[j]-1,1000)
        ans+=c[r]-c[l]
        if l<L[i] and L[i]<=r:ans-=1
        if l<L[j] and L[j]<=r:ans-=1 j range(i+1,N) range i+1 i 1 N l,r=abs(L[i]-L[j]),min(L[i]+L[j]-1,1000) l abs(L[i]-L[j]) abs L[i]-L[j] L[i] L i L[j] L j r min(L[i]+L[j]-1,1000) min L[i]+L[j]-1 L[i]+L[j] L[i] L i L[j] L j 1 1000 ans+=c[r]-c[l] ans c[r]-c[l] c[r] c r c[l] c l if l<L[i] and L[i]<=r:ans-=1
         l<L[i] and L[i]<=r l<L[i] l L[i] L i L[i]<=r L[i] L i r if l<L[j] and L[j]<= l<L[j] and L[j]<=r l<L[j] l L[j] L j L[j]<=r L[j] L j r print(ans//3) print ans//3 ans 3 ans+=c[r]-c[l] c[r]-c[l] ans l,r=abs(L[i]-L[j]),min(L[i]+L[j]-1,1000) abs(L[i]-L[j]) l ans=0 0 ans L=list(map(int,input().split())) list(map(int,input().split())) L r=abs(L[i]-L[j]),min(L[i]+L[j]-1,1000) min(L[i]+L[j]-1,1000) r c=[0]*1001 [0]*1001 c N=int(input()) int(input()) N
N=int(input())
L=list(map(int,input().split()))
ans=0
c=[0]*1001
for i in L:c[i]+=1
for i in range(1000):c[i+1]=c[i]+c[i+1]
for i in range(N-1):
    for j in range(i+1,N):
        l,r=abs(L[i]-L[j]),min(L[i]+L[j]-1,1000)
        ans+=c[r]-c[l]
        if l<L[i] and L[i]<=r:ans-=1
        if l<L[j] and L[j]<=r:ans-=1
print(ans//3)