"""
1 selectionSort(A, N) // N??????????´??????????0-?????????????????????A
2   for i ??? 0 ?????? N-1 ?????§
3     minj = i
4     for j ??? i ?????? N-1 ?????§
5       if A[j] < A[minj]
6         minj = j
7     A[i] ??¨ A[minj] ?????????
"""

def sort(A,N):
    count=0
    for i in range(N-1):
        minj=i
        for j in range(i,N-1):
            if A[j]<A[minj]:
                minj=j
        tmp=A[i]
        A[i]=A[minj]
        A[minj]=tmp
        count+=1
    return count

N=int(input())
A=input().split()
t=sort(A,N)
for i in range(N):
    print(A[i],end=' ')
print('\b\n'+str(t))