import java.util.Scanner;

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

        int n = Integer.parseInt(sc.nextLine());
        String[] input = sc.nextLine().split(" ");
        int[] array = new int[n];
        
        for(int i = 0; i < n; i++){
            array[i] = Integer.parseInt(input[i]);
        }

        int count = 0;

        for(int i = 0; i < n; i++){
            int minj = i;
            for(int j = i; j < n; j++){
                if(array[j] < array[minj]){
                    minj = j;
                }
            }
            if(i != minj){
                int tmp = array[i];
                array[i] = array[minj];
                array[minj] = tmp;
                count++;
            }
        }

        StringBuilder sb = new StringBuilder();
        for(int i : array){
            sb.append(i + " ");
        }

        System.out.println(sb.deleteCharAt(sb.length()-1));
        System.out.println(count);
        
    }
} import java.util.Scanner; Scanner java.util class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int n = Integer.parseInt(sc.nextLine());
        String[] input = sc.nextLine().split(" ");
        int[] array = new int[n];
        
        for(int i = 0; i < n; i++){
            array[i] = Integer.parseInt(input[i]);
        }

        int count = 0;

        for(int i = 0; i < n; i++){
            int minj = i;
            for(int j = i; j < n; j++){
                if(array[j] < array[minj]){
                    minj = j;
                }
            }
            if(i != minj){
                int tmp = array[i];
                array[i] = array[minj];
                array[minj] = tmp;
                count++;
            }
        }

        StringBuilder sb = new StringBuilder();
        for(int i : array){
            sb.append(i + " ");
        }

        System.out.println(sb.deleteCharAt(sb.length()-1));
        System.out.println(count);
        
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int n = Integer.parseInt(sc.nextLine());
        String[] input = sc.nextLine().split(" ");
        int[] array = new int[n];
        
        for(int i = 0; i < n; i++){
            array[i] = Integer.parseInt(input[i]);
        }

        int count = 0;

        for(int i = 0; i < n; i++){
            int minj = i;
            for(int j = i; j < n; j++){
                if(array[j] < array[minj]){
                    minj = j;
                }
            }
            if(i != minj){
                int tmp = array[i];
                array[i] = array[minj];
                array[minj] = tmp;
                count++;
            }
        }

        StringBuilder sb = new StringBuilder();
        for(int i : array){
            sb.append(i + " ");
        }

        System.out.println(sb.deleteCharAt(sb.length()-1));
        System.out.println(count);
        
    } main {
        Scanner sc = new Scanner(System.in);

        int n = Integer.parseInt(sc.nextLine());
        String[] input = sc.nextLine().split(" ");
        int[] array = new int[n];
        
        for(int i = 0; i < n; i++){
            array[i] = Integer.parseInt(input[i]);
        }

        int count = 0;

        for(int i = 0; i < n; i++){
            int minj = i;
            for(int j = i; j < n; j++){
                if(array[j] < array[minj]){
                    minj = j;
                }
            }
            if(i != minj){
                int tmp = array[i];
                array[i] = array[minj];
                array[minj] = tmp;
                count++;
            }
        }

        StringBuilder sb = new StringBuilder();
        for(int i : array){
            sb.append(i + " ");
        }

        System.out.println(sb.deleteCharAt(sb.length()-1));
        System.out.println(count);
        
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = Integer.parseInt(sc.nextLine()); n Integer.parseInt(sc.nextLine()) Integer.parseInt Integer sc.nextLine() sc.nextLine sc String[] input = sc.nextLine().split(" "); input sc.nextLine().split(" ") sc.nextLine().split sc.nextLine() sc.nextLine sc " " int[] array = new int[n]; array new int[n] n for(int i = 0; i < n; i++){
            array[i] = Integer.parseInt(input[i]);
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            array[i] = Integer.parseInt(input[i]);
        } {
            array[i] = Integer.parseInt(input[i]);
        } array[i] = Integer.parseInt(input[i]) array[i] array i Integer.parseInt(input[i]) Integer.parseInt Integer input[i] input i int count = 0; count 0 for(int i = 0; i < n; i++){
            int minj = i;
            for(int j = i; j < n; j++){
                if(array[j] < array[minj]){
                    minj = j;
                }
            }
            if(i != minj){
                int tmp = array[i];
                array[i] = array[minj];
                array[minj] = tmp;
                count++;
            }
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            int minj = i;
            for(int j = i; j < n; j++){
                if(array[j] < array[minj]){
                    minj = j;
                }
            }
            if(i != minj){
                int tmp = array[i];
                array[i] = array[minj];
                array[minj] = tmp;
                count++;
            }
        } {
            int minj = i;
            for(int j = i; j < n; j++){
                if(array[j] < array[minj]){
                    minj = j;
                }
            }
            if(i != minj){
                int tmp = array[i];
                array[i] = array[minj];
                array[minj] = tmp;
                count++;
            }
        } int minj = i; minj i for(int j = i; j < n; j++){
                if(array[j] < array[minj]){
                    minj = j;
                }
            } int j = i; int 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){
                int tmp = array[i];
                array[i] = array[minj];
                array[minj] = tmp;
                count++;
            } i != minj i minj {
                int tmp = array[i];
                array[i] = array[minj];
                array[minj] = tmp;
                count++;
            } int tmp = array[i]; tmp array[i] array i array[i] = array[minj] array[i] array i array[minj] array minj array[minj] = tmp array[minj] array minj tmp count++ count StringBuilder sb = new StringBuilder(); sb new StringBuilder() for(int i : array){
            sb.append(i + " ");
        } int i array {
            sb.append(i + " ");
        } {
            sb.append(i + " ");
        } sb.append(i + " ") sb.append sb i + " " i " " System.out.println(sb.deleteCharAt(sb.length()-1)) System.out.println System.out System System.out sb.deleteCharAt(sb.length()-1) sb.deleteCharAt sb sb.length()-1 sb.length() sb.length sb 1 System.out.println(count) System.out.println System.out System System.out count String[] args args
import java.util.Scanner;

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

        int n = Integer.parseInt(sc.nextLine());
        String[] input = sc.nextLine().split(" ");
        int[] array = new int[n];
        
        for(int i = 0; i < n; i++){
            array[i] = Integer.parseInt(input[i]);
        }

        int count = 0;

        for(int i = 0; i < n; i++){
            int minj = i;
            for(int j = i; j < n; j++){
                if(array[j] < array[minj]){
                    minj = j;
                }
            }
            if(i != minj){
                int tmp = array[i];
                array[i] = array[minj];
                array[minj] = tmp;
                count++;
            }
        }

        StringBuilder sb = new StringBuilder();
        for(int i : array){
            sb.append(i + " ");
        }

        System.out.println(sb.deleteCharAt(sb.length()-1));
        System.out.println(count);
        
    }
}
