def selection(l):
	N = len(l)
	count = 0

	for i in range(N):
		minj = i

		for j in range(i, N):
			if l[j] < l[minj]:
				minj = j
		if i == minj:
			continue
		else:
			l[i], l[minj] = l[minj], l[i]
			count += 1

	return l, count




if __name__ == '__main__':
	n = int(input())
	l = input().split()

	for i in range(n):
		l[i] = int(l[i])

	l, c = selection(l)
	count = 0
	leng = len(l)
	for i in l:
		count += 1
		if count < leng:
			print(i, end =' ')
		else:
			print(i)
			print(c)
 def selection(l):
	N = len(l)
	count = 0

	for i in range(N):
		minj = i

		for j in range(i, N):
			if l[j] < l[minj]:
				minj = j
		if i == minj:
			continue
		else:
			l[i], l[minj] = l[minj], l[i]
			count += 1

	return l, count selection N = len(l) N len(l) len l count = 0 count 0 for i in range(N):
		minj = i

		for j in range(i, N):
			if l[j] < l[minj]:
				minj = j
		if i == minj:
			continue
		else:
			l[i], l[minj] = l[minj], l[i]
			count += 1

	 i range(N) range N minj = i minj i for j in range(i, N):
			if l[j] < l[minj]:
				minj = j
		 j range(i, N) range i N if l[j] < l[minj]:
				minj = j
		 l[j] < l[minj] l[j] l j l[minj] l minj minj = j minj j if i == minj:
			continue
		else:
			l[i], l[minj] = l[minj], l[i]
			count += 1

	 i == minj i minj continue l[i], l[minj] = l[minj], l[i] l[i] l i l[minj] l minj l[minj] l minj l[i] l i count += 1 count 1 return l, count return l, count l count l l if __name__ == '__main__':
	n = int(input())
	l = input().split()

	for i in range(n):
		l[i] = int(l[i])

	l, c = selection(l)
	count = 0
	leng = len(l)
	for i in l:
		count += 1
		if count < leng:
			print(i, end =' ')
		else:
			print(i)
			print(c) __name__ == '__main__' __name__ '__main__' n = int(input()) n int(input()) int input() input l = input().split() l input().split() ().split () input split for i in range(n):
		l[i] = int(l[i])

	 i range(n) range n l[i] = int(l[i]) l[i] l i int(l[i]) int l[i] l i l, c = selection(l) l selection(l) selection l c count = 0 count 0 leng = len(l) leng len(l) len l for i in l:
		count += 1
		if count < leng:
			print(i, end =' ')
		else:
			print(i)
			print(c) i l count += 1 count 1 if count < leng:
			print(i, end =' ')
		else:
			print(i)
			print(c) count < leng count leng print(i, end =' ') print i end =' ' end ' ' print(i) print i print(c) print c count = 0 0 count count += 1 1 count l, c = selection(l) selection(l) l l = input().split() input().split() l c = selection(l) selection(l) c leng = len(l) len(l) leng def selection(l):
	N = len(l)
	count = 0

	for i in range(N):
		minj = i

		for j in range(i, N):
			if l[j] < l[minj]:
				minj = j
		if i == minj:
			continue
		else:
			l[i], l[minj] = l[minj], l[i]
			count += 1

	return l, count def selection(l):
	N = len(l)
	count = 0

	for i in range(N):
		minj = i

		for j in range(i, N):
			if l[j] < l[minj]:
				minj = j
		if i == minj:
			continue
		else:
			l[i], l[minj] = l[minj], l[i]
			count += 1

	return l, count selection n = int(input()) int(input()) n
def selection(l):
	N = len(l)
	count = 0

	for i in range(N):
		minj = i

		for j in range(i, N):
			if l[j] < l[minj]:
				minj = j
		if i == minj:
			continue
		else:
			l[i], l[minj] = l[minj], l[i]
			count += 1

	return l, count




if __name__ == '__main__':
	n = int(input())
	l = input().split()

	for i in range(n):
		l[i] = int(l[i])

	l, c = selection(l)
	count = 0
	leng = len(l)
	for i in l:
		count += 1
		if count < leng:
			print(i, end =' ')
		else:
			print(i)
			print(c)

