var count = 0;

function Main(input) {
    input = input.split("\n")
    input = input.map(e=>e.split(" "))
    input = input.map(e=>e.map(f=>parseInt(f,10)))    
        
    var sortedArray = input[1].sort(compareFunc)    

    result(sortedArray)
      
    console.log(count);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8")); 

function compareFunc(a, b) {
    return a < b;
}

function result(arr){
    arr.forEach((e,i,a)=>{
        var array = a.slice(i+1,a.length);
        var aaa = e
        array.forEach((f,j,b)=>{
            var bray = b.slice(j+1,b.length);
            var bbb = f
            bray.forEach(g=>{                
                if((aaa < bbb + g) && (bbb< g +aaa) && (g<aaa+bbb)){
                    count++;
                }else{
                    return;
                }
            })
        })
    })
}