import bisect

N = int(input())
L = list(map(int,input().split()))
L.sort()

# print(L)

ans=0
for a_idx in range(len(L)):
    a = L[a_idx]
    for b_idx in range(a_idx+1,len(L)):
        b = L[b_idx]
        c_low = b - a
        c_up = a + b - 1
        
        c_low_idx = bisect.bisect(L,c_low)
        c_up_idx = bisect.bisect(L,c_up)
        
#         print('=====')
#         print(a,b)
#         print(c_low_idx,c_up_idx)
        
        c_low_idx = max(b_idx,c_low_idx)
        
        ans += max(0,c_up_idx-c_low_idx-1)
#         print(ans,c_low_idx,c_up_idx)
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 a_idx in range(len(L)):
    a = L[a_idx]
    for b_idx in range(a_idx+1,len(L)):
        b = L[b_idx]
        c_low = b - a
        c_up = a + b - 1
        
        c_low_idx = bisect.bisect(L,c_low)
        c_up_idx = bisect.bisect(L,c_up)
        
#         print('=====')
#         print(a,b)
#         print(c_low_idx,c_up_idx)
        
        c_low_idx = max(b_idx,c_low_idx)
        
        ans += max(0,c_up_idx-c_low_idx-1)
#         print(ans,c_low_idx,c_up_idx) a_idx range(len(L)) range len(L) len L a = L[a_idx] a L[a_idx] L a_idx for b_idx in range(a_idx+1,len(L)):
        b = L[b_idx]
        c_low = b - a
        c_up = a + b - 1
        
        c_low_idx = bisect.bisect(L,c_low)
        c_up_idx = bisect.bisect(L,c_up)
        
#         print('=====')
#         print(a,b)
#         print(c_low_idx,c_up_idx)
        
        c_low_idx = max(b_idx,c_low_idx)
        
        ans += max(0,c_up_idx-c_low_idx-1)
#         print(ans,c_low_idx,c_up_idx) b_idx range(a_idx+1,len(L)) range a_idx+1 a_idx 1 len(L) len L b = L[b_idx] b L[b_idx] L b_idx c_low = b - a c_low b - a b a c_up = a + b - 1 c_up a + b - 1 a + b a b 1 c_low_idx = bisect.bisect(L,c_low) c_low_idx bisect.bisect(L,c_low) bisect.bisect bisect bisect L c_low c_up_idx = bisect.bisect(L,c_up) c_up_idx bisect.bisect(L,c_up) bisect.bisect bisect bisect L c_up c_low_idx = max(b_idx,c_low_idx) c_low_idx max(b_idx,c_low_idx) max b_idx c_low_idx ans += max(0,c_up_idx-c_low_idx-1) ans max(0,c_up_idx-c_low_idx-1) max 0 c_up_idx-c_low_idx-1 c_up_idx-c_low_idx c_up_idx c_low_idx 1 print(ans) print ans c_up_idx = bisect.bisect(L,c_up) bisect.bisect(L,c_up) c_up_idx c_up = a + b - 1 a + b - 1 c_up c_low_idx = max(b_idx,c_low_idx) max(b_idx,c_low_idx) c_low_idx c_low = b - a b - a c_low a = L[a_idx] L[a_idx] a L = list(map(int,input().split())) list(map(int,input().split())) L N = int(input()) int(input()) N b = L[b_idx] L[b_idx] b ans=0 0 ans c_low_idx = bisect.bisect(L,c_low) bisect.bisect(L,c_low) c_low_idx ans += max(0,c_up_idx-c_low_idx-1) max(0,c_up_idx-c_low_idx-1) ans
import bisect

N = int(input())
L = list(map(int,input().split()))
L.sort()

# print(L)

ans=0
for a_idx in range(len(L)):
    a = L[a_idx]
    for b_idx in range(a_idx+1,len(L)):
        b = L[b_idx]
        c_low = b - a
        c_up = a + b - 1
        
        c_low_idx = bisect.bisect(L,c_low)
        c_up_idx = bisect.bisect(L,c_up)
        
#         print('=====')
#         print(a,b)
#         print(c_low_idx,c_up_idx)
        
        c_low_idx = max(b_idx,c_low_idx)
        
        ans += max(0,c_up_idx-c_low_idx-1)
#         print(ans,c_low_idx,c_up_idx)
print(ans)