
function Main(input) {
    tmp = input.split("\n");
    n = parseInt(tmp[0], 10);
    tmp2 = tmp[1];
    l = tmp2.split(" ");
    result = 0;

    if (n < 3) {
    } else{

        for (let i = 0; i < l.length - 2; i++) {
            base = parseInt(l[i], 10);
            for (let j = i + 1; j < l.length - 1; j++) {
                check1 = parseInt(l[j], 10);
               
                if (base != check1) {
                    for (let k = j + 1; k < l.length; k++) {
                        check2 = parseInt(l[k], 10);
                        if ( base != check2 && check1 != check2) {
                            if (base + check1 > check2 && check1 + check2 > base && check2 + base > check1) {
                                result += 1;

                            }
                        }
                    }
                }
            }
        }
    }

    console.log(result);
    

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