import bisect

n = int(input())
arr = list(map(int,input().split()))

arr.sort()
ans = 0
for i in range(n):
    for j in range(i+1,n):
        a,b = arr[i],arr[j]

        cmin = abs(a-b)
        cmax = a+b

        l = bisect.bisect_left(arr,cmin+1,lo=j+1)
        r = bisect.bisect_right(arr,cmax-1,lo=j+1)
        # print(cmin,l,cmax,r)
        if r-l > 0:
            ans += r-l

print(ans) import bisect bisect n = int(input()) n int(input()) int input() input arr = list(map(int,input().split())) arr list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split arr.sort() arr.sort arr sort ans = 0 ans 0 for i in range(n):
    for j in range(i+1,n):
        a,b = arr[i],arr[j]

        cmin = abs(a-b)
        cmax = a+b

        l = bisect.bisect_left(arr,cmin+1,lo=j+1)
        r = bisect.bisect_right(arr,cmax-1,lo=j+1)
        # print(cmin,l,cmax,r)
        if r-l > 0:
            ans += r-l i range(n) range n for j in range(i+1,n):
        a,b = arr[i],arr[j]

        cmin = abs(a-b)
        cmax = a+b

        l = bisect.bisect_left(arr,cmin+1,lo=j+1)
        r = bisect.bisect_right(arr,cmax-1,lo=j+1)
        # print(cmin,l,cmax,r)
        if r-l > 0:
            ans += r-l j range(i+1,n) range i+1 i 1 n a,b = arr[i],arr[j] a arr[i] arr i b arr[j] arr j cmin = abs(a-b) cmin abs(a-b) abs a-b a b cmax = a+b cmax a+b a b l = bisect.bisect_left(arr,cmin+1,lo=j+1) l bisect.bisect_left(arr,cmin+1,lo=j+1) bisect.bisect_left bisect bisect_left arr cmin+1 cmin 1 lo=j+1 lo j+1 j 1 r = bisect.bisect_right(arr,cmax-1,lo=j+1) r bisect.bisect_right(arr,cmax-1,lo=j+1) bisect.bisect_right bisect bisect_right arr cmax-1 cmax 1 lo=j+1 lo j+1 j 1 if r-l > 0:
            ans += r-l r-l > 0 r-l r l 0 ans += r-l ans r-l r l print(ans) print ans arr = list(map(int,input().split())) list(map(int,input().split())) arr b = arr[i],arr[j] arr[j] b a,b = arr[i],arr[j] arr[i] a r = bisect.bisect_right(arr,cmax-1,lo=j+1) bisect.bisect_right(arr,cmax-1,lo=j+1) r cmax = a+b a+b cmax ans = 0 0 ans n = int(input()) int(input()) n cmin = abs(a-b) abs(a-b) cmin l = bisect.bisect_left(arr,cmin+1,lo=j+1) bisect.bisect_left(arr,cmin+1,lo=j+1) l ans += r-l r-l ans
import bisect

n = int(input())
arr = list(map(int,input().split()))

arr.sort()
ans = 0
for i in range(n):
    for j in range(i+1,n):
        a,b = arr[i],arr[j]

        cmin = abs(a-b)
        cmax = a+b

        l = bisect.bisect_left(arr,cmin+1,lo=j+1)
        r = bisect.bisect_right(arr,cmax-1,lo=j+1)
        # print(cmin,l,cmax,r)
        if r-l > 0:
            ans += r-l

print(ans)
