//warota!w

#include <stdio.h>
 
int N = 100;
 
void out(int A[], int n){
  int i;
  for (i=0;i<n;i++){
    if (i>0) printf(" ");
    printf("%d", A[i]);
  }
  printf("\n");
}
void swap(int *x, int *y){
	int tmp;
	tmp = *x;
	*x = *y;
	*y = tmp;
}

void selectionSort(int* A, int n){
  //???????????????????????????????????????????°?????????????????????\??????????????°?????????
  int i, j, min, count=0;
  for(i=0;i < n-1;i++){
  	min = i;
  	for(j=i+1; j<n; j++){
  		if(A[j] < A[min]){
  			min = j;
  		}
  	}
  	//????°??????¨??????
  	if(min!=i){
  		swap(&A[i], &A[min]);
  		count++;
  		//out(A, n);
  	}
  }
  out(A, n);
  printf("%d\n", count);
}
 
int main(void){
  int n, i;
  int A[N+1];
  scanf("%d", &n);
 
  for (i=0;i<n;i++) scanf("%d", &A[i]); //data input
  selectionSort(A, n);
 
  return 0;
}