console.log((args=>{
  const [[N],L] = args.trim().split`\n`.map(r=>r.split` `.map(v=>v|0));
  if (N<3) return 0;
  let count = 0;
  for ( let i = 0; i < N-2; i++ ) {
    for ( let j = i+1; j < N-1; j++ ) {
      if ( L[j] === L[i] ) continue;
      for ( let k = j+1; k < N; k++ ) {
        if ( L[k] === L[j] || L[k] === L[i] ) continue;
        if ( L[i] + L[j] > L[k]
          && L[i] + L[k] > L[j]
          && L[k] + L[j] > L[i] ) count++;
      }
    }
  }
  return count;
})(require('fs').readFileSync('/dev/stdin','utf8')));
