import bisect
n=int(input())
a=sorted(list(map(int,input().split())))
cnt=0
for i in range(n):
    for j in range(i+1,n):
        cnt+=bisect.bisect_left(a,a[i]+a[j])-(j+1)
print(cnt) import bisect bisect n=int(input()) n int(input()) int input() input a=sorted(list(map(int,input().split()))) a sorted(list(map(int,input().split()))) sorted list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split cnt=0 cnt 0 for i in range(n):
    for j in range(i+1,n):
        cnt+=bisect.bisect_left(a,a[i]+a[j])-(j+1) i range(n) range n for j in range(i+1,n):
        cnt+=bisect.bisect_left(a,a[i]+a[j])-(j+1) j range(i+1,n) range i+1 i 1 n cnt+=bisect.bisect_left(a,a[i]+a[j])-(j+1) cnt bisect.bisect_left(a,a[i]+a[j])-(j+1) bisect.bisect_left(a,a[i]+a[j]) bisect.bisect_left bisect bisect_left a a[i]+a[j] a[i] a i a[j] a j j+1 j 1 print(cnt) print cnt cnt=0 0 cnt n=int(input()) int(input()) n cnt+=bisect.bisect_left(a,a[i]+a[j])-(j+1) bisect.bisect_left(a,a[i]+a[j])-(j+1) cnt a=sorted(list(map(int,input().split()))) sorted(list(map(int,input().split()))) a
import bisect
n=int(input())
a=sorted(list(map(int,input().split())))
cnt=0
for i in range(n):
    for j in range(i+1,n):
        cnt+=bisect.bisect_left(a,a[i]+a[j])-(j+1)
print(cnt)