from bisect import bisect_right, bisect_left
n, *l = map(int, open(0).read().split())
l.sort()

ans = 0
for i in range(n):
    for j in range(i + 1, n):
        a = l[i]
        b = l[j]
        # a - b < c
        # b - a < c
        # c < a + b
        # max(a - b, b - a) < c < a + b
        right = bisect_left(l, a + b)
        left = bisect_right(l, max(a - b, b - a))
        tmp = max(0, right - left)
        if left <= i < right:
            tmp -= 1
        if left <= j < right:
            tmp -= 1
        ans += tmp
print(ans // 3) from bisect import bisect_right, bisect_left n, *l = map(int, open(0).read().split()) n map(int, open(0).read().split()) map int open(0).read().split() (0).read().split (0).read() (0).read (0) open 0 read split *l l l.sort() l.sort l sort ans = 0 ans 0 for i in range(n):
    for j in range(i + 1, n):
        a = l[i]
        b = l[j]
        # a - b < c
        # b - a < c
        # c < a + b
        # max(a - b, b - a) < c < a + b
        right = bisect_left(l, a + b)
        left = bisect_right(l, max(a - b, b - a))
        tmp = max(0, right - left)
        if left <= i < right:
            tmp -= 1
        if left <= j < right:
            tmp -= 1
        ans += tmp i range(n) range n for j in range(i + 1, n):
        a = l[i]
        b = l[j]
        # a - b < c
        # b - a < c
        # c < a + b
        # max(a - b, b - a) < c < a + b
        right = bisect_left(l, a + b)
        left = bisect_right(l, max(a - b, b - a))
        tmp = max(0, right - left)
        if left <= i < right:
            tmp -= 1
        if left <= j < right:
            tmp -= 1
        ans += tmp j range(i + 1, n) range i + 1 i 1 n a = l[i] a l[i] l i b = l[j] b l[j] l j right = bisect_left(l, a + b) right bisect_left(l, a + b) bisect_left l a + b a b left = bisect_right(l, max(a - b, b - a)) left bisect_right(l, max(a - b, b - a)) bisect_right l max(a - b, b - a) max a - b a b b - a b a tmp = max(0, right - left) tmp max(0, right - left) max 0 right - left right left if left <= i < right:
            tmp -= 1
         left <= i < right left <= i left i right tmp -= 1 tmp 1 if left <= j < right:
            tmp -= 1
         left <= j < right left <= j left j right tmp -= 1 tmp 1 ans += tmp ans tmp print(ans // 3) print ans // 3 ans 3 tmp -= 1 1 tmp tmp = max(0, right - left) max(0, right - left) tmp ans += tmp tmp ans right = bisect_left(l, a + b) bisect_left(l, a + b) right left = bisect_right(l, max(a - b, b - a)) bisect_right(l, max(a - b, b - a)) left ans = 0 0 ans tmp -= 1 1 tmp b = l[j] l[j] b n, *l = map(int, open(0).read().split()) map(int, open(0).read().split()) n a = l[i] l[i] a
from bisect import bisect_right, bisect_left
n, *l = map(int, open(0).read().split())
l.sort()

ans = 0
for i in range(n):
    for j in range(i + 1, n):
        a = l[i]
        b = l[j]
        # a - b < c
        # b - a < c
        # c < a + b
        # max(a - b, b - a) < c < a + b
        right = bisect_left(l, a + b)
        left = bisect_right(l, max(a - b, b - a))
        tmp = max(0, right - left)
        if left <= i < right:
            tmp -= 1
        if left <= j < right:
            tmp -= 1
        ans += tmp
print(ans // 3)
