from bisect import bisect_left

n = int(input())
L = sorted(list(map(int, input().split())))

# 二分探索
cnt = 0
for i in range(n):
    for j in range(i+1, n):
        a, b = L[i], L[j]
        # c < a + b
        r = bisect_left(L, a+b)
        l = j+1
        cnt += max(0, r-l)
print(cnt) from bisect import bisect_left n = int(input()) n int(input()) int input() input L = sorted(list(map(int, input().split()))) L sorted(list(map(int, input().split()))) sorted list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split cnt = 0 cnt 0 for i in range(n):
    for j in range(i+1, n):
        a, b = L[i], L[j]
        # c < a + b
        r = bisect_left(L, a+b)
        l = j+1
        cnt += max(0, r-l) i range(n) range n for j in range(i+1, n):
        a, b = L[i], L[j]
        # c < a + b
        r = bisect_left(L, a+b)
        l = j+1
        cnt += max(0, r-l) j range(i+1, n) range i+1 i 1 n a, b = L[i], L[j] a L[i] L i b L[j] L j r = bisect_left(L, a+b) r bisect_left(L, a+b) bisect_left L a+b a b l = j+1 l j+1 j 1 cnt += max(0, r-l) cnt max(0, r-l) max 0 r-l r l print(cnt) print cnt cnt += max(0, r-l) max(0, r-l) cnt n = int(input()) int(input()) n L = sorted(list(map(int, input().split()))) sorted(list(map(int, input().split()))) L a, b = L[i], L[j] L[i] a l = j+1 j+1 l r = bisect_left(L, a+b) bisect_left(L, a+b) r cnt = 0 0 cnt b = L[i], L[j] L[j] b
from bisect import bisect_left

n = int(input())
L = sorted(list(map(int, input().split())))

# 二分探索
cnt = 0
for i in range(n):
    for j in range(i+1, n):
        a, b = L[i], L[j]
        # c < a + b
        r = bisect_left(L, a+b)
        l = j+1
        cnt += max(0, r-l)
print(cnt)