# coding: UTF-8
N = int(input())
A = list(map(int,input().split()))
count = 0
for i in range(N):
  j=i
  minj=i
  while j<= N-1:
    if A[j] < A[minj]:
      minj = j
    j += 1
  if i != minj:
    v=A[i]
    A[i]=A[minj]
    A[minj]=v
    count += 1
    
print(" ".join(map(str,A)))
print(count)

    
 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 count = 0 count 0 for i in range(N):
  j=i
  minj=i
  while j<= N-1:
    if A[j] < A[minj]:
      minj = j
    j += 1
  if i != minj:
    v=A[i]
    A[i]=A[minj]
    A[minj]=v
    count += 1
     i range(N) range N j=i j i minj=i minj i while j<= N-1:
    if A[j] < A[minj]:
      minj = j
    j += 1
   j<= N-1 j N-1 N 1 if A[j] < A[minj]:
      minj = j
     A[j] < A[minj] A[j] A j A[minj] A minj minj = j minj j j += 1 j 1 if i != minj:
    v=A[i]
    A[i]=A[minj]
    A[minj]=v
    count += 1
     i != minj i minj v=A[i] v A[i] A i A[i]=A[minj] A[i] A i A[minj] A minj A[minj]=v A[minj] A minj v 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 count = 0 0 count A = list(map(int,input().split())) list(map(int,input().split())) A j=i i j minj = j j minj count += 1 1 count minj=i i minj j += 1 1 j N = int(input()) int(input()) N v=A[i] A[i] v
# coding: UTF-8
N = int(input())
A = list(map(int,input().split()))
count = 0
for i in range(N):
  j=i
  minj=i
  while j<= N-1:
    if A[j] < A[minj]:
      minj = j
    j += 1
  if i != minj:
    v=A[i]
    A[i]=A[minj]
    A[minj]=v
    count += 1
    
print(" ".join(map(str,A)))
print(count)

    

