import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc =new Scanner(System.in);
        StringBuilder build = new StringBuilder();
        int z = sc.nextInt();
        int[] ary = new int[z];
        for(int i = 0 ; i < ary.length; i++){
            ary[i] = sc.nextInt();
        }
        int count = 0;
        for(int i = 0; i < ary.length; i++){
            int min = i;
            for(int j = i; j < ary.length; j++){
                if(i != 0){
                    if(ary[min] == ary[i-1]){break;}
                }
                min = ary[min] > ary[j] ? j : min;
            }
            if(ary[i] != ary[min]){
                int temp = ary[i];
                ary[i] = ary[min];
                ary[min] = temp;
                count++;
            }
        }
        for(int i = 0; i < ary.length; i++){
            build.append(ary[i]);
            build.append(i==ary.length-1 ? "\n" : " ");
        }
        build.append(count);
        System.out.println(build.toString());
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc =new Scanner(System.in);
        StringBuilder build = new StringBuilder();
        int z = sc.nextInt();
        int[] ary = new int[z];
        for(int i = 0 ; i < ary.length; i++){
            ary[i] = sc.nextInt();
        }
        int count = 0;
        for(int i = 0; i < ary.length; i++){
            int min = i;
            for(int j = i; j < ary.length; j++){
                if(i != 0){
                    if(ary[min] == ary[i-1]){break;}
                }
                min = ary[min] > ary[j] ? j : min;
            }
            if(ary[i] != ary[min]){
                int temp = ary[i];
                ary[i] = ary[min];
                ary[min] = temp;
                count++;
            }
        }
        for(int i = 0; i < ary.length; i++){
            build.append(ary[i]);
            build.append(i==ary.length-1 ? "\n" : " ");
        }
        build.append(count);
        System.out.println(build.toString());
    }
} Main public static void main(String[] args) {
        Scanner sc =new Scanner(System.in);
        StringBuilder build = new StringBuilder();
        int z = sc.nextInt();
        int[] ary = new int[z];
        for(int i = 0 ; i < ary.length; i++){
            ary[i] = sc.nextInt();
        }
        int count = 0;
        for(int i = 0; i < ary.length; i++){
            int min = i;
            for(int j = i; j < ary.length; j++){
                if(i != 0){
                    if(ary[min] == ary[i-1]){break;}
                }
                min = ary[min] > ary[j] ? j : min;
            }
            if(ary[i] != ary[min]){
                int temp = ary[i];
                ary[i] = ary[min];
                ary[min] = temp;
                count++;
            }
        }
        for(int i = 0; i < ary.length; i++){
            build.append(ary[i]);
            build.append(i==ary.length-1 ? "\n" : " ");
        }
        build.append(count);
        System.out.println(build.toString());
    } main {
        Scanner sc =new Scanner(System.in);
        StringBuilder build = new StringBuilder();
        int z = sc.nextInt();
        int[] ary = new int[z];
        for(int i = 0 ; i < ary.length; i++){
            ary[i] = sc.nextInt();
        }
        int count = 0;
        for(int i = 0; i < ary.length; i++){
            int min = i;
            for(int j = i; j < ary.length; j++){
                if(i != 0){
                    if(ary[min] == ary[i-1]){break;}
                }
                min = ary[min] > ary[j] ? j : min;
            }
            if(ary[i] != ary[min]){
                int temp = ary[i];
                ary[i] = ary[min];
                ary[min] = temp;
                count++;
            }
        }
        for(int i = 0; i < ary.length; i++){
            build.append(ary[i]);
            build.append(i==ary.length-1 ? "\n" : " ");
        }
        build.append(count);
        System.out.println(build.toString());
    } Scanner sc =new Scanner(System.in); sc new Scanner(System.in) StringBuilder build = new StringBuilder(); build new StringBuilder() int z = sc.nextInt(); z sc.nextInt() sc.nextInt sc int[] ary = new int[z]; ary new int[z] z for(int i = 0 ; i < ary.length; i++){
            ary[i] = sc.nextInt();
        } int i = 0 ; int i = 0 ; i 0 i < ary.length i ary.length ary ary.length i++ i++ i {
            ary[i] = sc.nextInt();
        } {
            ary[i] = sc.nextInt();
        } ary[i] = sc.nextInt() ary[i] ary i sc.nextInt() sc.nextInt sc int count = 0; count 0 for(int i = 0; i < ary.length; i++){
            int min = i;
            for(int j = i; j < ary.length; j++){
                if(i != 0){
                    if(ary[min] == ary[i-1]){break;}
                }
                min = ary[min] > ary[j] ? j : min;
            }
            if(ary[i] != ary[min]){
                int temp = ary[i];
                ary[i] = ary[min];
                ary[min] = temp;
                count++;
            }
        } int i = 0; int i = 0; i 0 i < ary.length i ary.length ary ary.length i++ i++ i {
            int min = i;
            for(int j = i; j < ary.length; j++){
                if(i != 0){
                    if(ary[min] == ary[i-1]){break;}
                }
                min = ary[min] > ary[j] ? j : min;
            }
            if(ary[i] != ary[min]){
                int temp = ary[i];
                ary[i] = ary[min];
                ary[min] = temp;
                count++;
            }
        } {
            int min = i;
            for(int j = i; j < ary.length; j++){
                if(i != 0){
                    if(ary[min] == ary[i-1]){break;}
                }
                min = ary[min] > ary[j] ? j : min;
            }
            if(ary[i] != ary[min]){
                int temp = ary[i];
                ary[i] = ary[min];
                ary[min] = temp;
                count++;
            }
        } int min = i; min i for(int j = i; j < ary.length; j++){
                if(i != 0){
                    if(ary[min] == ary[i-1]){break;}
                }
                min = ary[min] > ary[j] ? j : min;
            } int j = i; int j = i; j i j < ary.length j ary.length ary ary.length j++ j++ j {
                if(i != 0){
                    if(ary[min] == ary[i-1]){break;}
                }
                min = ary[min] > ary[j] ? j : min;
            } {
                if(i != 0){
                    if(ary[min] == ary[i-1]){break;}
                }
                min = ary[min] > ary[j] ? j : min;
            } if(i != 0){
                    if(ary[min] == ary[i-1]){break;}
                } i != 0 i 0 {
                    if(ary[min] == ary[i-1]){break;}
                } if(ary[min] == ary[i-1]){break;} ary[min] == ary[i-1] ary[min] ary min ary[i-1] ary i-1 i 1 {break;} break; min = ary[min] > ary[j] ? j : min min ary[min] > ary[j] ? j : min ary[min] > ary[j] ary[min] ary min ary[j] ary j j min if(ary[i] != ary[min]){
                int temp = ary[i];
                ary[i] = ary[min];
                ary[min] = temp;
                count++;
            } ary[i] != ary[min] ary[i] ary i ary[min] ary min {
                int temp = ary[i];
                ary[i] = ary[min];
                ary[min] = temp;
                count++;
            } int temp = ary[i]; temp ary[i] ary i ary[i] = ary[min] ary[i] ary i ary[min] ary min ary[min] = temp ary[min] ary min temp count++ count for(int i = 0; i < ary.length; i++){
            build.append(ary[i]);
            build.append(i==ary.length-1 ? "\n" : " ");
        } int i = 0; int i = 0; i 0 i < ary.length i ary.length ary ary.length i++ i++ i {
            build.append(ary[i]);
            build.append(i==ary.length-1 ? "\n" : " ");
        } {
            build.append(ary[i]);
            build.append(i==ary.length-1 ? "\n" : " ");
        } build.append(ary[i]) build.append build ary[i] ary i build.append(i==ary.length-1 ? "\n" : " ") build.append build i==ary.length-1 ? "\n" : " " i==ary.length-1 i ary.length-1 ary.length ary ary.length 1 "\n" " " build.append(count) build.append build count System.out.println(build.toString()) System.out.println System.out System System.out build.toString() build.toString build String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc =new Scanner(System.in);
        StringBuilder build = new StringBuilder();
        int z = sc.nextInt();
        int[] ary = new int[z];
        for(int i = 0 ; i < ary.length; i++){
            ary[i] = sc.nextInt();
        }
        int count = 0;
        for(int i = 0; i < ary.length; i++){
            int min = i;
            for(int j = i; j < ary.length; j++){
                if(i != 0){
                    if(ary[min] == ary[i-1]){break;}
                }
                min = ary[min] > ary[j] ? j : min;
            }
            if(ary[i] != ary[min]){
                int temp = ary[i];
                ary[i] = ary[min];
                ary[min] = temp;
                count++;
            }
        }
        for(int i = 0; i < ary.length; i++){
            build.append(ary[i]);
            build.append(i==ary.length-1 ? "\n" : " ");
        }
        build.append(count);
        System.out.println(build.toString());
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc =new Scanner(System.in);
        StringBuilder build = new StringBuilder();
        int z = sc.nextInt();
        int[] ary = new int[z];
        for(int i = 0 ; i < ary.length; i++){
            ary[i] = sc.nextInt();
        }
        int count = 0;
        for(int i = 0; i < ary.length; i++){
            int min = i;
            for(int j = i; j < ary.length; j++){
                if(i != 0){
                    if(ary[min] == ary[i-1]){break;}
                }
                min = ary[min] > ary[j] ? j : min;
            }
            if(ary[i] != ary[min]){
                int temp = ary[i];
                ary[i] = ary[min];
                ary[min] = temp;
                count++;
            }
        }
        for(int i = 0; i < ary.length; i++){
            build.append(ary[i]);
            build.append(i==ary.length-1 ? "\n" : " ");
        }
        build.append(count);
        System.out.println(build.toString());
    }
} Main
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc =new Scanner(System.in);
        StringBuilder build = new StringBuilder();
        int z = sc.nextInt();
        int[] ary = new int[z];
        for(int i = 0 ; i < ary.length; i++){
            ary[i] = sc.nextInt();
        }
        int count = 0;
        for(int i = 0; i < ary.length; i++){
            int min = i;
            for(int j = i; j < ary.length; j++){
                if(i != 0){
                    if(ary[min] == ary[i-1]){break;}
                }
                min = ary[min] > ary[j] ? j : min;
            }
            if(ary[i] != ary[min]){
                int temp = ary[i];
                ary[i] = ary[min];
                ary[min] = temp;
                count++;
            }
        }
        for(int i = 0; i < ary.length; i++){
            build.append(ary[i]);
            build.append(i==ary.length-1 ? "\n" : " ");
        }
        build.append(count);
        System.out.println(build.toString());
    }
}