def selectionSort(A, N):
    counter = 0
    for i in range(N):
        minj = i
        for j in range(i, N):
            if A[j] < A[minj]:
                minj = j
        if A[i] != A[minj]:
            counter += 1
            A[i], A[minj] = A[minj], A[i]
    return A, counter

N = int(raw_input())
A = map(int,raw_input().split())

A, counter = selectionSort(A, N)
print " ".join(map(str, A))
print counter