"""
SelectionSort(A)
1 for i = 0 to A.length-1
2     mini = i
3     for j = i to A.length-1
4         if A[j] < A[mini]
5             mini = j
6     swap A[i] and A[mini]
"""
import logging
logging.basicConfig(level=logging.WARNING,format=' %(asctime)s - %(levelname)s - %(message)s')

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

A=[]
n=int(input())
for i in range(n):
    A.append(int(input()))
    logging.info('A[{}] = {}'.format(i,A[i]))
t=sort(A)
for i in range(n):
    print(A[i],end=' ')
print('\b\n'+str(t))