function Main(input) {
    input = input.split("\n")
    input = input.map(e=>e.split(" "))
    input = input.map(e=>e.map(f=>parseInt(f,10)))    
    
    var count = 0;
    input[1].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++;
                }
            })
        })
    })
      
    console.log(count);
}

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