x = int(input())
*li, = map(int, input().split())

mi_li = li.copy()
ans = 0
for i in range(x):
    where = 0
    where2 = 0
    min_li = min(mi_li)
    for j in range(len(mi_li)):
        if min_li == mi_li[j]:
            where = j
            break
    for k in range(len(li)):
        if min_li == li[k]:
            where2 = k
            break
    if i < x-1 and li[i] > min_li:
        li[i], li[where2], mi_li[where], mi_li[0] = mi_li[where], li[i], li[i], li[where2]
        del mi_li[0]
        ans += 1

print(*li)
print(ans)
