
from bisect import bisect_left

N = int(input())
X = list(map(int, input().split()))

X.sort()
ans = 0
for i in range(N):
    for j in range(i + 1, N):
        k = bisect_left(X, X[i] + X[j])
        ans += k - j - 1

print(ans) from bisect import bisect_left N = int(input()) N int(input()) int input() input X = list(map(int, input().split())) X list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split X.sort() X.sort X sort ans = 0 ans 0 for i in range(N):
    for j in range(i + 1, N):
        k = bisect_left(X, X[i] + X[j])
        ans += k - j - 1 i range(N) range N for j in range(i + 1, N):
        k = bisect_left(X, X[i] + X[j])
        ans += k - j - 1 j range(i + 1, N) range i + 1 i 1 N k = bisect_left(X, X[i] + X[j]) k bisect_left(X, X[i] + X[j]) bisect_left X X[i] + X[j] X[i] X i X[j] X j ans += k - j - 1 ans k - j - 1 k - j k j 1 print(ans) print ans N = int(input()) int(input()) N ans = 0 0 ans k = bisect_left(X, X[i] + X[j]) bisect_left(X, X[i] + X[j]) k ans += k - j - 1 k - j - 1 ans X = list(map(int, input().split())) list(map(int, input().split())) X

from bisect import bisect_left

N = int(input())
X = list(map(int, input().split()))

X.sort()
ans = 0
for i in range(N):
    for j in range(i + 1, N):
        k = bisect_left(X, X[i] + X[j])
        ans += k - j - 1

print(ans)
