#include <stdio.h>
#define N 100

void selectionSort(int*,int);

int main(void){

	int A[N],n;
	int i=0;

	scanf("%d",&n);

	for(i = 0; i < n; i++){
		scanf("%d",&A[i]);
	}

	selectionSort(A,n);

	return 0;
}

void selectionSort(int *A, int n){

	int i,j,swap,minj,count=0;
	int a;

	//????´???????????????????
	for(i = 0; i < n; i++){
		//??????????´????????°??????¨?????????????????????????????????
		minj = i;
		//????°?????????????????????????????????????????????????
		for(j = i+1; j < n; j++){
			if(A[j] < A[minj]){
				minj = j;	
			}
		}
		if(i != minj){
			swap = A[i];
			A[i] = A[minj];
			A[minj] = swap;
			count++;
		}
	}

	for (i = 0; i < n-1; i++){
		printf("%d ",A[i]);
	}
	printf("%d\n",A[n-1]);
	printf("%d\n",count);
}