import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int i ,j ,minj ,count=0 ,a;
        int array[] = new int[N];

        for(i = 0;i < N;i++){
            array[i] = sc.nextInt();
        }

        for(i = 0;i < N;i++){
            minj = i;
            for(j = i;j < N;j++){
                if(array[j] < array[minj]){
                    minj = j;
                }
            }
            if(i != minj){
                count++;
                a = array[i];
                array[i] = array[minj];
                array[minj] = a;
            }
        }

        for(i = 0;i < N;i++){
            if(i <= N-2){
                System.out.printf("%d ",array[i]);
            }else{
                System.out.printf("%d\n",array[i]);
            }
        }

        System.out.printf("%d\n",count);
        
    }
} import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int i ,j ,minj ,count=0 ,a;
        int array[] = new int[N];

        for(i = 0;i < N;i++){
            array[i] = sc.nextInt();
        }

        for(i = 0;i < N;i++){
            minj = i;
            for(j = i;j < N;j++){
                if(array[j] < array[minj]){
                    minj = j;
                }
            }
            if(i != minj){
                count++;
                a = array[i];
                array[i] = array[minj];
                array[minj] = a;
            }
        }

        for(i = 0;i < N;i++){
            if(i <= N-2){
                System.out.printf("%d ",array[i]);
            }else{
                System.out.printf("%d\n",array[i]);
            }
        }

        System.out.printf("%d\n",count);
        
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int i ,j ,minj ,count=0 ,a;
        int array[] = new int[N];

        for(i = 0;i < N;i++){
            array[i] = sc.nextInt();
        }

        for(i = 0;i < N;i++){
            minj = i;
            for(j = i;j < N;j++){
                if(array[j] < array[minj]){
                    minj = j;
                }
            }
            if(i != minj){
                count++;
                a = array[i];
                array[i] = array[minj];
                array[minj] = a;
            }
        }

        for(i = 0;i < N;i++){
            if(i <= N-2){
                System.out.printf("%d ",array[i]);
            }else{
                System.out.printf("%d\n",array[i]);
            }
        }

        System.out.printf("%d\n",count);
        
    } main {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int i ,j ,minj ,count=0 ,a;
        int array[] = new int[N];

        for(i = 0;i < N;i++){
            array[i] = sc.nextInt();
        }

        for(i = 0;i < N;i++){
            minj = i;
            for(j = i;j < N;j++){
                if(array[j] < array[minj]){
                    minj = j;
                }
            }
            if(i != minj){
                count++;
                a = array[i];
                array[i] = array[minj];
                array[minj] = a;
            }
        }

        for(i = 0;i < N;i++){
            if(i <= N-2){
                System.out.printf("%d ",array[i]);
            }else{
                System.out.printf("%d\n",array[i]);
            }
        }

        System.out.printf("%d\n",count);
        
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int i i j j minj minj count=0 count 0 a; a int array[] = new int[N]; array new int[N] N for(i = 0;i < N;i++){
            array[i] = sc.nextInt();
        } i = 0; i = 0 i 0 i < N i N i++ i++ i {
            array[i] = sc.nextInt();
        } {
            array[i] = sc.nextInt();
        } array[i] = sc.nextInt() array[i] array i sc.nextInt() sc.nextInt sc for(i = 0;i < N;i++){
            minj = i;
            for(j = i;j < N;j++){
                if(array[j] < array[minj]){
                    minj = j;
                }
            }
            if(i != minj){
                count++;
                a = array[i];
                array[i] = array[minj];
                array[minj] = a;
            }
        } i = 0; i = 0 i 0 i < N i N i++ i++ i {
            minj = i;
            for(j = i;j < N;j++){
                if(array[j] < array[minj]){
                    minj = j;
                }
            }
            if(i != minj){
                count++;
                a = array[i];
                array[i] = array[minj];
                array[minj] = a;
            }
        } {
            minj = i;
            for(j = i;j < N;j++){
                if(array[j] < array[minj]){
                    minj = j;
                }
            }
            if(i != minj){
                count++;
                a = array[i];
                array[i] = array[minj];
                array[minj] = a;
            }
        } minj = i minj i for(j = i;j < N;j++){
                if(array[j] < array[minj]){
                    minj = j;
                }
            } j = i; j = i j i j < N j N j++ j++ j {
                if(array[j] < array[minj]){
                    minj = j;
                }
            } {
                if(array[j] < array[minj]){
                    minj = j;
                }
            } if(array[j] < array[minj]){
                    minj = j;
                } array[j] < array[minj] array[j] array j array[minj] array minj {
                    minj = j;
                } minj = j minj j if(i != minj){
                count++;
                a = array[i];
                array[i] = array[minj];
                array[minj] = a;
            } i != minj i minj {
                count++;
                a = array[i];
                array[i] = array[minj];
                array[minj] = a;
            } count++ count a = array[i] a array[i] array i array[i] = array[minj] array[i] array i array[minj] array minj array[minj] = a array[minj] array minj a for(i = 0;i < N;i++){
            if(i <= N-2){
                System.out.printf("%d ",array[i]);
            }else{
                System.out.printf("%d\n",array[i]);
            }
        } i = 0; i = 0 i 0 i < N i N i++ i++ i {
            if(i <= N-2){
                System.out.printf("%d ",array[i]);
            }else{
                System.out.printf("%d\n",array[i]);
            }
        } {
            if(i <= N-2){
                System.out.printf("%d ",array[i]);
            }else{
                System.out.printf("%d\n",array[i]);
            }
        } if(i <= N-2){
                System.out.printf("%d ",array[i]);
            }else{
                System.out.printf("%d\n",array[i]);
            } i <= N-2 i N-2 N 2 {
                System.out.printf("%d ",array[i]);
            } System.out.printf("%d ",array[i]) System.out.printf System.out System System.out "%d " array[i] array i {
                System.out.printf("%d\n",array[i]);
            } System.out.printf("%d\n",array[i]) System.out.printf System.out System System.out "%d\n" array[i] array i System.out.printf("%d\n",count) System.out.printf System.out System System.out "%d\n" count String[] args args public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int i ,j ,minj ,count=0 ,a;
        int array[] = new int[N];

        for(i = 0;i < N;i++){
            array[i] = sc.nextInt();
        }

        for(i = 0;i < N;i++){
            minj = i;
            for(j = i;j < N;j++){
                if(array[j] < array[minj]){
                    minj = j;
                }
            }
            if(i != minj){
                count++;
                a = array[i];
                array[i] = array[minj];
                array[minj] = a;
            }
        }

        for(i = 0;i < N;i++){
            if(i <= N-2){
                System.out.printf("%d ",array[i]);
            }else{
                System.out.printf("%d\n",array[i]);
            }
        }

        System.out.printf("%d\n",count);
        
    }
} public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int i ,j ,minj ,count=0 ,a;
        int array[] = new int[N];

        for(i = 0;i < N;i++){
            array[i] = sc.nextInt();
        }

        for(i = 0;i < N;i++){
            minj = i;
            for(j = i;j < N;j++){
                if(array[j] < array[minj]){
                    minj = j;
                }
            }
            if(i != minj){
                count++;
                a = array[i];
                array[i] = array[minj];
                array[minj] = a;
            }
        }

        for(i = 0;i < N;i++){
            if(i <= N-2){
                System.out.printf("%d ",array[i]);
            }else{
                System.out.printf("%d\n",array[i]);
            }
        }

        System.out.printf("%d\n",count);
        
    }
} Main
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int i ,j ,minj ,count=0 ,a;
        int array[] = new int[N];

        for(i = 0;i < N;i++){
            array[i] = sc.nextInt();
        }

        for(i = 0;i < N;i++){
            minj = i;
            for(j = i;j < N;j++){
                if(array[j] < array[minj]){
                    minj = j;
                }
            }
            if(i != minj){
                count++;
                a = array[i];
                array[i] = array[minj];
                array[minj] = a;
            }
        }

        for(i = 0;i < N;i++){
            if(i <= N-2){
                System.out.printf("%d ",array[i]);
            }else{
                System.out.printf("%d\n",array[i]);
            }
        }

        System.out.printf("%d\n",count);
        
    }
}
