n = gets.to_i
ls = gets.split.map(&:to_i)

ans = []
(0..n-1).each do |i|
  (i..n-1).each do |j|
    next if i == j
    next if ls[i] == ls[j]
    (j..n-1).each do |k|
      next if i == k || j == k 
      next if ls[i] == ls[k] || ls[j] == ls[k]

      if ls[i] + ls[j] > ls[k] && ls[k] + ls[i] > ls[j] && ls[j] + ls[k] > ls[i]
        ans << [ls[i], ls[j], ls[k]]
      end
    end
  end
end
puts ans.count