import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        
        //set array
        String[] st = br.readLine().split(" ");
        int[] array = new int[n];
        for (int i = 0; i < n; i++){
            int a = Integer.parseInt(st[i]);
            array[i] = a;
        }
        
        int count = selectionSort(array);
        System.out.println(mkArrayString(array));
        System.out.println(count);
    }
    static String mkArrayString(int[] arr){
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < arr.length - 1; i++){
            sb.append(arr[i]);
            sb.append(" ");
        }
        sb.append(arr[arr.length - 1]);
        return sb.toString();
    }
    static int selectionSort(int[] arr){
        //selectionSort and return swapcount
        int swapcnt = 0;
        for (int i = 0; i < arr.length; i++){
            int minj = i;
            for (int j = i; j < arr.length; j++){
                if ( arr[j] < arr[minj]){
                    minj = j;
                }
            }
            swap(arr, i, minj);
            if (i != minj) swapcnt += 1;
        }
        return swapcnt;
    }
    static void swap(int[] arr, int i, int j){
        int tmp = arr[i];
        arr[i] = arr[j];
        arr[j] = tmp;
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.IOException; IOException java.io public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        
        //set array
        String[] st = br.readLine().split(" ");
        int[] array = new int[n];
        for (int i = 0; i < n; i++){
            int a = Integer.parseInt(st[i]);
            array[i] = a;
        }
        
        int count = selectionSort(array);
        System.out.println(mkArrayString(array));
        System.out.println(count);
    }
    static String mkArrayString(int[] arr){
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < arr.length - 1; i++){
            sb.append(arr[i]);
            sb.append(" ");
        }
        sb.append(arr[arr.length - 1]);
        return sb.toString();
    }
    static int selectionSort(int[] arr){
        //selectionSort and return swapcount
        int swapcnt = 0;
        for (int i = 0; i < arr.length; i++){
            int minj = i;
            for (int j = i; j < arr.length; j++){
                if ( arr[j] < arr[minj]){
                    minj = j;
                }
            }
            swap(arr, i, minj);
            if (i != minj) swapcnt += 1;
        }
        return swapcnt;
    }
    static void swap(int[] arr, int i, int j){
        int tmp = arr[i];
        arr[i] = arr[j];
        arr[j] = tmp;
    }
} Main public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        
        //set array
        String[] st = br.readLine().split(" ");
        int[] array = new int[n];
        for (int i = 0; i < n; i++){
            int a = Integer.parseInt(st[i]);
            array[i] = a;
        }
        
        int count = selectionSort(array);
        System.out.println(mkArrayString(array));
        System.out.println(count);
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        
        //set array
        String[] st = br.readLine().split(" ");
        int[] array = new int[n];
        for (int i = 0; i < n; i++){
            int a = Integer.parseInt(st[i]);
            array[i] = a;
        }
        
        int count = selectionSort(array);
        System.out.println(mkArrayString(array));
        System.out.println(count);
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int n = Integer.parseInt(br.readLine()); n Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br String[] st = br.readLine().split(" "); st br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int[] array = new int[n]; array new int[n] n for (int i = 0; i < n; i++){
            int a = Integer.parseInt(st[i]);
            array[i] = a;
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            int a = Integer.parseInt(st[i]);
            array[i] = a;
        } {
            int a = Integer.parseInt(st[i]);
            array[i] = a;
        } int a = Integer.parseInt(st[i]); a Integer.parseInt(st[i]) Integer.parseInt Integer st[i] st i array[i] = a array[i] array i a int count = selectionSort(array); count selectionSort(array) selectionSort array System.out.println(mkArrayString(array)) System.out.println System.out System System.out mkArrayString(array) mkArrayString array System.out.println(count) System.out.println System.out System System.out count String[] args args static String mkArrayString(int[] arr){
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < arr.length - 1; i++){
            sb.append(arr[i]);
            sb.append(" ");
        }
        sb.append(arr[arr.length - 1]);
        return sb.toString();
    } mkArrayString {
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < arr.length - 1; i++){
            sb.append(arr[i]);
            sb.append(" ");
        }
        sb.append(arr[arr.length - 1]);
        return sb.toString();
    } StringBuilder sb = new StringBuilder(); sb new StringBuilder() for (int i = 0; i < arr.length - 1; i++){
            sb.append(arr[i]);
            sb.append(" ");
        } int i = 0; int i = 0; i 0 i < arr.length - 1 i arr.length - 1 arr.length arr arr.length 1 i++ i++ i {
            sb.append(arr[i]);
            sb.append(" ");
        } {
            sb.append(arr[i]);
            sb.append(" ");
        } sb.append(arr[i]) sb.append sb arr[i] arr i sb.append(" ") sb.append sb " " sb.append(arr[arr.length - 1]) sb.append sb arr[arr.length - 1] arr arr.length - 1 arr.length arr arr.length 1 return sb.toString(); sb.toString() sb.toString sb int[] arr arr static int selectionSort(int[] arr){
        //selectionSort and return swapcount
        int swapcnt = 0;
        for (int i = 0; i < arr.length; i++){
            int minj = i;
            for (int j = i; j < arr.length; j++){
                if ( arr[j] < arr[minj]){
                    minj = j;
                }
            }
            swap(arr, i, minj);
            if (i != minj) swapcnt += 1;
        }
        return swapcnt;
    } selectionSort {
        //selectionSort and return swapcount
        int swapcnt = 0;
        for (int i = 0; i < arr.length; i++){
            int minj = i;
            for (int j = i; j < arr.length; j++){
                if ( arr[j] < arr[minj]){
                    minj = j;
                }
            }
            swap(arr, i, minj);
            if (i != minj) swapcnt += 1;
        }
        return swapcnt;
    } int swapcnt = 0; swapcnt 0 for (int i = 0; i < arr.length; i++){
            int minj = i;
            for (int j = i; j < arr.length; j++){
                if ( arr[j] < arr[minj]){
                    minj = j;
                }
            }
            swap(arr, i, minj);
            if (i != minj) swapcnt += 1;
        } int i = 0; int i = 0; i 0 i < arr.length i arr.length arr arr.length i++ i++ i {
            int minj = i;
            for (int j = i; j < arr.length; j++){
                if ( arr[j] < arr[minj]){
                    minj = j;
                }
            }
            swap(arr, i, minj);
            if (i != minj) swapcnt += 1;
        } {
            int minj = i;
            for (int j = i; j < arr.length; j++){
                if ( arr[j] < arr[minj]){
                    minj = j;
                }
            }
            swap(arr, i, minj);
            if (i != minj) swapcnt += 1;
        } int minj = i; minj i for (int j = i; j < arr.length; j++){
                if ( arr[j] < arr[minj]){
                    minj = j;
                }
            } int j = i; int j = i; j i j < arr.length j arr.length arr arr.length j++ j++ j {
                if ( arr[j] < arr[minj]){
                    minj = j;
                }
            } {
                if ( arr[j] < arr[minj]){
                    minj = j;
                }
            } if ( arr[j] < arr[minj]){
                    minj = j;
                } arr[j] < arr[minj] arr[j] arr j arr[minj] arr minj {
                    minj = j;
                } minj = j minj j swap(arr, i, minj) swap arr i minj if (i != minj) swapcnt += 1; i != minj i minj swapcnt += 1 swapcnt 1 return swapcnt; swapcnt int[] arr arr static void swap(int[] arr, int i, int j){
        int tmp = arr[i];
        arr[i] = arr[j];
        arr[j] = tmp;
    } swap {
        int tmp = arr[i];
        arr[i] = arr[j];
        arr[j] = tmp;
    } int tmp = arr[i]; tmp arr[i] arr i arr[i] = arr[j] arr[i] arr i arr[j] arr j arr[j] = tmp arr[j] arr j tmp int[] arr arr int i i int j j public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        
        //set array
        String[] st = br.readLine().split(" ");
        int[] array = new int[n];
        for (int i = 0; i < n; i++){
            int a = Integer.parseInt(st[i]);
            array[i] = a;
        }
        
        int count = selectionSort(array);
        System.out.println(mkArrayString(array));
        System.out.println(count);
    }
    static String mkArrayString(int[] arr){
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < arr.length - 1; i++){
            sb.append(arr[i]);
            sb.append(" ");
        }
        sb.append(arr[arr.length - 1]);
        return sb.toString();
    }
    static int selectionSort(int[] arr){
        //selectionSort and return swapcount
        int swapcnt = 0;
        for (int i = 0; i < arr.length; i++){
            int minj = i;
            for (int j = i; j < arr.length; j++){
                if ( arr[j] < arr[minj]){
                    minj = j;
                }
            }
            swap(arr, i, minj);
            if (i != minj) swapcnt += 1;
        }
        return swapcnt;
    }
    static void swap(int[] arr, int i, int j){
        int tmp = arr[i];
        arr[i] = arr[j];
        arr[j] = tmp;
    }
} public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        
        //set array
        String[] st = br.readLine().split(" ");
        int[] array = new int[n];
        for (int i = 0; i < n; i++){
            int a = Integer.parseInt(st[i]);
            array[i] = a;
        }
        
        int count = selectionSort(array);
        System.out.println(mkArrayString(array));
        System.out.println(count);
    }
    static String mkArrayString(int[] arr){
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < arr.length - 1; i++){
            sb.append(arr[i]);
            sb.append(" ");
        }
        sb.append(arr[arr.length - 1]);
        return sb.toString();
    }
    static int selectionSort(int[] arr){
        //selectionSort and return swapcount
        int swapcnt = 0;
        for (int i = 0; i < arr.length; i++){
            int minj = i;
            for (int j = i; j < arr.length; j++){
                if ( arr[j] < arr[minj]){
                    minj = j;
                }
            }
            swap(arr, i, minj);
            if (i != minj) swapcnt += 1;
        }
        return swapcnt;
    }
    static void swap(int[] arr, int i, int j){
        int tmp = arr[i];
        arr[i] = arr[j];
        arr[j] = tmp;
    }
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        
        //set array
        String[] st = br.readLine().split(" ");
        int[] array = new int[n];
        for (int i = 0; i < n; i++){
            int a = Integer.parseInt(st[i]);
            array[i] = a;
        }
        
        int count = selectionSort(array);
        System.out.println(mkArrayString(array));
        System.out.println(count);
    }
    static String mkArrayString(int[] arr){
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < arr.length - 1; i++){
            sb.append(arr[i]);
            sb.append(" ");
        }
        sb.append(arr[arr.length - 1]);
        return sb.toString();
    }
    static int selectionSort(int[] arr){
        //selectionSort and return swapcount
        int swapcnt = 0;
        for (int i = 0; i < arr.length; i++){
            int minj = i;
            for (int j = i; j < arr.length; j++){
                if ( arr[j] < arr[minj]){
                    minj = j;
                }
            }
            swap(arr, i, minj);
            if (i != minj) swapcnt += 1;
        }
        return swapcnt;
    }
    static void swap(int[] arr, int i, int j){
        int tmp = arr[i];
        arr[i] = arr[j];
        arr[j] = tmp;
    }
}