n = int(input())

l = list(map(int, input().split()))
count = 0

for i in range(n):
    mini = i
    for j in range(i,n):
        if l[j] < l[mini]:
            mini = j
    if i != mini:
        l[i], l[mini] = l[mini], l[i]
        count += 1

print(" ".join(map(str, l)))
print(count)

