input = require('fs').readFileSync('/dev/stdin', 'utf8')
lines = input.split('\n')
N = lines.shift() * 1
line = lines.shift().split(' ')

l = {}
for (i=0; i<N; i++) {
    if (l[line[i]] === undefined) {
        l[line[i]] = 1
    } else {
        l[line[i]] = l[line[i]] + 1
    }
}

keys = Object.keys(l).sort((a, b) => b - a)
cnt = 0
for (i=0; i<keys.length - 2; i++) {
    a = keys[i] * 1
    for (j=i+1; j<keys.length - 1; j++) {
        b = keys[j] * 1
        for (k=j+1; k<keys.length; k++) {
            c = keys[k] * 1
            if (
                a < b + c &&
                b < c + a &&
                c < a + b
            ) {
                cnt += l[a] * l[b] * l[c]
            } else {
                break;
            }
        }
    }
}

console.log(cnt)