def selection_sort(A, n):
	count = 0

	for i in range(n-1):
		minj = i
		for j in range(i, n):
			if A[j] < A[minj]:
				minj = j

		if i != minj:
			A[i], A[minj] = A[minj], A[i]
			count += 1

	print(' '.join(map(str, A)))
	print(count)

if __name__ == '__main__':
	n = int(input())
	A = list(map(int, input().split()))

	selection_sort(A, n) def selection_sort(A, n):
	count = 0

	for i in range(n-1):
		minj = i
		for j in range(i, n):
			if A[j] < A[minj]:
				minj = j

		if i != minj:
			A[i], A[minj] = A[minj], A[i]
			count += 1

	print(' '.join(map(str, A)))
	print(count) selection_sort count = 0 count 0 for i in range(n-1):
		minj = i
		for j in range(i, n):
			if A[j] < A[minj]:
				minj = j

		if i != minj:
			A[i], A[minj] = A[minj], A[i]
			count += 1

	 i range(n-1) range n-1 n 1 minj = i minj i for j in range(i, n):
			if A[j] < A[minj]:
				minj = j

		 j range(i, n) range i n if A[j] < A[minj]:
				minj = j

		 A[j] < A[minj] A[j] A j A[minj] A minj minj = j minj j if i != minj:
			A[i], A[minj] = A[minj], A[i]
			count += 1

	 i != minj i minj A[i], A[minj] = A[minj], A[i] A[i] A i A[minj] A minj A[minj] A minj A[i] A i count += 1 count 1 print(' '.join(map(str, A))) print ' '.join(map(str, A)) ' '.join ' ' join map(str, A) map str A print(count) print count A A n n if __name__ == '__main__':
	n = int(input())
	A = list(map(int, input().split()))

	selection_sort(A, n) __name__ == '__main__' __name__ '__main__' n = int(input()) n int(input()) int input() input A = list(map(int, input().split())) A list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split selection_sort(A, n) selection_sort A n def selection_sort(A, n):
	count = 0

	for i in range(n-1):
		minj = i
		for j in range(i, n):
			if A[j] < A[minj]:
				minj = j

		if i != minj:
			A[i], A[minj] = A[minj], A[i]
			count += 1

	print(' '.join(map(str, A)))
	print(count) def selection_sort(A, n):
	count = 0

	for i in range(n-1):
		minj = i
		for j in range(i, n):
			if A[j] < A[minj]:
				minj = j

		if i != minj:
			A[i], A[minj] = A[minj], A[i]
			count += 1

	print(' '.join(map(str, A)))
	print(count) selection_sort n = int(input()) int(input()) n A = list(map(int, input().split())) list(map(int, input().split())) A
def selection_sort(A, n):
	count = 0

	for i in range(n-1):
		minj = i
		for j in range(i, n):
			if A[j] < A[minj]:
				minj = j

		if i != minj:
			A[i], A[minj] = A[minj], A[i]
			count += 1

	print(' '.join(map(str, A)))
	print(count)

if __name__ == '__main__':
	n = int(input())
	A = list(map(int, input().split()))

	selection_sort(A, n)