import sys
input = sys.stdin.buffer.readline

n = int(input())
l = list(map(int,input().split()))
l.sort()
mx = l[-1]+l[-2]

length = [0]*(mx+1)
for i in range(n):
    for j in range(i+1,n):
        length[l[i]+l[j]] -= 1
        length[l[j]-l[i]+1] += 1

for i in range(1,mx+1):
    length[i] += length[i-1]

minus = [0]*n
for i in range(n):
    a = i
    for j in range(i+1,n):
        if l[i]*2 - 1 >= l[j]:
            a += 1
    minus[i] = a
#print(length)
#print(minus)
ans = 0
for i in range(n):
    ans += length[l[i]] - minus[i]


print(ans//3) import sys sys input = sys.stdin.buffer.readline input sys.stdin.buffer.readline sys.stdin.buffer sys.stdin sys stdin buffer readline n = int(input()) n int(input()) int input() input l = list(map(int,input().split())) l list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split l.sort() l.sort l sort mx = l[-1]+l[-2] mx l[-1]+l[-2] l[-1] l -1 l[-2] l -2 length = [0]*(mx+1) length [0]*(mx+1) [0] 0 mx+1 mx 1 for i in range(n):
    for j in range(i+1,n):
        length[l[i]+l[j]] -= 1
        length[l[j]-l[i]+1] += 1 i range(n) range n for j in range(i+1,n):
        length[l[i]+l[j]] -= 1
        length[l[j]-l[i]+1] += 1 j range(i+1,n) range i+1 i 1 n length[l[i]+l[j]] -= 1 length[l[i]+l[j]] length l[i]+l[j] l[i] l i l[j] l j 1 length[l[j]-l[i]+1] += 1 length[l[j]-l[i]+1] length l[j]-l[i]+1 l[j]-l[i] l[j] l j l[i] l i 1 1 for i in range(1,mx+1):
    length[i] += length[i-1] i range(1,mx+1) range 1 mx+1 mx 1 length[i] += length[i-1] length[i] length i length[i-1] length i-1 i 1 minus = [0]*n minus [0]*n [0] 0 n for i in range(n):
    a = i
    for j in range(i+1,n):
        if l[i]*2 - 1 >= l[j]:
            a += 1
    minus[i] = a
#print(length)
#print(minus) i range(n) range n a = i a i for j in range(i+1,n):
        if l[i]*2 - 1 >= l[j]:
            a += 1
     j range(i+1,n) range i+1 i 1 n if l[i]*2 - 1 >= l[j]:
            a += 1
     l[i]*2 - 1 >= l[j] l[i]*2 - 1 l[i]*2 l[i] l i 2 1 l[j] l j a += 1 a 1 minus[i] = a minus[i] minus i a ans = 0 ans 0 for i in range(n):
    ans += length[l[i]] - minus[i] i range(n) range n ans += length[l[i]] - minus[i] ans length[l[i]] - minus[i] length[l[i]] length l[i] l i minus[i] minus i print(ans//3) print ans//3 ans 3 minus = [0]*n [0]*n minus l = list(map(int,input().split())) list(map(int,input().split())) l mx = l[-1]+l[-2] l[-1]+l[-2] mx input = sys.stdin.buffer.readline sys.stdin.buffer.readline input ans = 0 0 ans length = [0]*(mx+1) [0]*(mx+1) length a += 1 1 a n = int(input()) int(input()) n ans += length[l[i]] - minus[i] length[l[i]] - minus[i] ans a = i i a
import sys
input = sys.stdin.buffer.readline

n = int(input())
l = list(map(int,input().split()))
l.sort()
mx = l[-1]+l[-2]

length = [0]*(mx+1)
for i in range(n):
    for j in range(i+1,n):
        length[l[i]+l[j]] -= 1
        length[l[j]-l[i]+1] += 1

for i in range(1,mx+1):
    length[i] += length[i-1]

minus = [0]*n
for i in range(n):
    a = i
    for j in range(i+1,n):
        if l[i]*2 - 1 >= l[j]:
            a += 1
    minus[i] = a
#print(length)
#print(minus)
ans = 0
for i in range(n):
    ans += length[l[i]] - minus[i]


print(ans//3)