def selection_sort(a, n)
    swap = 0
    for i in 0...(n - 1)
        minj = i
        for j in i...n
            if a[minj] > a[j]
                minj = j
            end
        end
        swap += 1 if i != minj
        a[i], a[minj] = a[minj], a[i]
        #puts a.join(" ")
    end
    puts a.join(" ")
    puts swap
end

n = gets.to_i
a = gets.split.map(&:to_i)
selection_sort(a, n)
