n =  gets.to_i
arr = gets.split.map(&:to_i)


def selectionSort(array,num)
  cnt = 0
  for i in 0..num-1
    minj = i
    for j in i..num-1
      if array[j] < array[minj]
        minj = j
      end
    end

    if i != minj
      array[i],array[minj] = array[minj],array[i]
      cnt += 1
    end
  end
  return [array,cnt]
end

puts selectionSort(arr,n)[0].join(" ")
puts selectionSort(arr,n)[1]