N = gets.to_i
a = gets.split.map(&:to_i)

cnt = 0
N.times do |i|
    minJ = i
    for j in i..(N - 1) do
        minJ = j if a[j] < a[minJ]
    end
    if minJ != i then
        tmpV = a[i]
        a[i] = a[minJ]
        a[minJ] = tmpV
        cnt += 1
    end
end

puts a.join(' ')
puts cnt
