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

int main()
{
  int n, i, j, swap, minj, count = 0;
  int A[N];
  scanf("%d", &n);
  for(i = 0; i < n; i++) scanf("%d", &A[i]);

  for(i = 0; i < n-1; i++){

    minj = i;
    for(j =i; j <= n-1; j++){
      if( A[j] < A[minj] ){
	minj = j;
      }
    }
	if(minj != i){
	swap = A[i];
	A[i] = A[minj];
	A[minj] = swap;
	minj = i;
	count++;
	
      }
     
    }
  trace(A, n);
  printf("%d\n", count);  
  
  return 0;
}

  