#selection sort???????????°??????

#Swap????????????
def Swap(a, b)
    return b, a
end

#SelectionSort????????????
def SelectionSort(a, length)
    count = 0
    for i in 0..length-1
        mini = i
        for j in i..length-1
            if a[j] < a[mini] then
                mini = j
            end
        end
        if i != mini then
            a[i], a[mini] = Swap(a[i], a[mini])
            count = count + 1
        end
    end
    return a, count
end

#SelectionSort??????????????¨?????????????????????
def PrintSelectionSortResult(a, length, count)
    i = -1
    for i in 0..length-2
        print a[i], " "
    end
    print a[i+1], "\n"
    print count, "\n"
end

#?????????????????°?????\?????????
length = readline.to_i

#??????????????\?????????
A = gets.chomp.split(" ").map(&:to_i)

B, count = SelectionSort(A, length)

PrintSelectionSortResult(B, length, count)