from bisect import bisect_left, bisect_right

n = int(input())
stick = list(map(int, input().split()))
stick.sort()

count = 0
for i in range(n):
    for j in range(i + 1, n):
        l = bisect_left(stick, stick[j] - stick[i] + 1)
        r = bisect_right(stick, stick[i] + stick[j] - 1) - 1
        if r < 0 or l >= n:
            break
        count += r - l + 1
        if l <= i <= r:
            count -= 1
        if l <= j <= r:
            count -= 1
print(count // 3) from bisect import bisect_left, bisect_right n = int(input()) n int(input()) int input() input stick = list(map(int, input().split())) stick list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split stick.sort() stick.sort stick sort count = 0 count 0 for i in range(n):
    for j in range(i + 1, n):
        l = bisect_left(stick, stick[j] - stick[i] + 1)
        r = bisect_right(stick, stick[i] + stick[j] - 1) - 1
        if r < 0 or l >= n:
            break
        count += r - l + 1
        if l <= i <= r:
            count -= 1
        if l <= j <= r:
            count -= 1 i range(n) range n for j in range(i + 1, n):
        l = bisect_left(stick, stick[j] - stick[i] + 1)
        r = bisect_right(stick, stick[i] + stick[j] - 1) - 1
        if r < 0 or l >= n:
            break
        count += r - l + 1
        if l <= i <= r:
            count -= 1
        if l <= j <= r:
            count -= 1 j range(i + 1, n) range i + 1 i 1 n l = bisect_left(stick, stick[j] - stick[i] + 1) l bisect_left(stick, stick[j] - stick[i] + 1) bisect_left stick stick[j] - stick[i] + 1 stick[j] - stick[i] stick[j] stick j stick[i] stick i 1 r = bisect_right(stick, stick[i] + stick[j] - 1) - 1 r bisect_right(stick, stick[i] + stick[j] - 1) - 1 bisect_right(stick, stick[i] + stick[j] - 1) bisect_right stick stick[i] + stick[j] - 1 stick[i] + stick[j] stick[i] stick i stick[j] stick j 1 1 if r < 0 or l >= n:
            break
         r < 0 or l >= n r < 0 r 0 l >= n l n break count += r - l + 1 count r - l + 1 r - l r l 1 if l <= i <= r:
            count -= 1
         l <= i <= r l <= i l i r count -= 1 count 1 if l <= j <= r:
            count -= 1 l <= j <= r l <= j l j r count -= 1 count 1 print(count // 3) print count // 3 count 3 count = 0 0 count count += r - l + 1 r - l + 1 count stick = list(map(int, input().split())) list(map(int, input().split())) stick n = int(input()) int(input()) n count -= 1 1 count l = bisect_left(stick, stick[j] - stick[i] + 1) bisect_left(stick, stick[j] - stick[i] + 1) l r = bisect_right(stick, stick[i] + stick[j] - 1) - 1 bisect_right(stick, stick[i] + stick[j] - 1) - 1 r count -= 1 1 count
from bisect import bisect_left, bisect_right

n = int(input())
stick = list(map(int, input().split()))
stick.sort()

count = 0
for i in range(n):
    for j in range(i + 1, n):
        l = bisect_left(stick, stick[j] - stick[i] + 1)
        r = bisect_right(stick, stick[i] + stick[j] - 1) - 1
        if r < 0 or l >= n:
            break
        count += r - l + 1
        if l <= i <= r:
            count -= 1
        if l <= j <= r:
            count -= 1
print(count // 3)