N = gets.to_i
array = gets.split(" ").map(&:to_i)
count = 0
i = 0
while i < N-1
    j = i+1
    minj = i
    while j < N
        if array[minj] > array[j]
            minj = j
        end
        j += 1
    end
    if array[minj] != array[i]
        array[i], array[minj] = array[minj], array[i]
        count += 1
    end
    i += 1 
end
puts array.join(" "),count
