n = int(input())
a = [int(i) for i in input().split()]
ans = 0
for i in range(n):
    v = a[i]
    j = a[i:].index(min(a[i:]))+i
    w = a[j]
    v, w = w, v
    if i != j:
        ans+=1


print(*a)
print(ans)
        
