array_length = gets.to_i
array_value = gets.split(" ").map(&:to_i)

def selectionSort(array, length)
    
    exchange_ct = 0
    
    for i in 0..(length - 1) do
        
        minj = i
    
        for j in i..(length - 1) do
            
            if array[j] < array[minj]
                
                minj = j
                
            end
        end
        
        
        exchange_ct += 1  if i != minj
        
        
        array[i], array[minj] = array[minj], array[i]
    end
    
    exchange_ct
end

exchange_ct = selectionSort(array_value, array_length)

puts array_value.join(" ")
puts exchange_ct
    
