n = gets.to_i
l = gets.split.map(&:to_i)
ans = 0
(0...n-2).each do |i|
  (i+1...n-1).each do |j|
    (j+1...n).each do |k|
      t = [l[i], l[j], l[k]].sort
      if t[0] != t[1] && t[1] != t[2]
        ans +=1 if t[0] + t[1] > t[2]
      end
    end
  end
end
puts ans
