import numpy as np
n = int(input())
a = np.array(list(map(int, input().split())))
c = 0
for i in range(n - 1):
    j = np.argmin(a[i:]) + i
    if i != j:
        a[i], a[j] = a[j], a[i]
        c += 1
print(" ".join(map(str, list(a))))
print(c)
