n = gets.to_i
a = gets.chomp.split.map(&:to_i)
count = 0
for i in 0..n - 1
    minj = i
    for j in minj + 1..n - 1
        if a[minj] > a[j]
            minj = j
        end
    end
    if minj != i
        a[i], a[minj] = a[minj], a[i]
        count += 1
    end
end
puts a.join(" ")
puts count
