def alsd12b
    n = gets.chomp.to_i
    an = gets.chomp.split(/\s/).map{|x| x.to_i}

    cnt = 0
    for i in 0..(n-1)
        minj = i
        for j in i..(n-1)
            if an[j] < an[minj]
                minj = j
            end
        end

        unless i == minj
            tmp = an[i]
            an[i] = an[minj]
            an[minj] = tmp
            cnt += 1
        end
    end

    puts an.join(' ')
    puts cnt
end

alsd12b
