import sys, bisect

N = int(input())
L = list(map(int, sys.stdin.readline().rsplit()))
L.sort()

res = 0
for i in reversed(range(1, N)):
    for j in reversed(range(i)):
        r = bisect.bisect_right(L, abs(L[i] - L[j]))
        
        if r < j:
            res += j - r
        
print(res) import sys, bisect sys bisect N = int(input()) N int(input()) int input() input L = list(map(int, sys.stdin.readline().rsplit())) L list(map(int, sys.stdin.readline().rsplit())) list map(int, sys.stdin.readline().rsplit()) map int sys.stdin.readline().rsplit() sys.stdin.readline().rsplit sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline rsplit L.sort() L.sort L sort res = 0 res 0 for i in reversed(range(1, N)):
    for j in reversed(range(i)):
        r = bisect.bisect_right(L, abs(L[i] - L[j]))
        
        if r < j:
            res += j - r
         i reversed(range(1, N)) reversed range(1, N) range 1 N for j in reversed(range(i)):
        r = bisect.bisect_right(L, abs(L[i] - L[j]))
        
        if r < j:
            res += j - r
         j reversed(range(i)) reversed range(i) range i r = bisect.bisect_right(L, abs(L[i] - L[j])) r bisect.bisect_right(L, abs(L[i] - L[j])) bisect.bisect_right bisect bisect_right L abs(L[i] - L[j]) abs L[i] - L[j] L[i] L i L[j] L j if r < j:
            res += j - r
         r < j r j res += j - r res j - r j r print(res) print res N = int(input()) int(input()) N L = list(map(int, sys.stdin.readline().rsplit())) list(map(int, sys.stdin.readline().rsplit())) L res = 0 0 res res += j - r j - r res r = bisect.bisect_right(L, abs(L[i] - L[j])) bisect.bisect_right(L, abs(L[i] - L[j])) r
import sys, bisect

N = int(input())
L = list(map(int, sys.stdin.readline().rsplit()))
L.sort()

res = 0
for i in reversed(range(1, N)):
    for j in reversed(range(i)):
        r = bisect.bisect_right(L, abs(L[i] - L[j]))
        
        if r < j:
            res += j - r
        
print(res)
