def selectionSort(a, n):
  count = 0
  for i in range(0, n):
    minj = i
    for j in range(i, n):
      if a[j] < a[minj]:
        minj = j
    if i != minj:
      w = a[i]
      a[i] = a[minj]
      a[minj] = w
      count += 1
  print(' '.join(map(str, a)))
  print(count)

n = int(input())
a = list(map(int, input().split()))
selectionSort(a, n) def selectionSort(a, n):
  count = 0
  for i in range(0, n):
    minj = i
    for j in range(i, n):
      if a[j] < a[minj]:
        minj = j
    if i != minj:
      w = a[i]
      a[i] = a[minj]
      a[minj] = w
      count += 1
  print(' '.join(map(str, a)))
  print(count) selectionSort count = 0 count 0 for i in range(0, n):
    minj = i
    for j in range(i, n):
      if a[j] < a[minj]:
        minj = j
    if i != minj:
      w = a[i]
      a[i] = a[minj]
      a[minj] = w
      count += 1
   i range(0, n) range 0 n minj = i minj i for j in range(i, n):
      if a[j] < a[minj]:
        minj = j
     j range(i, n) range i n if a[j] < a[minj]:
        minj = j
     a[j] < a[minj] a[j] a j a[minj] a minj minj = j minj j if i != minj:
      w = a[i]
      a[i] = a[minj]
      a[minj] = w
      count += 1
   i != minj i minj w = a[i] w a[i] a i a[i] = a[minj] a[i] a i a[minj] a minj a[minj] = w a[minj] a minj w count += 1 count 1 print(' '.join(map(str, a))) print ' '.join(map(str, a)) ' '.join ' ' join map(str, a) map str a print(count) print count a a n n n = int(input()) n int(input()) int input() input a = list(map(int, input().split())) a list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split selectionSort(a, n) selectionSort a n n = int(input()) int(input()) n def selectionSort(a, n):
  count = 0
  for i in range(0, n):
    minj = i
    for j in range(i, n):
      if a[j] < a[minj]:
        minj = j
    if i != minj:
      w = a[i]
      a[i] = a[minj]
      a[minj] = w
      count += 1
  print(' '.join(map(str, a)))
  print(count) def selectionSort(a, n):
  count = 0
  for i in range(0, n):
    minj = i
    for j in range(i, n):
      if a[j] < a[minj]:
        minj = j
    if i != minj:
      w = a[i]
      a[i] = a[minj]
      a[minj] = w
      count += 1
  print(' '.join(map(str, a)))
  print(count) selectionSort a = list(map(int, input().split())) list(map(int, input().split())) a
def selectionSort(a, n):
  count = 0
  for i in range(0, n):
    minj = i
    for j in range(i, n):
      if a[j] < a[minj]:
        minj = j
    if i != minj:
      w = a[i]
      a[i] = a[minj]
      a[minj] = w
      count += 1
  print(' '.join(map(str, a)))
  print(count)

n = int(input())
a = list(map(int, input().split()))
selectionSort(a, n)
