N = int(input())
L = sorted([int(i) for i in input().split()])
count = 0

from bisect import bisect_left as bi

for j in range(N):
    for k in range(j + 1,N - 1):
        right = L[j] + L[k]
        ite_right = bi(L,right)
        count = count + (ite_right - k - 1)

print(count)  N = int(input()) N int(input()) int input() input int(i) for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() int(i) int i L = sorted([int(i) for i in input().split()]) L sorted([int(i) for i in input().split()]) sorted [int(i) for i in input().split()] count = 0 count 0 from bisect import bisect_left as bi for j in range(N):
    for k in range(j + 1,N - 1):
        right = L[j] + L[k]
        ite_right = bi(L,right)
        count = count + (ite_right - k - 1) j range(N) range N for k in range(j + 1,N - 1):
        right = L[j] + L[k]
        ite_right = bi(L,right)
        count = count + (ite_right - k - 1) k range(j + 1,N - 1) range j + 1 j 1 N - 1 N 1 right = L[j] + L[k] right L[j] + L[k] L[j] L j L[k] L k ite_right = bi(L,right) ite_right bi(L,right) bi L right count = count + (ite_right - k - 1) count count + (ite_right - k - 1) count ite_right - k - 1 ite_right - k ite_right k 1 print(count) print count count = 0 0 count count = count + (ite_right - k - 1) count + (ite_right - k - 1) count right = L[j] + L[k] L[j] + L[k] right ite_right = bi(L,right) bi(L,right) ite_right N = int(input()) int(input()) N L = sorted([int(i) for i in input().split()]) sorted([int(i) for i in input().split()]) L
N = int(input())
L = sorted([int(i) for i in input().split()])
count = 0

from bisect import bisect_left as bi

for j in range(N):
    for k in range(j + 1,N - 1):
        right = L[j] + L[k]
        ite_right = bi(L,right)
        count = count + (ite_right - k - 1)

print(count) 