import bisect
N = int(input())
L = sorted(map(int, input().split()))
ans = 0
for i in range(N - 2):
    a = L[i]
    for j in range(i + 1, N - 1):
        b = L[j]
        kmin = bisect.bisect_left(L, (b - a), j + 1)
        kmax = bisect.bisect_left(L, (a + b), j + 1)
        ans += (kmax - kmin)
print(ans) import bisect bisect N = int(input()) N int(input()) int input() input L = sorted(map(int, input().split())) L sorted(map(int, input().split())) sorted map(int, input().split()) map int input().split() ().split () input split ans = 0 ans 0 for i in range(N - 2):
    a = L[i]
    for j in range(i + 1, N - 1):
        b = L[j]
        kmin = bisect.bisect_left(L, (b - a), j + 1)
        kmax = bisect.bisect_left(L, (a + b), j + 1)
        ans += (kmax - kmin) i range(N - 2) range N - 2 N 2 a = L[i] a L[i] L i for j in range(i + 1, N - 1):
        b = L[j]
        kmin = bisect.bisect_left(L, (b - a), j + 1)
        kmax = bisect.bisect_left(L, (a + b), j + 1)
        ans += (kmax - kmin) j range(i + 1, N - 1) range i + 1 i 1 N - 1 N 1 b = L[j] b L[j] L j kmin = bisect.bisect_left(L, (b - a), j + 1) kmin bisect.bisect_left(L, (b - a), j + 1) bisect.bisect_left bisect bisect_left L b - a b a j + 1 j 1 kmax = bisect.bisect_left(L, (a + b), j + 1) kmax bisect.bisect_left(L, (a + b), j + 1) bisect.bisect_left bisect bisect_left L a + b a b j + 1 j 1 ans += (kmax - kmin) ans kmax - kmin kmax kmin print(ans) print ans kmin = bisect.bisect_left(L, (b - a), j + 1) bisect.bisect_left(L, (b - a), j + 1) kmin L = sorted(map(int, input().split())) sorted(map(int, input().split())) L b = L[j] L[j] b a = L[i] L[i] a kmax = bisect.bisect_left(L, (a + b), j + 1) bisect.bisect_left(L, (a + b), j + 1) kmax ans = 0 0 ans N = int(input()) int(input()) N ans += (kmax - kmin) kmax - kmin ans
import bisect
N = int(input())
L = sorted(map(int, input().split()))
ans = 0
for i in range(N - 2):
    a = L[i]
    for j in range(i + 1, N - 1):
        b = L[j]
        kmin = bisect.bisect_left(L, (b - a), j + 1)
        kmax = bisect.bisect_left(L, (a + b), j + 1)
        ans += (kmax - kmin)
print(ans)