import math

N = input()
A = map(int, raw_input().split())
c=0
for i in range(0,N):
  minj = i
  for j in range(i,N):
    if A[j] < A[minj]:
      minj=j
  A[i],A[minj]=A[minj],A[i]
  if minj!=i:
    c+=1

print ' '.join(map(str, A))
print c
