n = int(input())
a = list(map(int, 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)
        
