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

/**
 * Created by hwzheng on 2017/3/27.
 */
public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader Reader = new BufferedReader (new InputStreamReader(System.in));
        int N = Integer.parseInt(Reader.readLine());
        String A[] = Reader.readLine().split(" ",0);
        int[] arr = new int[N];
        for (int i=0; i < N; i++){
            arr[i] = Integer.parseInt(A[i]);
        }
        selectionSort(arr,N);
    }

    private static void selectionSort(int[] arr, int N){
        int count = 0;
        for (int i = 0; i < N; i++){
            int min = i;
            for (int j = i; j < N; j++){
                if (arr[j] < arr[min]){
                    min = j;
                }
            }
            if (min != i){
                exch(arr, min, i);
                count++;
            }
        }
        String str = "";
        for (int i = 0; i < arr.length; i++){
            str += arr[i] + " ";
        }
        System.out.println(str.substring(0,str.length()-1));
        System.out.println(count);
    }

    private static void exch(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.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader Reader = new BufferedReader (new InputStreamReader(System.in));
        int N = Integer.parseInt(Reader.readLine());
        String A[] = Reader.readLine().split(" ",0);
        int[] arr = new int[N];
        for (int i=0; i < N; i++){
            arr[i] = Integer.parseInt(A[i]);
        }
        selectionSort(arr,N);
    }

    private static void selectionSort(int[] arr, int N){
        int count = 0;
        for (int i = 0; i < N; i++){
            int min = i;
            for (int j = i; j < N; j++){
                if (arr[j] < arr[min]){
                    min = j;
                }
            }
            if (min != i){
                exch(arr, min, i);
                count++;
            }
        }
        String str = "";
        for (int i = 0; i < arr.length; i++){
            str += arr[i] + " ";
        }
        System.out.println(str.substring(0,str.length()-1));
        System.out.println(count);
    }

    private static void exch(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 Reader = new BufferedReader (new InputStreamReader(System.in));
        int N = Integer.parseInt(Reader.readLine());
        String A[] = Reader.readLine().split(" ",0);
        int[] arr = new int[N];
        for (int i=0; i < N; i++){
            arr[i] = Integer.parseInt(A[i]);
        }
        selectionSort(arr,N);
    } main {
        BufferedReader Reader = new BufferedReader (new InputStreamReader(System.in));
        int N = Integer.parseInt(Reader.readLine());
        String A[] = Reader.readLine().split(" ",0);
        int[] arr = new int[N];
        for (int i=0; i < N; i++){
            arr[i] = Integer.parseInt(A[i]);
        }
        selectionSort(arr,N);
    } BufferedReader Reader = new BufferedReader (new InputStreamReader(System.in)); Reader new BufferedReader (new InputStreamReader(System.in)) int N = Integer.parseInt(Reader.readLine()); N Integer.parseInt(Reader.readLine()) Integer.parseInt Integer Reader.readLine() Reader.readLine Reader String A[] = Reader.readLine().split(" ",0); A Reader.readLine().split(" ",0) Reader.readLine().split Reader.readLine() Reader.readLine Reader " " 0 int[] arr = new int[N]; arr new int[N] N for (int i=0; i < N; i++){
            arr[i] = Integer.parseInt(A[i]);
        } int i=0; int i=0; i 0 i < N i N i++ i++ i {
            arr[i] = Integer.parseInt(A[i]);
        } {
            arr[i] = Integer.parseInt(A[i]);
        } arr[i] = Integer.parseInt(A[i]) arr[i] arr i Integer.parseInt(A[i]) Integer.parseInt Integer A[i] A i selectionSort(arr,N) selectionSort arr N String[] args args private static void selectionSort(int[] arr, int N){
        int count = 0;
        for (int i = 0; i < N; i++){
            int min = i;
            for (int j = i; j < N; j++){
                if (arr[j] < arr[min]){
                    min = j;
                }
            }
            if (min != i){
                exch(arr, min, i);
                count++;
            }
        }
        String str = "";
        for (int i = 0; i < arr.length; i++){
            str += arr[i] + " ";
        }
        System.out.println(str.substring(0,str.length()-1));
        System.out.println(count);
    } selectionSort {
        int count = 0;
        for (int i = 0; i < N; i++){
            int min = i;
            for (int j = i; j < N; j++){
                if (arr[j] < arr[min]){
                    min = j;
                }
            }
            if (min != i){
                exch(arr, min, i);
                count++;
            }
        }
        String str = "";
        for (int i = 0; i < arr.length; i++){
            str += arr[i] + " ";
        }
        System.out.println(str.substring(0,str.length()-1));
        System.out.println(count);
    } int count = 0; count 0 for (int i = 0; i < N; i++){
            int min = i;
            for (int j = i; j < N; j++){
                if (arr[j] < arr[min]){
                    min = j;
                }
            }
            if (min != i){
                exch(arr, min, i);
                count++;
            }
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            int min = i;
            for (int j = i; j < N; j++){
                if (arr[j] < arr[min]){
                    min = j;
                }
            }
            if (min != i){
                exch(arr, min, i);
                count++;
            }
        } {
            int min = i;
            for (int j = i; j < N; j++){
                if (arr[j] < arr[min]){
                    min = j;
                }
            }
            if (min != i){
                exch(arr, min, i);
                count++;
            }
        } int min = i; min i for (int j = i; j < N; j++){
                if (arr[j] < arr[min]){
                    min = j;
                }
            } int j = i; int j = i; j i j < N j N j++ j++ j {
                if (arr[j] < arr[min]){
                    min = j;
                }
            } {
                if (arr[j] < arr[min]){
                    min = j;
                }
            } if (arr[j] < arr[min]){
                    min = j;
                } arr[j] < arr[min] arr[j] arr j arr[min] arr min {
                    min = j;
                } min = j min j if (min != i){
                exch(arr, min, i);
                count++;
            } min != i min i {
                exch(arr, min, i);
                count++;
            } exch(arr, min, i) exch arr min i count++ count String str = ""; str "" for (int i = 0; i < arr.length; i++){
            str += arr[i] + " ";
        } int i = 0; int i = 0; i 0 i < arr.length i arr.length arr arr.length i++ i++ i {
            str += arr[i] + " ";
        } {
            str += arr[i] + " ";
        } str += arr[i] + " " str arr[i] + " " arr[i] arr i " " System.out.println(str.substring(0,str.length()-1)) System.out.println System.out System System.out str.substring(0,str.length()-1) str.substring str 0 str.length()-1 str.length() str.length str 1 System.out.println(count) System.out.println System.out System System.out count int[] arr arr int N N private static void exch(int[] arr, int i, int j){
        int tmp = arr[i];
        arr[i] = arr[j];
        arr[j] = tmp;
    } exch {
        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 Reader = new BufferedReader (new InputStreamReader(System.in));
        int N = Integer.parseInt(Reader.readLine());
        String A[] = Reader.readLine().split(" ",0);
        int[] arr = new int[N];
        for (int i=0; i < N; i++){
            arr[i] = Integer.parseInt(A[i]);
        }
        selectionSort(arr,N);
    }

    private static void selectionSort(int[] arr, int N){
        int count = 0;
        for (int i = 0; i < N; i++){
            int min = i;
            for (int j = i; j < N; j++){
                if (arr[j] < arr[min]){
                    min = j;
                }
            }
            if (min != i){
                exch(arr, min, i);
                count++;
            }
        }
        String str = "";
        for (int i = 0; i < arr.length; i++){
            str += arr[i] + " ";
        }
        System.out.println(str.substring(0,str.length()-1));
        System.out.println(count);
    }

    private static void exch(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 Reader = new BufferedReader (new InputStreamReader(System.in));
        int N = Integer.parseInt(Reader.readLine());
        String A[] = Reader.readLine().split(" ",0);
        int[] arr = new int[N];
        for (int i=0; i < N; i++){
            arr[i] = Integer.parseInt(A[i]);
        }
        selectionSort(arr,N);
    }

    private static void selectionSort(int[] arr, int N){
        int count = 0;
        for (int i = 0; i < N; i++){
            int min = i;
            for (int j = i; j < N; j++){
                if (arr[j] < arr[min]){
                    min = j;
                }
            }
            if (min != i){
                exch(arr, min, i);
                count++;
            }
        }
        String str = "";
        for (int i = 0; i < arr.length; i++){
            str += arr[i] + " ";
        }
        System.out.println(str.substring(0,str.length()-1));
        System.out.println(count);
    }

    private static void exch(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.IOException;
import java.io.InputStreamReader;

/**
 * Created by hwzheng on 2017/3/27.
 */
public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader Reader = new BufferedReader (new InputStreamReader(System.in));
        int N = Integer.parseInt(Reader.readLine());
        String A[] = Reader.readLine().split(" ",0);
        int[] arr = new int[N];
        for (int i=0; i < N; i++){
            arr[i] = Integer.parseInt(A[i]);
        }
        selectionSort(arr,N);
    }

    private static void selectionSort(int[] arr, int N){
        int count = 0;
        for (int i = 0; i < N; i++){
            int min = i;
            for (int j = i; j < N; j++){
                if (arr[j] < arr[min]){
                    min = j;
                }
            }
            if (min != i){
                exch(arr, min, i);
                count++;
            }
        }
        String str = "";
        for (int i = 0; i < arr.length; i++){
            str += arr[i] + " ";
        }
        System.out.println(str.substring(0,str.length()-1));
        System.out.println(count);
    }

    private static void exch(int[] arr, int i, int j){
        int tmp = arr[i];
        arr[i] = arr[j];
        arr[j] = tmp;
    }
}