def selectSort(A, N):
      cnt = 0
      for i in range(0,N):
            mina = A[i]
            k = 0
            for j in range(i+1,N):
                  if int(mina) > int(A[j]):
                        mina = A[j]
                        k = j
            if int(A[i]) > int(mina):
                  swap = A[i]
                  A[i] = mina
                  A[k] = swap
                  cnt = cnt + 1
      for t in range(0,N):
            if t < N-1:
                  print(A[t], end=" ")
            else:
                  print(A[t])
      print(cnt)
            

if __name__ == "__main__":
      N = int(input())
      A = (input()).split()
      selectSort(A,N) def selectSort(A, N):
      cnt = 0
      for i in range(0,N):
            mina = A[i]
            k = 0
            for j in range(i+1,N):
                  if int(mina) > int(A[j]):
                        mina = A[j]
                        k = j
            if int(A[i]) > int(mina):
                  swap = A[i]
                  A[i] = mina
                  A[k] = swap
                  cnt = cnt + 1
      for t in range(0,N):
            if t < N-1:
                  print(A[t], end=" ")
            else:
                  print(A[t])
      print(cnt)
             selectSort cnt = 0 cnt 0 for i in range(0,N):
            mina = A[i]
            k = 0
            for j in range(i+1,N):
                  if int(mina) > int(A[j]):
                        mina = A[j]
                        k = j
            if int(A[i]) > int(mina):
                  swap = A[i]
                  A[i] = mina
                  A[k] = swap
                  cnt = cnt + 1
       i range(0,N) range 0 N mina = A[i] mina A[i] A i k = 0 k 0 for j in range(i+1,N):
                  if int(mina) > int(A[j]):
                        mina = A[j]
                        k = j
             j range(i+1,N) range i+1 i 1 N if int(mina) > int(A[j]):
                        mina = A[j]
                        k = j
             int(mina) > int(A[j]) int(mina) int mina int(A[j]) int A[j] A j mina = A[j] mina A[j] A j k = j k j if int(A[i]) > int(mina):
                  swap = A[i]
                  A[i] = mina
                  A[k] = swap
                  cnt = cnt + 1
       int(A[i]) > int(mina) int(A[i]) int A[i] A i int(mina) int mina swap = A[i] swap A[i] A i A[i] = mina A[i] A i mina A[k] = swap A[k] A k swap cnt = cnt + 1 cnt cnt + 1 cnt 1 for t in range(0,N):
            if t < N-1:
                  print(A[t], end=" ")
            else:
                  print(A[t])
       t range(0,N) range 0 N if t < N-1:
                  print(A[t], end=" ")
            else:
                  print(A[t])
       t < N-1 t N-1 N 1 print(A[t], end=" ") print A[t] A t end=" " end " " print(A[t]) print A[t] A t print(cnt) print cnt A A N N if __name__ == "__main__":
      N = int(input())
      A = (input()).split()
      selectSort(A,N) __name__ == "__main__" __name__ "__main__" N = int(input()) N int(input()) int input() input A = (input()).split() A (input()).split() input()).split input() input split selectSort(A,N) selectSort A N N = int(input()) int(input()) N A = (input()).split() (input()).split() A def selectSort(A, N):
      cnt = 0
      for i in range(0,N):
            mina = A[i]
            k = 0
            for j in range(i+1,N):
                  if int(mina) > int(A[j]):
                        mina = A[j]
                        k = j
            if int(A[i]) > int(mina):
                  swap = A[i]
                  A[i] = mina
                  A[k] = swap
                  cnt = cnt + 1
      for t in range(0,N):
            if t < N-1:
                  print(A[t], end=" ")
            else:
                  print(A[t])
      print(cnt)
             def selectSort(A, N):
      cnt = 0
      for i in range(0,N):
            mina = A[i]
            k = 0
            for j in range(i+1,N):
                  if int(mina) > int(A[j]):
                        mina = A[j]
                        k = j
            if int(A[i]) > int(mina):
                  swap = A[i]
                  A[i] = mina
                  A[k] = swap
                  cnt = cnt + 1
      for t in range(0,N):
            if t < N-1:
                  print(A[t], end=" ")
            else:
                  print(A[t])
      print(cnt)
             selectSort
def selectSort(A, N):
      cnt = 0
      for i in range(0,N):
            mina = A[i]
            k = 0
            for j in range(i+1,N):
                  if int(mina) > int(A[j]):
                        mina = A[j]
                        k = j
            if int(A[i]) > int(mina):
                  swap = A[i]
                  A[i] = mina
                  A[k] = swap
                  cnt = cnt + 1
      for t in range(0,N):
            if t < N-1:
                  print(A[t], end=" ")
            else:
                  print(A[t])
      print(cnt)
            

if __name__ == "__main__":
      N = int(input())
      A = (input()).split()
      selectSort(A,N)