#include <stdio.h>

void swap(int *a, int *b) {
  int k;
	k = *a;
	*a = *b;
	*b = k;
}

int selectionSort(int R[],int N) {
  int i,j,minj;
  int count = 0;
  int h = 0;
  for (i = 0; i < N; i++) {
 	minj = i;
	for (j = i; j < N; j++) {
		if (R[j] < R[minj]) {
                minj = j;
			}
		}
		if (minj != i) {
			swap(&R[i], &R[minj]);
			count++;
		}
	}
	return count;
}

int main(void) {

	int N;
	scanf("%d",&N);

	int R[100];

	int t,k,x;
	for (t = 0; t < N ; t++) {
            scanf("%d", &R[t]);}
	
	x = selectionSort(R, N);
	
	for (k = 0; k < N; k++) {
		printf("%d ", R[k]);
	}
	printf("\n%d",x);
	return 0;
	
	}


