count = gets.to_i
nums = readline.chomp.split(" ").map(&:to_i)
result = []

for i in 0...count
  a = nums[i]
  for j in 0...count
    b = nums[j]
    if i < j
      for k in 0...count
        c = nums[k]
        if j < k && i < k 
          if a + b > c && a + c > b && b + c > a && [a, b, c].uniq.count == 3
            result << [i, j, k]
          end
        end
      end
    end
  end
end

puts result.count