def selection_sort(ary,num)
  time = 0
  for i in 0..num-1
    minj = i
    for j in i..num-1
      if ary[j] < ary[minj]
        minj = j
      end
    end
    if minj != i
      k = ary[minj]
      ary[minj] = ary[i]
      ary[i] = k
      time += 1
    end
  end
  puts ary.join(" ")
  puts time
end

N = gets.to_i
a = gets.chomp.split.map(&:to_i)

selection_sort(a,N)