from bisect import bisect_left

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

#aを1番短い辺、bを2番めに短い辺とする
cnt = 0
for i in range(n-2):
    for j in range(i+1, n-1):
        c_i = bisect_left(l, l[i] + l[j])
        cnt += c_i - (j+1)

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

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

#aを1番短い辺、bを2番めに短い辺とする
cnt = 0
for i in range(n-2):
    for j in range(i+1, n-1):
        c_i = bisect_left(l, l[i] + l[j])
        cnt += c_i - (j+1)

print(cnt)