n = gets.to_i
array = gets.split(' ').map {|a| a.to_i }

flag = true
change_times = 0

0.upto(n-1) do |i|
    min_j = i
    i.upto(n-1) do |j|
        min_j = j if array[j] < array[min_j]
    end
    if i != min_j then
        array[i], array[min_j] = array[min_j], array[i]
        change_times = change_times + 1
    end
end

puts array.join(' ')
puts change_times