import bisect

N = int(input())
L = sorted(map(int, input().split(' ')))

ans = 0
for i in range(len(L)):
    for j in range(i + 1, len(L)):
        a = L[i]
        b = L[j]
        ans += max(0, bisect.bisect_right(L, a + b - 1) - (j + 1))

print(ans) import bisect bisect N = int(input()) N int(input()) int input() input L = sorted(map(int, input().split(' '))) L sorted(map(int, input().split(' '))) sorted map(int, input().split(' ')) map int input().split(' ') ().split () input split ' ' ans = 0 ans 0 for i in range(len(L)):
    for j in range(i + 1, len(L)):
        a = L[i]
        b = L[j]
        ans += max(0, bisect.bisect_right(L, a + b - 1) - (j + 1)) i range(len(L)) range len(L) len L for j in range(i + 1, len(L)):
        a = L[i]
        b = L[j]
        ans += max(0, bisect.bisect_right(L, a + b - 1) - (j + 1)) j range(i + 1, len(L)) range i + 1 i 1 len(L) len L a = L[i] a L[i] L i b = L[j] b L[j] L j ans += max(0, bisect.bisect_right(L, a + b - 1) - (j + 1)) ans max(0, bisect.bisect_right(L, a + b - 1) - (j + 1)) max 0 bisect.bisect_right(L, a + b - 1) - (j + 1) bisect.bisect_right(L, a + b - 1) bisect.bisect_right bisect bisect_right L a + b - 1 a + b a b 1 j + 1 j 1 print(ans) print ans a = L[i] L[i] a ans = 0 0 ans b = L[j] L[j] b ans += max(0, bisect.bisect_right(L, a + b - 1) - (j + 1)) max(0, bisect.bisect_right(L, a + b - 1) - (j + 1)) ans N = int(input()) int(input()) N L = sorted(map(int, input().split(' '))) sorted(map(int, input().split(' '))) L
import bisect

N = int(input())
L = sorted(map(int, input().split(' ')))

ans = 0
for i in range(len(L)):
    for j in range(i + 1, len(L)):
        a = L[i]
        b = L[j]
        ans += max(0, bisect.bisect_right(L, a + b - 1) - (j + 1))

print(ans)
