def selection_sort(List):
	cnt = 0
	l=len(List)
	for i in range(l):
		num_index=i
		for j in range(i,l):
			if List[num_index]>List[j]:
				num_index=j
		if num_index != i:
			temp=List[num_index]
			List[num_index]=List[i]
			List[i]=temp
			cnt+=1
	return cnt
N=input()
N_List=map(int,raw_input().split())
cnt=selection_sort(N_List)
print(" ".join(map(str,N_List)))
print(cnt) def selection_sort(List):
	cnt = 0
	l=len(List)
	for i in range(l):
		num_index=i
		for j in range(i,l):
			if List[num_index]>List[j]:
				num_index=j
		if num_index != i:
			temp=List[num_index]
			List[num_index]=List[i]
			List[i]=temp
			cnt+=1
	return cnt selection_sort cnt = 0 cnt 0 l=len(List) l len(List) len List for i in range(l):
		num_index=i
		for j in range(i,l):
			if List[num_index]>List[j]:
				num_index=j
		if num_index != i:
			temp=List[num_index]
			List[num_index]=List[i]
			List[i]=temp
			cnt+=1
	 i range(l) range l num_index=i num_index i for j in range(i,l):
			if List[num_index]>List[j]:
				num_index=j
		 j range(i,l) range i l if List[num_index]>List[j]:
				num_index=j
		 List[num_index]>List[j] List[num_index] List num_index List[j] List j num_index=j num_index j if num_index != i:
			temp=List[num_index]
			List[num_index]=List[i]
			List[i]=temp
			cnt+=1
	 num_index != i num_index i temp=List[num_index] temp List[num_index] List num_index List[num_index]=List[i] List[num_index] List num_index List[i] List i List[i]=temp List[i] List i temp cnt+=1 cnt 1 return cnt cnt List List N=input() N input() input N_List=map(int,raw_input().split()) N_List map(int,raw_input().split()) map int raw_input().split() ().split () raw_input split cnt=selection_sort(N_List) cnt selection_sort(N_List) selection_sort N_List print(" ".join(map(str,N_List))) print " ".join(map(str,N_List)) " ".join " " join map(str,N_List) map str N_List print(cnt) print cnt N_List=map(int,raw_input().split()) map(int,raw_input().split()) N_List cnt=selection_sort(N_List) selection_sort(N_List) cnt def selection_sort(List):
	cnt = 0
	l=len(List)
	for i in range(l):
		num_index=i
		for j in range(i,l):
			if List[num_index]>List[j]:
				num_index=j
		if num_index != i:
			temp=List[num_index]
			List[num_index]=List[i]
			List[i]=temp
			cnt+=1
	return cnt def selection_sort(List):
	cnt = 0
	l=len(List)
	for i in range(l):
		num_index=i
		for j in range(i,l):
			if List[num_index]>List[j]:
				num_index=j
		if num_index != i:
			temp=List[num_index]
			List[num_index]=List[i]
			List[i]=temp
			cnt+=1
	return cnt selection_sort N=input() input() N
def selection_sort(List):
	cnt = 0
	l=len(List)
	for i in range(l):
		num_index=i
		for j in range(i,l):
			if List[num_index]>List[j]:
				num_index=j
		if num_index != i:
			temp=List[num_index]
			List[num_index]=List[i]
			List[i]=temp
			cnt+=1
	return cnt
N=input()
N_List=map(int,raw_input().split())
cnt=selection_sort(N_List)
print(" ".join(map(str,N_List)))
print(cnt)