"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    const N = parseInt(arg[0].split(" ")[0]);
    const A = arg[1].split(" ").map(n=>parseInt(n));
    
    let answer = 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(A[i] === A[j] || A[j] === A[k] || A[i] === A[k]) {
                    continue;
                }
                
                if(A[i] + A[j] > A[k] && A[j] + A[k] > A[i] && A[k] + A[i] > A[j]) {
                    answer++;   
                    
                    // console.log("A[i]:" + A[i]);
                    // console.log("A[j]:" + A[j]);
                    // console.log("A[k]:" + A[k]);
                    // console.log("---")
                }
            }
        }
    }

    console.log(answer);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));