function main(arg) {
    let n = Number(arg.split("\n")[0])
    let l = arg.split("\n")[1].split(" ").map(x=>Number(x))

    l = l.sort((a,b)=>a-b)
    
    if(n<=2) {
        console.log(0)
    } else {
        let ans=0
        for(let i=0; i<n; i++) {
            for(let j=i+1; j<n; j++) {
                for(let k=j+1; k<n; k++) {
                    if(l[i]!=l[j] && l[j]!=l[k] && l[i]!=l[k] && 
                      l[k] < l[i]+l[j]) {
                        ans++
                    }
                }
            }
        }
        console.log(ans)
    }    
}

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