def selectionSort(nums, length):
  count = 0
  for i in xrange(length):
    minj = i
    for j in xrange(i, length):
      # print "i = %d, j = %d, minj = %d, count = %d" % (i, j, minj, count)
      # print nums
      if nums[j] < nums[minj]:
        minj = j
    nums[i], nums[minj] = nums[minj], nums[i]
    count += 1 if i != minj else 0
  return [nums, count]

length = int(raw_input())
nums = map(int, raw_input().split())
ans = selectionSort(nums, length)

print " ".join(map(str, ans[0]))
print ans[1] def selectionSort(nums, length):
  count = 0
  for i in xrange(length):
    minj = i
    for j in xrange(i, length):
      # print "i = %d, j = %d, minj = %d, count = %d" % (i, j, minj, count)
      # print nums
      if nums[j] < nums[minj]:
        minj = j
    nums[i], nums[minj] = nums[minj], nums[i]
    count += 1 if i != minj else 0
  return [nums, count] selectionSort count = 0 count 0 for i in xrange(length):
    minj = i
    for j in xrange(i, length):
      # print "i = %d, j = %d, minj = %d, count = %d" % (i, j, minj, count)
      # print nums
      if nums[j] < nums[minj]:
        minj = j
    nums[i], nums[minj] = nums[minj], nums[i]
    count += 1 if i != minj else 0
   i xrange(length) xrange length minj = i minj i for j in xrange(i, length):
      # print "i = %d, j = %d, minj = %d, count = %d" % (i, j, minj, count)
      # print nums
      if nums[j] < nums[minj]:
        minj = j
     j xrange(i, length) xrange i length if nums[j] < nums[minj]:
        minj = j
     nums[j] < nums[minj] nums[j] nums j nums[minj] nums minj minj = j minj j nums[i], nums[minj] = nums[minj], nums[i] nums[i] nums i nums[minj] nums minj nums[minj] nums minj nums[i] nums i count += 1 if i != minj else 0 count 1 if i != minj else 0 i != minj i minj 1 0 return [nums, count] [nums, count] nums count nums nums length length length = int(raw_input()) length int(raw_input()) int raw_input() raw_input nums = map(int, raw_input().split()) nums map(int, raw_input().split()) map int raw_input().split() ().split () raw_input split ans = selectionSort(nums, length) ans selectionSort(nums, length) selectionSort nums length print " ".join(map(str, ans[0])) " ".join " " join map(str, ans[0]) map str ans[0] ans 0 print ans[1] ans 1 length = int(raw_input()) int(raw_input()) length def selectionSort(nums, length):
  count = 0
  for i in xrange(length):
    minj = i
    for j in xrange(i, length):
      # print "i = %d, j = %d, minj = %d, count = %d" % (i, j, minj, count)
      # print nums
      if nums[j] < nums[minj]:
        minj = j
    nums[i], nums[minj] = nums[minj], nums[i]
    count += 1 if i != minj else 0
  return [nums, count] def selectionSort(nums, length):
  count = 0
  for i in xrange(length):
    minj = i
    for j in xrange(i, length):
      # print "i = %d, j = %d, minj = %d, count = %d" % (i, j, minj, count)
      # print nums
      if nums[j] < nums[minj]:
        minj = j
    nums[i], nums[minj] = nums[minj], nums[i]
    count += 1 if i != minj else 0
  return [nums, count] selectionSort ans = selectionSort(nums, length) selectionSort(nums, length) ans nums = map(int, raw_input().split()) map(int, raw_input().split()) nums
def selectionSort(nums, length):
  count = 0
  for i in xrange(length):
    minj = i
    for j in xrange(i, length):
      # print "i = %d, j = %d, minj = %d, count = %d" % (i, j, minj, count)
      # print nums
      if nums[j] < nums[minj]:
        minj = j
    nums[i], nums[minj] = nums[minj], nums[i]
    count += 1 if i != minj else 0
  return [nums, count]

length = int(raw_input())
nums = map(int, raw_input().split())
ans = selectionSort(nums, length)

print " ".join(map(str, ans[0]))
print ans[1]