from bisect import bisect_right

N = int(input())
L = list(map(int, input().split()))
L.sort()
ans = 0
for i in range(N):
    for j in range(i + 1, N):
        b = L[i]
        c = L[j]
        M = L[i+1:j]
        ans += bisect_right(M, b + c - 1) - bisect_right(M, c - b)
print(ans) from bisect import bisect_right N = int(input()) N int(input()) int input() input L = list(map(int, input().split())) L list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split L.sort() L.sort L sort ans = 0 ans 0 for i in range(N):
    for j in range(i + 1, N):
        b = L[i]
        c = L[j]
        M = L[i+1:j]
        ans += bisect_right(M, b + c - 1) - bisect_right(M, c - b) i range(N) range N for j in range(i + 1, N):
        b = L[i]
        c = L[j]
        M = L[i+1:j]
        ans += bisect_right(M, b + c - 1) - bisect_right(M, c - b) j range(i + 1, N) range i + 1 i 1 N b = L[i] b L[i] L i c = L[j] c L[j] L j M = L[i+1:j] M L[i+1:j] L i+1:j i+1 i 1 j ans += bisect_right(M, b + c - 1) - bisect_right(M, c - b) ans bisect_right(M, b + c - 1) - bisect_right(M, c - b) bisect_right(M, b + c - 1) bisect_right M b + c - 1 b + c b c 1 bisect_right(M, c - b) bisect_right M c - b c b print(ans) print ans M = L[i+1:j] L[i+1:j] M ans += bisect_right(M, b + c - 1) - bisect_right(M, c - b) bisect_right(M, b + c - 1) - bisect_right(M, c - b) ans ans = 0 0 ans c = L[j] L[j] c N = int(input()) int(input()) N L = list(map(int, input().split())) list(map(int, input().split())) L b = L[i] L[i] b
from bisect import bisect_right

N = int(input())
L = list(map(int, input().split()))
L.sort()
ans = 0
for i in range(N):
    for j in range(i + 1, N):
        b = L[i]
        c = L[j]
        M = L[i+1:j]
        ans += bisect_right(M, b + c - 1) - bisect_right(M, c - b)
print(ans)