#include <stdio.h>

int t;

selectionSort(int A[],int N){
    int i,j;
    for(i=0;i<N;i++){
        int minj = i;
        for(j=i;j<N;j++){
            if(A[j] < A[minj])
                minj = j;
        }
        if(A[i]!=A[minj]){
            int k;
            k = A[i];
            A[i] = A[minj];
            A[minj] = k;
            t++;
        }
    }
}


int main(void){
    int i;
    int N;
    int A[N];
    scanf("%d",&N);
    for(i=0;i<N;i++){
        scanf("%d",&A[i]);
    }
    selectionSort(A,N);
    for(i=0;i<N;i++){
        printf("%d ",A[i]);
    }
    printf("\n%d\n",t);
    return 0;
}