N = gets.chomp.to_i
Ls = gets.chomp.split.map(&:to_i)

count = 0
0.upto(N-3){ |i|
  (i+1).upto(N-2){ |j|
    (j+1).upto(N-1){ |k|
      if [Ls[i], Ls[j], Ls[k]].uniq.size == 3
        min2 = [Ls[i], Ls[j], Ls[k]].min(2)
        max = [Ls[i], Ls[j], Ls[k]].max
        if min2.sum > max
          #p [Ls[i], Ls[j], Ls[k]]
          #p [i+1, j+1, k+1]
          count += 1
        end
      end
    }
  }
}

puts count
