n = gets.to_i
array = gets.split.map(&:to_i)
count = 0

(0..(n - 1)).each do |i|
    minj = i
    (i..(n - 1)).each do |j|
        if array[minj] > array[j]
            minj = j
        end
    end
    if array[minj] < array[i]
        array[i],array[minj] = array[minj],array[i]
        count += 1 
    end
    
end

print array.join(" ")
puts "\n#{count}" 
