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