from sys import stdin,stdout
def INPUT():return list(int(i) for i in stdin.readline().split())
import math
def inp():return stdin.readline()
def out(x):return stdout.write(x)
import math as M
MOD=10**9+7
import bisect
#####################################
n=int(input())
A=INPUT()
A.sort()
ans=0
for i in range(n):
    for j in range(i+1,n):
        ans+=bisect.bisect_left(A,A[i]+A[j],0,n)-1-j
print(ans) from sys import stdin,stdout def INPUT():return list(int(i) for i in stdin.readline().split()) INPUT import math math def inp():return stdin.readline() inp def out(x):return stdout.write(x) out x x import math as M math MOD=10**9+7 MOD 10**9+7 10**9 10 9 7 import bisect bisect n=int(input()) n int(input()) int input() input A=INPUT() A INPUT() INPUT A.sort() A.sort A sort ans=0 ans 0 for i in range(n):
    for j in range(i+1,n):
        ans+=bisect.bisect_left(A,A[i]+A[j],0,n)-1-j i range(n) range n for j in range(i+1,n):
        ans+=bisect.bisect_left(A,A[i]+A[j],0,n)-1-j j range(i+1,n) range i+1 i 1 n ans+=bisect.bisect_left(A,A[i]+A[j],0,n)-1-j ans bisect.bisect_left(A,A[i]+A[j],0,n)-1-j bisect.bisect_left(A,A[i]+A[j],0,n)-1 bisect.bisect_left(A,A[i]+A[j],0,n) bisect.bisect_left bisect bisect_left A A[i]+A[j] A[i] A i A[j] A j 0 n 1 j print(ans) print ans def inp():return stdin.readline() def inp():return stdin.readline() inp n=int(input()) int(input()) n ans+=bisect.bisect_left(A,A[i]+A[j],0,n)-1-j bisect.bisect_left(A,A[i]+A[j],0,n)-1-j ans A=INPUT() INPUT() A MOD=10**9+7 10**9+7 MOD def INPUT():return list(int(i) for i in stdin.readline().split()) def INPUT():return list(int(i) for i in stdin.readline().split()) INPUT def out(x):return stdout.write(x) def out(x):return stdout.write(x) out ans=0 0 ans
from sys import stdin,stdout
def INPUT():return list(int(i) for i in stdin.readline().split())
import math
def inp():return stdin.readline()
def out(x):return stdout.write(x)
import math as M
MOD=10**9+7
import bisect
#####################################
n=int(input())
A=INPUT()
A.sort()
ans=0
for i in range(n):
    for j in range(i+1,n):
        ans+=bisect.bisect_left(A,A[i]+A[j],0,n)-1-j
print(ans)
