n = int(input())
a_ls = list(map(int, input().split()))
def isOK(a,b,c):
    return abs(a-b) < c < a+b
a_ls.sort()
ans = 0
for i in range(n):
    short = a_ls[i]
    r = i+1
    num = 0
    for l in range(i+1,n-1):
        while r+1 < n and isOK(short, a_ls[l], a_ls[r+1]):
            r += 1
        num += r - l
        if l == r:
            r += 1
    ans += num
print(ans) n = int(input()) n int(input()) int input() input a_ls = list(map(int, input().split())) a_ls list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split def isOK(a,b,c):
    return abs(a-b) < c < a+b isOK return abs(a-b) < c < a+b abs(a-b) < c < a+b abs(a-b) < c abs(a-b) abs a-b a b c a+b a b a a b b c c a_ls.sort() a_ls.sort a_ls sort ans = 0 ans 0 for i in range(n):
    short = a_ls[i]
    r = i+1
    num = 0
    for l in range(i+1,n-1):
        while r+1 < n and isOK(short, a_ls[l], a_ls[r+1]):
            r += 1
        num += r - l
        if l == r:
            r += 1
    ans += num i range(n) range n short = a_ls[i] short a_ls[i] a_ls i r = i+1 r i+1 i 1 num = 0 num 0 for l in range(i+1,n-1):
        while r+1 < n and isOK(short, a_ls[l], a_ls[r+1]):
            r += 1
        num += r - l
        if l == r:
            r += 1
     l range(i+1,n-1) range i+1 i 1 n-1 n 1 while r+1 < n and isOK(short, a_ls[l], a_ls[r+1]):
            r += 1
         r+1 < n and isOK(short, a_ls[l], a_ls[r+1]) r+1 < n r+1 r 1 n isOK(short, a_ls[l], a_ls[r+1]) isOK short a_ls[l] a_ls l a_ls[r+1] a_ls r+1 r 1 r += 1 r 1 num += r - l num r - l r l if l == r:
            r += 1
     l == r l r r += 1 r 1 ans += num ans num print(ans) print ans r += 1 1 r n = int(input()) int(input()) n def isOK(a,b,c):
    return abs(a-b) < c < a+b def isOK(a,b,c):
    return abs(a-b) < c < a+b isOK num = 0 0 num ans += num num ans ans = 0 0 ans r += 1 1 r num += r - l r - l num a_ls = list(map(int, input().split())) list(map(int, input().split())) a_ls short = a_ls[i] a_ls[i] short r = i+1 i+1 r
n = int(input())
a_ls = list(map(int, input().split()))
def isOK(a,b,c):
    return abs(a-b) < c < a+b
a_ls.sort()
ans = 0
for i in range(n):
    short = a_ls[i]
    r = i+1
    num = 0
    for l in range(i+1,n-1):
        while r+1 < n and isOK(short, a_ls[l], a_ls[r+1]):
            r += 1
        num += r - l
        if l == r:
            r += 1
    ans += num
print(ans)