'use strict';
const main = input => {
  const n = parseInt(input[0]);
  const l = input[1].split(' ').map(val => parseInt(val));
  // console.log(n, l);
  let count = 0;
  for(let i=0; i<n-2; i++) {
    for(let j=i+1; j<n-1; j++) {
      for(let k=j+1; k<n; k++) {
        if (l[i] < l[j] + l[k] && l[j] < l[i] + l[k] && l[k] < l[i] + l[j]) {
          count++;
        }
      }
    }
  }
  console.log(count);
  
}
main(require("fs").readFileSync("/dev/stdin", "utf8").split('\n'));