import bisect as bs
N = int(input())
L = list(map(int,input().split()))
L.sort()
ans = 0
for i in range(len(L)-1):
    for j in range(i+1, len(L)):
        ans += bs.bisect_left(L, L[i]+L[j])-j-1
print(ans) import bisect as bs 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(len(L)-1):
    for j in range(i+1, len(L)):
        ans += bs.bisect_left(L, L[i]+L[j])-j-1 i range(len(L)-1) range len(L)-1 len(L) len L 1 for j in range(i+1, len(L)):
        ans += bs.bisect_left(L, L[i]+L[j])-j-1 j range(i+1, len(L)) range i+1 i 1 len(L) len L ans += bs.bisect_left(L, L[i]+L[j])-j-1 ans bs.bisect_left(L, L[i]+L[j])-j-1 bs.bisect_left(L, L[i]+L[j])-j bs.bisect_left(L, L[i]+L[j]) bs.bisect_left bs bisect_left L L[i]+L[j] L[i] L i L[j] L j j 1 print(ans) print ans L = list(map(int,input().split())) list(map(int,input().split())) L N = int(input()) int(input()) N ans = 0 0 ans ans += bs.bisect_left(L, L[i]+L[j])-j-1 bs.bisect_left(L, L[i]+L[j])-j-1 ans
import bisect as bs
N = int(input())
L = list(map(int,input().split()))
L.sort()
ans = 0
for i in range(len(L)-1):
    for j in range(i+1, len(L)):
        ans += bs.bisect_left(L, L[i]+L[j])-j-1
print(ans)