function Main(input) {
    var num = parseInt(input.split("\n")[0]);
    var sideLength = input.split("\n")[1].split(" ");
    
    for(var a=0; a<num; a++){
        sideLength[a] = parseInt(sideLength[a]);
    }
    sideLength.sort(
        function(a,b){
            if(a>b){
                return 1;
            }else if(a<b){
                return -1;
            }else{
                return 0;
            }
        }
    )
   var count = 0;
   
   function deltacheck(a,b,c){
       var aa = parseInt(a);
       var bb = parseInt(b);
       var cc = parseInt(c);
       return (aa+bb)>cc && (aa+cc)>bb && (bb+cc)>aa && aa!=bb && aa!=cc && bb!=cc;
   }
   
   if(num<3){
       console.log(count);
   }else{
       loop:
       for(var i=0; i<num; i++){
           for(var j=i+1; j<num; j++){
               for(var k=j+1; k<num; k++){
                   if(deltacheck(sideLength[i],sideLength[j],sideLength[k])){
                       count+=1;
                   }
               }
           }
       }
   }
   if(count!==0){
        console.log(count);
   }
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));