'use strict'

const main = input => {
	const args = input.split('\n').map(arg => arg.split(' '))
	const N = parseInt(args[0][0], 10)
	const L = args[1].map(arg => parseInt(arg, 10)).sort((a, b) => a - b)
	let ans = 0

	for (let i = 2; i < N; i++) {
		for (let j = 0; j < (i - 1); j++) {
			for (let k = j + 1; k < i; k++) {
				if ((L[j] + L[k]) > L[i]) ans++
			}
		}
	}
	console.log(ans)
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))
