# Here your code !
def printAry(a)
    printf("#{a[0]}")
    
    for i in 1..a.length-1 do
        printf(" #{a[i]}")
    end
    printf("\n")
end


n = STDIN.gets.to_s.to_i
a = STDIN.gets.to_s.split(" ")
a.map!(&:to_i)
counter = 0

for i in 0..(n-1) do
    minj = i
    for j in i..(n-1) do
        if a[j] < a[minj]
            minj = j
        end
    end
    if i != minj then
        counter = counter + 1
        a[i], a[minj] = a[minj], a[i]
    end
end

printAry(a)
p counter