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

l = sorted(l)

import bisect
ans = 0

for i in range(n - 1):
    for j in range(i + 1, n):
        a = l[i]
        b = l[j]
        c = bisect.bisect_left(l,a+b)
        ans += c - j - 1

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

l = sorted(l)

import bisect
ans = 0

for i in range(n - 1):
    for j in range(i + 1, n):
        a = l[i]
        b = l[j]
        c = bisect.bisect_left(l,a+b)
        ans += c - j - 1

print(ans)