import bisect
N = int(input())
ls = list(map(int,input().split()))
ls.sort()
ans = 0
for i in range(N-2):
    for j in range(i+1,N-1):
        ls1 = ls[j+1:]
        ans += bisect.bisect_left(ls1,ls[j]+ls[i])-bisect.bisect(ls1,ls[j]-ls[i])
print(ans) import bisect bisect N = int(input()) N int(input()) int input() input ls = list(map(int,input().split())) ls list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split ls.sort() ls.sort ls sort ans = 0 ans 0 for i in range(N-2):
    for j in range(i+1,N-1):
        ls1 = ls[j+1:]
        ans += bisect.bisect_left(ls1,ls[j]+ls[i])-bisect.bisect(ls1,ls[j]-ls[i]) i range(N-2) range N-2 N 2 for j in range(i+1,N-1):
        ls1 = ls[j+1:]
        ans += bisect.bisect_left(ls1,ls[j]+ls[i])-bisect.bisect(ls1,ls[j]-ls[i]) j range(i+1,N-1) range i+1 i 1 N-1 N 1 ls1 = ls[j+1:] ls1 ls[j+1:] ls j+1: j+1 j 1 ans += bisect.bisect_left(ls1,ls[j]+ls[i])-bisect.bisect(ls1,ls[j]-ls[i]) ans bisect.bisect_left(ls1,ls[j]+ls[i])-bisect.bisect(ls1,ls[j]-ls[i]) bisect.bisect_left(ls1,ls[j]+ls[i]) bisect.bisect_left bisect bisect_left ls1 ls[j]+ls[i] ls[j] ls j ls[i] ls i bisect.bisect(ls1,ls[j]-ls[i]) bisect.bisect bisect bisect ls1 ls[j]-ls[i] ls[j] ls j ls[i] ls i print(ans) print ans ls1 = ls[j+1:] ls[j+1:] ls1 ans = 0 0 ans ls = list(map(int,input().split())) list(map(int,input().split())) ls N = int(input()) int(input()) N ans += bisect.bisect_left(ls1,ls[j]+ls[i])-bisect.bisect(ls1,ls[j]-ls[i]) bisect.bisect_left(ls1,ls[j]+ls[i])-bisect.bisect(ls1,ls[j]-ls[i]) ans
import bisect
N = int(input())
ls = list(map(int,input().split()))
ls.sort()
ans = 0
for i in range(N-2):
    for j in range(i+1,N-1):
        ls1 = ls[j+1:]
        ans += bisect.bisect_left(ls1,ls[j]+ls[i])-bisect.bisect(ls1,ls[j]-ls[i])
print(ans)