n = int(input())
A = input().split(' ')
count = 0

for i in range(0, n):
    minj = i

    for j in range(i, n):
        if A[j] < A[minj]:
            minj = j
            count += 1

    (A[i], A[minj]) = (A[minj], A[i])

print(" ".join(A))
print(count)