"use strict"
function main(arg) {
    // let data = arg.trim().split("\n")[1].split(" ").map(Number).sort((a,b) => a-b)
    let data = arg.trim().split("\n")[1].split(" ").map(Number)
    let N = data.length
    let counter = 0
    for (let i = 0;i < N;i++) {
        for (let j = i;j < N;j++) {
            if (i === j) continue
            if (data[i] === data[j]) continue
            for (let k = j;k < N;k++) {
                if (i === k) continue
                if (data[i] === data[k]) continue
                if (k === j) continue
                if (data[k] === data[j]) continue
                // console.log([i+1,j+1,k+1, isEnable(data[i],data[j], data[k])])
                if (isEnable(data[i],data[j], data[k])) {
                    counter++
                }
            }
        }
    }
    console.log(counter)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

function isEnable(a,b,c) {
    return (a+b) > c && (b+c) > a && (a+c) > b
}