function Main(input) {
    input = input.split("\n");
    input = input[1].split(" ");
    result = [];

    for (i in input) {
        input[i] = Number(input[i]);
    }

    input.sort();
    for (let i = 0; i < input.length - 2; i++) {
        for (let j = 0; j < input.length - 1 - i; j++) {
            for (let k = 0; k < input.length - i - j - 2; k++) {
                tmp = [input[i], input[j + i + 1], input[i + j + k + 2]];
                var set = new Set(tmp);
                if (set.size == 3 && tmp[2] < tmp[0] + tmp[1]) {
                    result.push(tmp);
                }
            }
        }
    }

    console.log(result.length);
}

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