import sys
input = sys.stdin.readline
from bisect import bisect_left

n, res = int(input()), 0
s = sorted(list(map(int, input().split())))
for i in range(n-1):
    for j in range(i+1, n):
        res += (bisect_left(s, s[i] + s[j])) - (j + 1)
print(res) import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline from bisect import bisect_left n, res = int(input()), 0 n int(input()) int input() input res 0 s = sorted(list(map(int, input().split()))) s sorted(list(map(int, input().split()))) sorted list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split for i in range(n-1):
    for j in range(i+1, n):
        res += (bisect_left(s, s[i] + s[j])) - (j + 1) i range(n-1) range n-1 n 1 for j in range(i+1, n):
        res += (bisect_left(s, s[i] + s[j])) - (j + 1) j range(i+1, n) range i+1 i 1 n res += (bisect_left(s, s[i] + s[j])) - (j + 1) res (bisect_left(s, s[i] + s[j])) - (j + 1) bisect_left(s, s[i] + s[j]) bisect_left s s[i] + s[j] s[i] s i s[j] s j j + 1 j 1 print(res) print res res += (bisect_left(s, s[i] + s[j])) - (j + 1) (bisect_left(s, s[i] + s[j])) - (j + 1) res n, res = int(input()), 0 int(input()) n res = int(input()), 0 0 res input = sys.stdin.readline sys.stdin.readline input s = sorted(list(map(int, input().split()))) sorted(list(map(int, input().split()))) s
import sys
input = sys.stdin.readline
from bisect import bisect_left

n, res = int(input()), 0
s = sorted(list(map(int, input().split())))
for i in range(n-1):
    for j in range(i+1, n):
        res += (bisect_left(s, s[i] + s[j])) - (j + 1)
print(res)