import bisect
#二分探索をするライブラリ

n = int(input())
L = sorted(map(int,input().split()))
ans = 0

# c <= b <= a とする

for i in range(n-2):
    for j in range(i+1,n-1):
        a = L[n-1-i]
        b = L[n-1-j]
        
        if a-b < b:
            ans += (n-1-j) - bisect.bisect_left(L,a-b+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(n-2):
    for j in range(i+1,n-1):
        a = L[n-1-i]
        b = L[n-1-j]
        
        if a-b < b:
            ans += (n-1-j) - bisect.bisect_left(L,a-b+1)
         i range(n-2) range n-2 n 2 for j in range(i+1,n-1):
        a = L[n-1-i]
        b = L[n-1-j]
        
        if a-b < b:
            ans += (n-1-j) - bisect.bisect_left(L,a-b+1)
         j range(i+1,n-1) range i+1 i 1 n-1 n 1 a = L[n-1-i] a L[n-1-i] L n-1-i n-1 n 1 i b = L[n-1-j] b L[n-1-j] L n-1-j n-1 n 1 j if a-b < b:
            ans += (n-1-j) - bisect.bisect_left(L,a-b+1)
         a-b < b a-b a b b ans += (n-1-j) - bisect.bisect_left(L,a-b+1) ans (n-1-j) - bisect.bisect_left(L,a-b+1) n-1-j n-1 n 1 j bisect.bisect_left(L,a-b+1) bisect.bisect_left bisect bisect_left L a-b+1 a-b a b 1 print(ans) print ans L = sorted(map(int,input().split())) sorted(map(int,input().split())) L b = L[n-1-j] L[n-1-j] b ans = 0 0 ans n = int(input()) int(input()) n a = L[n-1-i] L[n-1-i] a ans += (n-1-j) - bisect.bisect_left(L,a-b+1) (n-1-j) - bisect.bisect_left(L,a-b+1) ans
import bisect
#二分探索をするライブラリ

n = int(input())
L = sorted(map(int,input().split()))
ans = 0

# c <= b <= a とする

for i in range(n-2):
    for j in range(i+1,n-1):
        a = L[n-1-i]
        b = L[n-1-j]
        
        if a-b < b:
            ans += (n-1-j) - bisect.bisect_left(L,a-b+1)
        
print(ans)