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

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = ip(br.readLine());
        int[] list = createListInt(br.readLine());
        selectionSort(list, n);

    }

    static void selectionSort(int[] list, int n) {
        int count = 0;
        for (int i = 0; i < n; i++) {
            int minj = i;
            for (int j = i + 1; j < n; j++) {
                if (list[j] < list[minj]) {
                    minj = j;
                }
            }
            if (i != minj) {
                swap(list, i, minj);
                count++;
            }
        }
        print(list);
        System.out.println(count);
    }

    static void bubbleSort(int[] list, int n) {
        int count = 0;
        boolean flag = true;
        while (flag) {
            flag = false;
            for (int i = n - 1; i > 0; i--) {
                if (list[i] < list[i - 1]) {
                    swap(list, i, i - 1);
                    flag = true;
                    count++;
                }
            }
        }
        print(list);
        System.out.println(count);
    }

    private static void print(int[] list) {
        int n = list.length;
        for (int i = 0; i < n; i++) {
            System.out.print(list[i]);
            if (i < n - 1) {
                System.out.print(" ");
            }
        }
        System.out.println();
    }

    static void swap(int[] list, int a, int b) {
        int temp = list[a];
        list[a] = list[b];
        list[b] = temp;
    }

    static int[] createListInt(String line) {
        String[] lines = line.split(" ");
        int n = lines.length;
        int[] list = new int[n];
        while (n-- > 0) {
            list[n] = Integer.parseInt(lines[n]);
        }
        return list;
    }

    static long[] createListLong(String line) {
        String[] lines = line.split(" ");
        int n = lines.length;
        long[] list = new long[n];
        while (n-- > 0) {
            list[n] = Long.parseLong(lines[n]);
        }
        return list;
    }

    static int ip(String s) {
        return Integer.parseInt(s);
    }

    static long lp(String s) {
        return Long.parseLong(s);
    }
} 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 br = new BufferedReader(new InputStreamReader(System.in));
        int n = ip(br.readLine());
        int[] list = createListInt(br.readLine());
        selectionSort(list, n);

    }

    static void selectionSort(int[] list, int n) {
        int count = 0;
        for (int i = 0; i < n; i++) {
            int minj = i;
            for (int j = i + 1; j < n; j++) {
                if (list[j] < list[minj]) {
                    minj = j;
                }
            }
            if (i != minj) {
                swap(list, i, minj);
                count++;
            }
        }
        print(list);
        System.out.println(count);
    }

    static void bubbleSort(int[] list, int n) {
        int count = 0;
        boolean flag = true;
        while (flag) {
            flag = false;
            for (int i = n - 1; i > 0; i--) {
                if (list[i] < list[i - 1]) {
                    swap(list, i, i - 1);
                    flag = true;
                    count++;
                }
            }
        }
        print(list);
        System.out.println(count);
    }

    private static void print(int[] list) {
        int n = list.length;
        for (int i = 0; i < n; i++) {
            System.out.print(list[i]);
            if (i < n - 1) {
                System.out.print(" ");
            }
        }
        System.out.println();
    }

    static void swap(int[] list, int a, int b) {
        int temp = list[a];
        list[a] = list[b];
        list[b] = temp;
    }

    static int[] createListInt(String line) {
        String[] lines = line.split(" ");
        int n = lines.length;
        int[] list = new int[n];
        while (n-- > 0) {
            list[n] = Integer.parseInt(lines[n]);
        }
        return list;
    }

    static long[] createListLong(String line) {
        String[] lines = line.split(" ");
        int n = lines.length;
        long[] list = new long[n];
        while (n-- > 0) {
            list[n] = Long.parseLong(lines[n]);
        }
        return list;
    }

    static int ip(String s) {
        return Integer.parseInt(s);
    }

    static long lp(String s) {
        return Long.parseLong(s);
    }
} Main public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = ip(br.readLine());
        int[] list = createListInt(br.readLine());
        selectionSort(list, n);

    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = ip(br.readLine());
        int[] list = createListInt(br.readLine());
        selectionSort(list, n);

    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int n = ip(br.readLine()); n ip(br.readLine()) ip br.readLine() br.readLine br int[] list = createListInt(br.readLine()); list createListInt(br.readLine()) createListInt br.readLine() br.readLine br selectionSort(list, n) selectionSort list n String[] args args static void selectionSort(int[] list, int n) {
        int count = 0;
        for (int i = 0; i < n; i++) {
            int minj = i;
            for (int j = i + 1; j < n; j++) {
                if (list[j] < list[minj]) {
                    minj = j;
                }
            }
            if (i != minj) {
                swap(list, i, minj);
                count++;
            }
        }
        print(list);
        System.out.println(count);
    } selectionSort {
        int count = 0;
        for (int i = 0; i < n; i++) {
            int minj = i;
            for (int j = i + 1; j < n; j++) {
                if (list[j] < list[minj]) {
                    minj = j;
                }
            }
            if (i != minj) {
                swap(list, i, minj);
                count++;
            }
        }
        print(list);
        System.out.println(count);
    } int count = 0; count 0 for (int i = 0; i < n; i++) {
            int minj = i;
            for (int j = i + 1; j < n; j++) {
                if (list[j] < list[minj]) {
                    minj = j;
                }
            }
            if (i != minj) {
                swap(list, i, minj);
                count++;
            }
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            int minj = i;
            for (int j = i + 1; j < n; j++) {
                if (list[j] < list[minj]) {
                    minj = j;
                }
            }
            if (i != minj) {
                swap(list, i, minj);
                count++;
            }
        } {
            int minj = i;
            for (int j = i + 1; j < n; j++) {
                if (list[j] < list[minj]) {
                    minj = j;
                }
            }
            if (i != minj) {
                swap(list, i, minj);
                count++;
            }
        } int minj = i; minj i for (int j = i + 1; j < n; j++) {
                if (list[j] < list[minj]) {
                    minj = j;
                }
            } int j = i + 1; int j = i + 1; j i + 1 i 1 j < n j n j++ j++ j {
                if (list[j] < list[minj]) {
                    minj = j;
                }
            } {
                if (list[j] < list[minj]) {
                    minj = j;
                }
            } if (list[j] < list[minj]) {
                    minj = j;
                } list[j] < list[minj] list[j] list j list[minj] list minj {
                    minj = j;
                } minj = j minj j if (i != minj) {
                swap(list, i, minj);
                count++;
            } i != minj i minj {
                swap(list, i, minj);
                count++;
            } swap(list, i, minj) swap list i minj count++ count print(list) print list System.out.println(count) System.out.println System.out System System.out count int[] list list int n n static void bubbleSort(int[] list, int n) {
        int count = 0;
        boolean flag = true;
        while (flag) {
            flag = false;
            for (int i = n - 1; i > 0; i--) {
                if (list[i] < list[i - 1]) {
                    swap(list, i, i - 1);
                    flag = true;
                    count++;
                }
            }
        }
        print(list);
        System.out.println(count);
    } bubbleSort {
        int count = 0;
        boolean flag = true;
        while (flag) {
            flag = false;
            for (int i = n - 1; i > 0; i--) {
                if (list[i] < list[i - 1]) {
                    swap(list, i, i - 1);
                    flag = true;
                    count++;
                }
            }
        }
        print(list);
        System.out.println(count);
    } int count = 0; count 0 boolean flag = true; flag true while (flag) {
            flag = false;
            for (int i = n - 1; i > 0; i--) {
                if (list[i] < list[i - 1]) {
                    swap(list, i, i - 1);
                    flag = true;
                    count++;
                }
            }
        } flag {
            flag = false;
            for (int i = n - 1; i > 0; i--) {
                if (list[i] < list[i - 1]) {
                    swap(list, i, i - 1);
                    flag = true;
                    count++;
                }
            }
        } flag = false flag false for (int i = n - 1; i > 0; i--) {
                if (list[i] < list[i - 1]) {
                    swap(list, i, i - 1);
                    flag = true;
                    count++;
                }
            } int i = n - 1; int i = n - 1; i n - 1 n 1 i > 0 i 0 i-- i-- i {
                if (list[i] < list[i - 1]) {
                    swap(list, i, i - 1);
                    flag = true;
                    count++;
                }
            } {
                if (list[i] < list[i - 1]) {
                    swap(list, i, i - 1);
                    flag = true;
                    count++;
                }
            } if (list[i] < list[i - 1]) {
                    swap(list, i, i - 1);
                    flag = true;
                    count++;
                } list[i] < list[i - 1] list[i] list i list[i - 1] list i - 1 i 1 {
                    swap(list, i, i - 1);
                    flag = true;
                    count++;
                } swap(list, i, i - 1) swap list i i - 1 i 1 flag = true flag true count++ count print(list) print list System.out.println(count) System.out.println System.out System System.out count int[] list list int n n private static void print(int[] list) {
        int n = list.length;
        for (int i = 0; i < n; i++) {
            System.out.print(list[i]);
            if (i < n - 1) {
                System.out.print(" ");
            }
        }
        System.out.println();
    } print {
        int n = list.length;
        for (int i = 0; i < n; i++) {
            System.out.print(list[i]);
            if (i < n - 1) {
                System.out.print(" ");
            }
        }
        System.out.println();
    } int n = list.length; n list.length list list.length for (int i = 0; i < n; i++) {
            System.out.print(list[i]);
            if (i < n - 1) {
                System.out.print(" ");
            }
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            System.out.print(list[i]);
            if (i < n - 1) {
                System.out.print(" ");
            }
        } {
            System.out.print(list[i]);
            if (i < n - 1) {
                System.out.print(" ");
            }
        } System.out.print(list[i]) System.out.print System.out System System.out list[i] list i if (i < n - 1) {
                System.out.print(" ");
            } i < n - 1 i n - 1 n 1 {
                System.out.print(" ");
            } System.out.print(" ") System.out.print System.out System System.out " " System.out.println() System.out.println System.out System System.out int[] list list static void swap(int[] list, int a, int b) {
        int temp = list[a];
        list[a] = list[b];
        list[b] = temp;
    } swap {
        int temp = list[a];
        list[a] = list[b];
        list[b] = temp;
    } int temp = list[a]; temp list[a] list a list[a] = list[b] list[a] list a list[b] list b list[b] = temp list[b] list b temp int[] list list int a a int b b static int[] createListInt(String line) {
        String[] lines = line.split(" ");
        int n = lines.length;
        int[] list = new int[n];
        while (n-- > 0) {
            list[n] = Integer.parseInt(lines[n]);
        }
        return list;
    } createListInt {
        String[] lines = line.split(" ");
        int n = lines.length;
        int[] list = new int[n];
        while (n-- > 0) {
            list[n] = Integer.parseInt(lines[n]);
        }
        return list;
    } String[] lines = line.split(" "); lines line.split(" ") line.split line " " int n = lines.length; n lines.length lines lines.length int[] list = new int[n]; list new int[n] n while (n-- > 0) {
            list[n] = Integer.parseInt(lines[n]);
        } n-- > 0 n-- n 0 {
            list[n] = Integer.parseInt(lines[n]);
        } list[n] = Integer.parseInt(lines[n]) list[n] list n Integer.parseInt(lines[n]) Integer.parseInt Integer lines[n] lines n return list; list String line line static long[] createListLong(String line) {
        String[] lines = line.split(" ");
        int n = lines.length;
        long[] list = new long[n];
        while (n-- > 0) {
            list[n] = Long.parseLong(lines[n]);
        }
        return list;
    } createListLong {
        String[] lines = line.split(" ");
        int n = lines.length;
        long[] list = new long[n];
        while (n-- > 0) {
            list[n] = Long.parseLong(lines[n]);
        }
        return list;
    } String[] lines = line.split(" "); lines line.split(" ") line.split line " " int n = lines.length; n lines.length lines lines.length long[] list = new long[n]; list new long[n] n while (n-- > 0) {
            list[n] = Long.parseLong(lines[n]);
        } n-- > 0 n-- n 0 {
            list[n] = Long.parseLong(lines[n]);
        } list[n] = Long.parseLong(lines[n]) list[n] list n Long.parseLong(lines[n]) Long.parseLong Long lines[n] lines n return list; list String line line static int ip(String s) {
        return Integer.parseInt(s);
    } ip {
        return Integer.parseInt(s);
    } return Integer.parseInt(s); Integer.parseInt(s) Integer.parseInt Integer s String s s static long lp(String s) {
        return Long.parseLong(s);
    } lp {
        return Long.parseLong(s);
    } return Long.parseLong(s); Long.parseLong(s) Long.parseLong Long s String s s public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = ip(br.readLine());
        int[] list = createListInt(br.readLine());
        selectionSort(list, n);

    }

    static void selectionSort(int[] list, int n) {
        int count = 0;
        for (int i = 0; i < n; i++) {
            int minj = i;
            for (int j = i + 1; j < n; j++) {
                if (list[j] < list[minj]) {
                    minj = j;
                }
            }
            if (i != minj) {
                swap(list, i, minj);
                count++;
            }
        }
        print(list);
        System.out.println(count);
    }

    static void bubbleSort(int[] list, int n) {
        int count = 0;
        boolean flag = true;
        while (flag) {
            flag = false;
            for (int i = n - 1; i > 0; i--) {
                if (list[i] < list[i - 1]) {
                    swap(list, i, i - 1);
                    flag = true;
                    count++;
                }
            }
        }
        print(list);
        System.out.println(count);
    }

    private static void print(int[] list) {
        int n = list.length;
        for (int i = 0; i < n; i++) {
            System.out.print(list[i]);
            if (i < n - 1) {
                System.out.print(" ");
            }
        }
        System.out.println();
    }

    static void swap(int[] list, int a, int b) {
        int temp = list[a];
        list[a] = list[b];
        list[b] = temp;
    }

    static int[] createListInt(String line) {
        String[] lines = line.split(" ");
        int n = lines.length;
        int[] list = new int[n];
        while (n-- > 0) {
            list[n] = Integer.parseInt(lines[n]);
        }
        return list;
    }

    static long[] createListLong(String line) {
        String[] lines = line.split(" ");
        int n = lines.length;
        long[] list = new long[n];
        while (n-- > 0) {
            list[n] = Long.parseLong(lines[n]);
        }
        return list;
    }

    static int ip(String s) {
        return Integer.parseInt(s);
    }

    static long lp(String s) {
        return Long.parseLong(s);
    }
} public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = ip(br.readLine());
        int[] list = createListInt(br.readLine());
        selectionSort(list, n);

    }

    static void selectionSort(int[] list, int n) {
        int count = 0;
        for (int i = 0; i < n; i++) {
            int minj = i;
            for (int j = i + 1; j < n; j++) {
                if (list[j] < list[minj]) {
                    minj = j;
                }
            }
            if (i != minj) {
                swap(list, i, minj);
                count++;
            }
        }
        print(list);
        System.out.println(count);
    }

    static void bubbleSort(int[] list, int n) {
        int count = 0;
        boolean flag = true;
        while (flag) {
            flag = false;
            for (int i = n - 1; i > 0; i--) {
                if (list[i] < list[i - 1]) {
                    swap(list, i, i - 1);
                    flag = true;
                    count++;
                }
            }
        }
        print(list);
        System.out.println(count);
    }

    private static void print(int[] list) {
        int n = list.length;
        for (int i = 0; i < n; i++) {
            System.out.print(list[i]);
            if (i < n - 1) {
                System.out.print(" ");
            }
        }
        System.out.println();
    }

    static void swap(int[] list, int a, int b) {
        int temp = list[a];
        list[a] = list[b];
        list[b] = temp;
    }

    static int[] createListInt(String line) {
        String[] lines = line.split(" ");
        int n = lines.length;
        int[] list = new int[n];
        while (n-- > 0) {
            list[n] = Integer.parseInt(lines[n]);
        }
        return list;
    }

    static long[] createListLong(String line) {
        String[] lines = line.split(" ");
        int n = lines.length;
        long[] list = new long[n];
        while (n-- > 0) {
            list[n] = Long.parseLong(lines[n]);
        }
        return list;
    }

    static int ip(String s) {
        return Integer.parseInt(s);
    }

    static long lp(String s) {
        return Long.parseLong(s);
    }
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = ip(br.readLine());
        int[] list = createListInt(br.readLine());
        selectionSort(list, n);

    }

    static void selectionSort(int[] list, int n) {
        int count = 0;
        for (int i = 0; i < n; i++) {
            int minj = i;
            for (int j = i + 1; j < n; j++) {
                if (list[j] < list[minj]) {
                    minj = j;
                }
            }
            if (i != minj) {
                swap(list, i, minj);
                count++;
            }
        }
        print(list);
        System.out.println(count);
    }

    static void bubbleSort(int[] list, int n) {
        int count = 0;
        boolean flag = true;
        while (flag) {
            flag = false;
            for (int i = n - 1; i > 0; i--) {
                if (list[i] < list[i - 1]) {
                    swap(list, i, i - 1);
                    flag = true;
                    count++;
                }
            }
        }
        print(list);
        System.out.println(count);
    }

    private static void print(int[] list) {
        int n = list.length;
        for (int i = 0; i < n; i++) {
            System.out.print(list[i]);
            if (i < n - 1) {
                System.out.print(" ");
            }
        }
        System.out.println();
    }

    static void swap(int[] list, int a, int b) {
        int temp = list[a];
        list[a] = list[b];
        list[b] = temp;
    }

    static int[] createListInt(String line) {
        String[] lines = line.split(" ");
        int n = lines.length;
        int[] list = new int[n];
        while (n-- > 0) {
            list[n] = Integer.parseInt(lines[n]);
        }
        return list;
    }

    static long[] createListLong(String line) {
        String[] lines = line.split(" ");
        int n = lines.length;
        long[] list = new long[n];
        while (n-- > 0) {
            list[n] = Long.parseLong(lines[n]);
        }
        return list;
    }

    static int ip(String s) {
        return Integer.parseInt(s);
    }

    static long lp(String s) {
        return Long.parseLong(s);
    }
}