import bisect

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

l.sort()
ans = 0
for i in range(n-1):
    b = l[:i]
    c = l[i+1:]
    for j in b:
        ans += bisect.bisect_left(c, l[i] + j)#2番目の棒より短く(left), 一定以上の長さを持つ([i+1:])
print(ans) import bisect bisect 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 i in range(n-1):
    b = l[:i]
    c = l[i+1:]
    for j in b:
        ans += bisect.bisect_left(c, l[i] + j)#2番目の棒より短く(left), 一定以上の長さを持つ([i+1:]) i range(n-1) range n-1 n 1 b = l[:i] b l[:i] l :i i c = l[i+1:] c l[i+1:] l i+1: i+1 i 1 for j in b:
        ans += bisect.bisect_left(c, l[i] + j)#2番目の棒より短く(left), 一定以上の長さを持つ([i+1:]) j b ans += bisect.bisect_left(c, l[i] + j) ans bisect.bisect_left(c, l[i] + j) bisect.bisect_left bisect bisect_left c l[i] + j l[i] l i j print(ans) print ans l = list(map(int, input().split())) list(map(int, input().split())) l b = l[:i] l[:i] b ans += bisect.bisect_left(c, l[i] + j) bisect.bisect_left(c, l[i] + j) ans ans = 0 0 ans c = l[i+1:] l[i+1:] c n = int(input()) int(input()) n
import bisect

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

l.sort()
ans = 0
for i in range(n-1):
    b = l[:i]
    c = l[i+1:]
    for j in b:
        ans += bisect.bisect_left(c, l[i] + j)#2番目の棒より短く(left), 一定以上の長さを持つ([i+1:])
print(ans)
