function Main(input) {
    input = input.trim().split("\n").map(function(x) { return x.split(" ")});
    let N = parseInt(input[0][0], 10);
    let v_L = input[1].map(e => parseInt(e, 10));
    v_L.sort((a, b) => a - b);

    let ans = 0;

    for (let i = 0; i < N - 2; i++){
        for (let j = i + 1; j < N - 1; j++){
            if (v_L[i] === v_L[j]) continue;
            for (let k = j + 1; k < N; k++){
                if (v_L[j] === v_L[k]) continue;
                if (v_L[i] + v_L[j] > v_L[k]) ans ++;
                else break;
            }
        }
    }

    console.log(ans);

}


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