n = gets.to_i
a = gets.split.map(&:to_i)
cnt = 0
for i in 0..n-1
    minj = i
    for j in i..n-1
        if a[j] < a[minj]
            minj = j
        end
    end
    next if i == minj 
    k = a[i]
    a[i] = a[minj]
    a[minj] = k
    cnt += 1
end
puts a.join(" ")
puts cnt
