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)
cnt = 0
for (i=0; i<keys.length; i++) {
    ki = keys[i] * 1
    for (j=i+1; j<keys.length; j++) {
        kj = keys[j] * 1
        for (k=j+1; k<keys.length; k++) {
            kk = keys[k] * 1
            
            if (
                ki < kj + kk &&
                kj < kk + ki &&
                kk < ki + kj
            ) {
                cnt += l[keys[i]] * l[keys[j]] * l[keys[k]]
            }
        }
    }
}

console.log(cnt)