from bisect import bisect

n = int(input())
l = sorted(map(int, input().split()))
linv = l[::-1]

ans = 0
for i in range(n):
    for j in range(i + 1, n):
        x = linv[i] - linv[j]
        ans += max((n - j - 1) - bisect(l, x), 0)
print(ans) from bisect import 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 linv = l[::-1] linv l[::-1] l ::-1 -1 ans = 0 ans 0 for i in range(n):
    for j in range(i + 1, n):
        x = linv[i] - linv[j]
        ans += max((n - j - 1) - bisect(l, x), 0) i range(n) range n for j in range(i + 1, n):
        x = linv[i] - linv[j]
        ans += max((n - j - 1) - bisect(l, x), 0) j range(i + 1, n) range i + 1 i 1 n x = linv[i] - linv[j] x linv[i] - linv[j] linv[i] linv i linv[j] linv j ans += max((n - j - 1) - bisect(l, x), 0) ans max((n - j - 1) - bisect(l, x), 0) max (n - j - 1) - bisect(l, x) n - j - 1 n - j n j 1 bisect(l, x) bisect l x 0 print(ans) print ans ans += max((n - j - 1) - bisect(l, x), 0) max((n - j - 1) - bisect(l, x), 0) ans ans = 0 0 ans x = linv[i] - linv[j] linv[i] - linv[j] x linv = l[::-1] l[::-1] linv l = sorted(map(int, input().split())) sorted(map(int, input().split())) l n = int(input()) int(input()) n
from bisect import bisect

n = int(input())
l = sorted(map(int, input().split()))
linv = l[::-1]

ans = 0
for i in range(n):
    for j in range(i + 1, n):
        x = linv[i] - linv[j]
        ans += max((n - j - 1) - bisect(l, x), 0)
print(ans)
