import java.io.*;

class Main {
    public static void main (String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int N = Integer.parseInt(br.readLine());
        String[] element = br.readLine().split(" ");
        int[] A = new int[N];
        for (int i = 0; i < N; i++) {
            A[i] = Integer.parseInt(element[i]);
        }
        
        int count = selectionSort(A);

        StringBuilder output = new StringBuilder("");
        for (int i = 0; i < N; i++) {
            output.append(A[i]);
            if (i != N-1) {
                output.append(" ");
            }
        }
        System.out.println(output.toString());
        System.out.println(count);
    }

    public static int selectionSort (int[] a) {
        int i, j, temp;
        int n = a.length;
        int count = 0;
        int mini;
        for (i = 0; i < n; i++) {
            mini = i;
            for (j = i; j < n; j++) {
                if (a[j] < a[mini]) {
                    mini = j;
                }
            }
            if (i != mini) {
                temp = a[i];
                a[i] = a[mini];
                a[mini] = temp;
                count++;
            }
        }
        return count;
    }
} import java.io.*; io.* java class Main {
    public static void main (String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int N = Integer.parseInt(br.readLine());
        String[] element = br.readLine().split(" ");
        int[] A = new int[N];
        for (int i = 0; i < N; i++) {
            A[i] = Integer.parseInt(element[i]);
        }
        
        int count = selectionSort(A);

        StringBuilder output = new StringBuilder("");
        for (int i = 0; i < N; i++) {
            output.append(A[i]);
            if (i != N-1) {
                output.append(" ");
            }
        }
        System.out.println(output.toString());
        System.out.println(count);
    }

    public static int selectionSort (int[] a) {
        int i, j, temp;
        int n = a.length;
        int count = 0;
        int mini;
        for (i = 0; i < n; i++) {
            mini = i;
            for (j = i; j < n; j++) {
                if (a[j] < a[mini]) {
                    mini = j;
                }
            }
            if (i != mini) {
                temp = a[i];
                a[i] = a[mini];
                a[mini] = temp;
                count++;
            }
        }
        return count;
    }
} Main public static void main (String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int N = Integer.parseInt(br.readLine());
        String[] element = br.readLine().split(" ");
        int[] A = new int[N];
        for (int i = 0; i < N; i++) {
            A[i] = Integer.parseInt(element[i]);
        }
        
        int count = selectionSort(A);

        StringBuilder output = new StringBuilder("");
        for (int i = 0; i < N; i++) {
            output.append(A[i]);
            if (i != N-1) {
                output.append(" ");
            }
        }
        System.out.println(output.toString());
        System.out.println(count);
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int N = Integer.parseInt(br.readLine());
        String[] element = br.readLine().split(" ");
        int[] A = new int[N];
        for (int i = 0; i < N; i++) {
            A[i] = Integer.parseInt(element[i]);
        }
        
        int count = selectionSort(A);

        StringBuilder output = new StringBuilder("");
        for (int i = 0; i < N; i++) {
            output.append(A[i]);
            if (i != N-1) {
                output.append(" ");
            }
        }
        System.out.println(output.toString());
        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[] element = br.readLine().split(" "); element br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int[] A = new int[N]; A new int[N] N for (int i = 0; i < N; i++) {
            A[i] = Integer.parseInt(element[i]);
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            A[i] = Integer.parseInt(element[i]);
        } {
            A[i] = Integer.parseInt(element[i]);
        } A[i] = Integer.parseInt(element[i]) A[i] A i Integer.parseInt(element[i]) Integer.parseInt Integer element[i] element i int count = selectionSort(A); count selectionSort(A) selectionSort A StringBuilder output = new StringBuilder(""); output new StringBuilder("") for (int i = 0; i < N; i++) {
            output.append(A[i]);
            if (i != N-1) {
                output.append(" ");
            }
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            output.append(A[i]);
            if (i != N-1) {
                output.append(" ");
            }
        } {
            output.append(A[i]);
            if (i != N-1) {
                output.append(" ");
            }
        } output.append(A[i]) output.append output A[i] A i if (i != N-1) {
                output.append(" ");
            } i != N-1 i N-1 N 1 {
                output.append(" ");
            } output.append(" ") output.append output " " System.out.println(output.toString()) System.out.println System.out System System.out output.toString() output.toString output System.out.println(count) System.out.println System.out System System.out count String[] args args public static int selectionSort (int[] a) {
        int i, j, temp;
        int n = a.length;
        int count = 0;
        int mini;
        for (i = 0; i < n; i++) {
            mini = i;
            for (j = i; j < n; j++) {
                if (a[j] < a[mini]) {
                    mini = j;
                }
            }
            if (i != mini) {
                temp = a[i];
                a[i] = a[mini];
                a[mini] = temp;
                count++;
            }
        }
        return count;
    } selectionSort {
        int i, j, temp;
        int n = a.length;
        int count = 0;
        int mini;
        for (i = 0; i < n; i++) {
            mini = i;
            for (j = i; j < n; j++) {
                if (a[j] < a[mini]) {
                    mini = j;
                }
            }
            if (i != mini) {
                temp = a[i];
                a[i] = a[mini];
                a[mini] = temp;
                count++;
            }
        }
        return count;
    } int i i j j temp; temp int n = a.length; n a.length a a.length int count = 0; count 0 int mini; mini for (i = 0; i < n; i++) {
            mini = i;
            for (j = i; j < n; j++) {
                if (a[j] < a[mini]) {
                    mini = j;
                }
            }
            if (i != mini) {
                temp = a[i];
                a[i] = a[mini];
                a[mini] = temp;
                count++;
            }
        } i = 0; i = 0 i 0 i < n i n i++ i++ i {
            mini = i;
            for (j = i; j < n; j++) {
                if (a[j] < a[mini]) {
                    mini = j;
                }
            }
            if (i != mini) {
                temp = a[i];
                a[i] = a[mini];
                a[mini] = temp;
                count++;
            }
        } {
            mini = i;
            for (j = i; j < n; j++) {
                if (a[j] < a[mini]) {
                    mini = j;
                }
            }
            if (i != mini) {
                temp = a[i];
                a[i] = a[mini];
                a[mini] = temp;
                count++;
            }
        } mini = i mini i for (j = i; j < n; j++) {
                if (a[j] < a[mini]) {
                    mini = j;
                }
            } j = i; j = i j i j < n j n j++ j++ j {
                if (a[j] < a[mini]) {
                    mini = j;
                }
            } {
                if (a[j] < a[mini]) {
                    mini = j;
                }
            } if (a[j] < a[mini]) {
                    mini = j;
                } a[j] < a[mini] a[j] a j a[mini] a mini {
                    mini = j;
                } mini = j mini j if (i != mini) {
                temp = a[i];
                a[i] = a[mini];
                a[mini] = temp;
                count++;
            } i != mini i mini {
                temp = a[i];
                a[i] = a[mini];
                a[mini] = temp;
                count++;
            } temp = a[i] temp a[i] a i a[i] = a[mini] a[i] a i a[mini] a mini a[mini] = temp a[mini] a mini temp count++ count return count; count int[] a a
import java.io.*;

class Main {
    public static void main (String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int N = Integer.parseInt(br.readLine());
        String[] element = br.readLine().split(" ");
        int[] A = new int[N];
        for (int i = 0; i < N; i++) {
            A[i] = Integer.parseInt(element[i]);
        }
        
        int count = selectionSort(A);

        StringBuilder output = new StringBuilder("");
        for (int i = 0; i < N; i++) {
            output.append(A[i]);
            if (i != N-1) {
                output.append(" ");
            }
        }
        System.out.println(output.toString());
        System.out.println(count);
    }

    public static int selectionSort (int[] a) {
        int i, j, temp;
        int n = a.length;
        int count = 0;
        int mini;
        for (i = 0; i < n; i++) {
            mini = i;
            for (j = i; j < n; j++) {
                if (a[j] < a[mini]) {
                    mini = j;
                }
            }
            if (i != mini) {
                temp = a[i];
                a[i] = a[mini];
                a[mini] = temp;
                count++;
            }
        }
        return count;
    }
}