#http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_2_B&lang=jp

N = gets.to_i

a = gets.split.map(&:to_i)
cnt = 0
N.times.each do |i|
    minj = i
    (i..N-1).each do |j|
        if a[j] < a[minj]
            minj = j
        end
    end
    if minj != i
        a[i],a[minj] = a[minj],a[i]
        cnt+=1
    end
end

puts a.join(" ")
puts cnt