MODE = "stdio"
#require 'matrix'
#include Math
line = Array.new

if(defined? MODE)
  line = STDIN.read.split("\n")
else
  tmp = '6
  5 6 4 2 1 3'.split("\n")
  tmp.each{|s|
    line << s.strip
  }
end

n = line[0].to_i

arr = line[1].split(" ").map(&:to_i)
cnt = 0
(0..n-1).each do |i|
  minj = i
  (i..n-1).each do |j|
    if arr[j]<arr[minj]
      minj = j
    end
  end
  if i!=minj
    arr[i],arr[minj] = arr[minj],arr[i]
    cnt += 1
  end
end

puts arr.join(" ")
puts cnt