#!/usr/bin/env python3
from bisect import bisect_right

n, *L = map(int, open(0).read().split())
L.sort()
ans = 0
for i in range(n):
    for j in range(i + 1, n):
        ans += (bisect_right(L, L[i] + L[j] - 1) -
                bisect_right(L, L[j] - L[i]) - 1 - (L[j] - L[i] * 2 < 0))
print(ans // 3) from bisect import bisect_right 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):
        ans += (bisect_right(L, L[i] + L[j] - 1) -
                bisect_right(L, L[j] - L[i]) - 1 - (L[j] - L[i] * 2 < 0)) i range(n) range n for j in range(i + 1, n):
        ans += (bisect_right(L, L[i] + L[j] - 1) -
                bisect_right(L, L[j] - L[i]) - 1 - (L[j] - L[i] * 2 < 0)) j range(i + 1, n) range i + 1 i 1 n ans += (bisect_right(L, L[i] + L[j] - 1) -
                bisect_right(L, L[j] - L[i]) - 1 - (L[j] - L[i] * 2 < 0)) ans bisect_right(L, L[i] + L[j] - 1) -
                bisect_right(L, L[j] - L[i]) - 1 - (L[j] - L[i] * 2 < 0) bisect_right(L, L[i] + L[j] - 1) -
                bisect_right(L, L[j] - L[i]) - 1 bisect_right(L, L[i] + L[j] - 1) -
                bisect_right(L, L[j] - L[i]) bisect_right(L, L[i] + L[j] - 1) bisect_right L L[i] + L[j] - 1 L[i] + L[j] L[i] L i L[j] L j 1 bisect_right(L, L[j] - L[i]) bisect_right L L[j] - L[i] L[j] L j L[i] L i 1 L[j] - L[i] * 2 < 0 L[j] - L[i] * 2 L[j] L j L[i] * 2 L[i] L i 2 0 print(ans // 3) print ans // 3 ans 3 n, *L = map(int, open(0).read().split()) map(int, open(0).read().split()) n ans = 0 0 ans ans += (bisect_right(L, L[i] + L[j] - 1) -
                bisect_right(L, L[j] - L[i]) - 1 - (L[j] - L[i] * 2 < 0)) bisect_right(L, L[i] + L[j] - 1) -
                bisect_right(L, L[j] - L[i]) - 1 - (L[j] - L[i] * 2 < 0) ans
#!/usr/bin/env python3
from bisect import bisect_right

n, *L = map(int, open(0).read().split())
L.sort()
ans = 0
for i in range(n):
    for j in range(i + 1, n):
        ans += (bisect_right(L, L[i] + L[j] - 1) -
                bisect_right(L, L[j] - L[i]) - 1 - (L[j] - L[i] * 2 < 0))
print(ans // 3)
