#include<stdio.h>

void trace(int A[], int N){
    int i ;
    printf("%d", A[0]);
    for(i=1; i<N;i++){
        if(i>0){
            printf(" %d\n", A[i]);
        }
    }
    printf("\n");
}
void intsertionSort(int A[], int N){
    int i,j,minj,count=0;
    for(i=1;i<=N-1;i++){
        minj = i;
        for(j=i;j<=N-1;j++){
            if (A[j] < A[minj]){
                minj = j;
            }
        }
        A[minj]=A[i];
        count++;
    }
    trace(A,N);
    printf("%d",count);
    printf("\n");
}

int main(){
    int a,i,num[100];
    scanf("%d",&a);
    for(i=0;i<a;i++){
        scanf("%d",&num[i]);        
    }
    intsertionSort(num,a);

}