# coding: utf-8

def selectionSort(A, N):
	A = A[:]
	count = 0
	for i in xrange(N):
		minj = i
		for j in xrange(i, N):
			if A[j] < A[minj]:
				minj = j
		if minj != i:
			A[i], A[minj] = A[minj], A[i]
			count += 1
	return A, count

def main():
	N = input()
	A = map(int, raw_input().split())
	sorted_, count = selectionSort(A, N)
	print ' '.join(map(str, sorted_))
	print count

if __name__ == '__main__':
	main() def selectionSort(A, N):
	A = A[:]
	count = 0
	for i in xrange(N):
		minj = i
		for j in xrange(i, N):
			if A[j] < A[minj]:
				minj = j
		if minj != i:
			A[i], A[minj] = A[minj], A[i]
			count += 1
	return A, count selectionSort A = A[:] A A[:] A : count = 0 count 0 for i in xrange(N):
		minj = i
		for j in xrange(i, N):
			if A[j] < A[minj]:
				minj = j
		if minj != i:
			A[i], A[minj] = A[minj], A[i]
			count += 1
	 i xrange(N) xrange N minj = i minj i for j in xrange(i, N):
			if A[j] < A[minj]:
				minj = j
		 j xrange(i, N) xrange 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 minj != i:
			A[i], A[minj] = A[minj], A[i]
			count += 1
	 minj != i minj i 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 return A, count return A, count A count A A N N def main():
	N = input()
	A = map(int, raw_input().split())
	sorted_, count = selectionSort(A, N)
	print ' '.join(map(str, sorted_))
	print count main N = input() N input() input A = map(int, raw_input().split()) A map(int, raw_input().split()) map int raw_input().split() ().split () raw_input split sorted_, count = selectionSort(A, N) sorted_ selectionSort(A, N) selectionSort A N count print ' '.join(map(str, sorted_)) ' '.join ' ' join map(str, sorted_) map str sorted_ print if __name__ == '__main__':
	main() __name__ == '__main__' __name__ '__main__' main() main def main():
	N = input()
	A = map(int, raw_input().split())
	sorted_, count = selectionSort(A, N)
	print ' '.join(map(str, sorted_))
	print count def main():
	N = input()
	A = map(int, raw_input().split())
	sorted_, count = selectionSort(A, N)
	print ' '.join(map(str, sorted_))
	print count main def selectionSort(A, N):
	A = A[:]
	count = 0
	for i in xrange(N):
		minj = i
		for j in xrange(i, N):
			if A[j] < A[minj]:
				minj = j
		if minj != i:
			A[i], A[minj] = A[minj], A[i]
			count += 1
	return A, count def selectionSort(A, N):
	A = A[:]
	count = 0
	for i in xrange(N):
		minj = i
		for j in xrange(i, N):
			if A[j] < A[minj]:
				minj = j
		if minj != i:
			A[i], A[minj] = A[minj], A[i]
			count += 1
	return A, count selectionSort
# coding: utf-8

def selectionSort(A, N):
	A = A[:]
	count = 0
	for i in xrange(N):
		minj = i
		for j in xrange(i, N):
			if A[j] < A[minj]:
				minj = j
		if minj != i:
			A[i], A[minj] = A[minj], A[i]
			count += 1
	return A, count

def main():
	N = input()
	A = map(int, raw_input().split())
	sorted_, count = selectionSort(A, N)
	print ' '.join(map(str, sorted_))
	print count

if __name__ == '__main__':
	main()