import sys
from bisect import bisect_left,bisect_right

sys.setrecursionlimit(10**7)
input = sys.stdin.readline

N = int(input())
L = list(map(int, input().split()))
L.sort()

ans = 0
for b in range(N):
    for a in range(b):
        ab = L[a] + L[b]
        r = bisect_left(L, ab)
        l = b + 1
        ans += max(0, r - l)

print(ans) import sys sys from bisect import bisect_left,bisect_right sys.setrecursionlimit(10**7) sys.setrecursionlimit sys setrecursionlimit 10**7 10 7 input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline N = int(input()) N int(input()) int input() input L = list(map(int, input().split())) L list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split L.sort() L.sort L sort ans = 0 ans 0 for b in range(N):
    for a in range(b):
        ab = L[a] + L[b]
        r = bisect_left(L, ab)
        l = b + 1
        ans += max(0, r - l) b range(N) range N for a in range(b):
        ab = L[a] + L[b]
        r = bisect_left(L, ab)
        l = b + 1
        ans += max(0, r - l) a range(b) range b ab = L[a] + L[b] ab L[a] + L[b] L[a] L a L[b] L b r = bisect_left(L, ab) r bisect_left(L, ab) bisect_left L ab l = b + 1 l b + 1 b 1 ans += max(0, r - l) ans max(0, r - l) max 0 r - l r l print(ans) print ans l = b + 1 b + 1 l ab = L[a] + L[b] L[a] + L[b] ab ans += max(0, r - l) max(0, r - l) ans input = sys.stdin.readline sys.stdin.readline input N = int(input()) int(input()) N L = list(map(int, input().split())) list(map(int, input().split())) L ans = 0 0 ans r = bisect_left(L, ab) bisect_left(L, ab) r
import sys
from bisect import bisect_left,bisect_right

sys.setrecursionlimit(10**7)
input = sys.stdin.readline

N = int(input())
L = list(map(int, input().split()))
L.sort()

ans = 0
for b in range(N):
    for a in range(b):
        ab = L[a] + L[b]
        r = bisect_left(L, ab)
        l = b + 1
        ans += max(0, r - l)

print(ans)
