N   = int(input())
A   = [int(temp) for temp in input().split()]
cou = 0

for i in range(N - 1) :
    minj = N - 1
    for j in range(i, N - 1) :
        if A[j] < A[minj] :
            minj = int(j)
    if A[i] != A[minj] :
        tem  = int(A[i])
        A[i] = int(A[minj])
        A[minj] = int(tem)
        cou = cou + 1
A   = [str(temp) for temp in A]
print(' '.join(A))
print(cou)