inp = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n')
N = inp.shift() * 1
l = inp.shift().split(' ').map(x => +x).sort((a, b) => a - b)
c = 0 
for (i=0; i<N-2; i++) {
  for (j=i+1; j<N-1; j++) {
      if (l[i] == l[j]) {
          continue;
      }
      len = l[i] + l[j]
      for (k=j+1; k<N; k++) {
          if (l[i] == l[k] || l[j] == l[k]) {
              continue;
          }
          if (l[k] < len) {
              c++
          }
      }
  }
}
console.log(c)