n = int(input())
L = list(map(int,input().split()))
L = sorted(L)
import bisect
ans = 0
for i in range(n-2):
    for j in range(i+1,n-1):
        a = bisect.bisect_left(L,L[i]+L[j])
        ans += a-j-1
print(ans) 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 = sorted(L) L sorted(L) sorted L import bisect bisect ans = 0 ans 0 for i in range(n-2):
    for j in range(i+1,n-1):
        a = bisect.bisect_left(L,L[i]+L[j])
        ans += a-j-1 i range(n-2) range n-2 n 2 for j in range(i+1,n-1):
        a = bisect.bisect_left(L,L[i]+L[j])
        ans += a-j-1 j range(i+1,n-1) range i+1 i 1 n-1 n 1 a = bisect.bisect_left(L,L[i]+L[j]) a bisect.bisect_left(L,L[i]+L[j]) bisect.bisect_left bisect bisect_left L L[i]+L[j] L[i] L i L[j] L j ans += a-j-1 ans a-j-1 a-j a j 1 print(ans) print ans a = bisect.bisect_left(L,L[i]+L[j]) bisect.bisect_left(L,L[i]+L[j]) a n = int(input()) int(input()) n ans = 0 0 ans L = list(map(int,input().split())) list(map(int,input().split())) L ans += a-j-1 a-j-1 ans L = sorted(L) sorted(L) L
n = int(input())
L = list(map(int,input().split()))
L = sorted(L)
import bisect
ans = 0
for i in range(n-2):
    for j in range(i+1,n-1):
        a = bisect.bisect_left(L,L[i]+L[j])
        ans += a-j-1
print(ans)