N = input()
A = map(int,raw_input().split())
x = 0
for i in range(N):
    minj = i
    for j in range(i,N):
        if A[j] < A[minj]:
            minj = j
    if not minj == i:        
        v = A[i]
        A[i] = A[minj]
        A[minj] = v
        x += 1
    
for i in range(N-1):
    print A[i],
print A[-1]
print x