import bisect

N = int(input())
L = sorted([int(n) for n in input().split()])
#print(L)

count = 0
for i in range(N-1):
    b = L[:i]
    c = L[i+1:]
    for j in b:
        count += bisect.bisect_left(c, L[i] + j)

print(count) import bisect bisect N = int(input()) N int(input()) int input() input int(n) for n in input().split() for n in input().split() n input().split() ().split () input split for n in input().split() int(n) int n L = sorted([int(n) for n in input().split()]) L sorted([int(n) for n in input().split()]) sorted [int(n) for n in input().split()] count = 0 count 0 for i in range(N-1):
    b = L[:i]
    c = L[i+1:]
    for j in b:
        count += bisect.bisect_left(c, L[i] + j) i range(N-1) range N-1 N 1 b = L[:i] b L[:i] L :i i c = L[i+1:] c L[i+1:] L i+1: i+1 i 1 for j in b:
        count += bisect.bisect_left(c, L[i] + j) j b count += bisect.bisect_left(c, L[i] + j) count bisect.bisect_left(c, L[i] + j) bisect.bisect_left bisect bisect_left c L[i] + j L[i] L i j print(count) print count N = int(input()) int(input()) N c = L[i+1:] L[i+1:] c count += bisect.bisect_left(c, L[i] + j) bisect.bisect_left(c, L[i] + j) count b = L[:i] L[:i] b count = 0 0 count L = sorted([int(n) for n in input().split()]) sorted([int(n) for n in input().split()]) L
import bisect

N = int(input())
L = sorted([int(n) for n in input().split()])
#print(L)

count = 0
for i in range(N-1):
    b = L[:i]
    c = L[i+1:]
    for j in b:
        count += bisect.bisect_left(c, L[i] + j)

print(count)