from bisect import bisect_left


N, *L = map(int, open(0).read().split())
L.sort()

ans = 0
for i in range(N - 2):
    for j in range(i + 1, N - 1):
        a = L[i]
        b = L[j]
        ans += bisect_left(L, a + b, lo=j + 1) - (j + 1)
print(ans) from bisect import 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 - 2):
    for j in range(i + 1, N - 1):
        a = L[i]
        b = L[j]
        ans += bisect_left(L, a + b, lo=j + 1) - (j + 1) i range(N - 2) range N - 2 N 2 for j in range(i + 1, N - 1):
        a = L[i]
        b = L[j]
        ans += bisect_left(L, a + b, lo=j + 1) - (j + 1) j range(i + 1, N - 1) range i + 1 i 1 N - 1 N 1 a = L[i] a L[i] L i b = L[j] b L[j] L j ans += bisect_left(L, a + b, lo=j + 1) - (j + 1) ans bisect_left(L, a + b, lo=j + 1) - (j + 1) bisect_left(L, a + b, lo=j + 1) bisect_left L a + b a b lo=j + 1 lo j + 1 j 1 j + 1 j 1 print(ans) print ans ans = 0 0 ans ans += bisect_left(L, a + b, lo=j + 1) - (j + 1) bisect_left(L, a + b, lo=j + 1) - (j + 1) ans N, *L = map(int, open(0).read().split()) map(int, open(0).read().split()) N b = L[j] L[j] b a = L[i] L[i] a
from bisect import bisect_left


N, *L = map(int, open(0).read().split())
L.sort()

ans = 0
for i in range(N - 2):
    for j in range(i + 1, N - 1):
        a = L[i]
        b = L[j]
        ans += bisect_left(L, a + b, lo=j + 1) - (j + 1)
print(ans)
