N = int(input())
A = list(map(int, input().split()))
ans = 0
for i in range(N):
	ptr = i
	for j in range(i + 1, N):
		if A[ptr] > A[j]:
			ptr = j
	if i != ptr:
		x = A[i]
		A[i] = A[ptr]
		A[ptr] = x
		ans += 1
s = str(A[0])
for i in range(1, N):
	s += " " + str(A[i])
print(s)
print(ans)
