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

public class Main {

    public static void main(String args[]) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        int n = Integer.parseInt(br.readLine());
        String[] st = br.readLine().split(" ");
        int[] data = new int[n];
        for (int i = 0; i < n; i++) {
            data[i] = Integer.parseInt(st[i]);
        }

        Object[] obj = selectionSort(data, n);
        data = (int[]) obj[0];
        bw.append("" + data[0]);
        for (int i = 1; i < n; i++) {
            bw.append(" " + data[i]);
        }
        bw.append("\n" + obj[1] + "\n");
        bw.flush();
    }

    static Object[] selectionSort(int[] data, int n) {
        Object[] obj = new Object[2];
        int count = 0;
        for (int i = 0; i < n - 1; i++) {
            int min = i;
            boolean chk = false;
            for (int j = i; j < n; j++) {
                if (data[j] < data[min]) {
                    chk = true;
                    min = j;
                }
            }
            if (chk) {
                swap(data, i, min);
                count++;
            }
        }

        obj[0] = data;
        obj[1] = count;
        return obj;
    }

    static void swap(int[] data, int a, int b) {
        int tmp = data[a];
        data[a] = data[b];
        data[b] = tmp;
    }


} import java.io.BufferedReader; BufferedReader java.io import java.io.BufferedWriter; BufferedWriter java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.OutputStreamWriter; OutputStreamWriter 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));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        int n = Integer.parseInt(br.readLine());
        String[] st = br.readLine().split(" ");
        int[] data = new int[n];
        for (int i = 0; i < n; i++) {
            data[i] = Integer.parseInt(st[i]);
        }

        Object[] obj = selectionSort(data, n);
        data = (int[]) obj[0];
        bw.append("" + data[0]);
        for (int i = 1; i < n; i++) {
            bw.append(" " + data[i]);
        }
        bw.append("\n" + obj[1] + "\n");
        bw.flush();
    }

    static Object[] selectionSort(int[] data, int n) {
        Object[] obj = new Object[2];
        int count = 0;
        for (int i = 0; i < n - 1; i++) {
            int min = i;
            boolean chk = false;
            for (int j = i; j < n; j++) {
                if (data[j] < data[min]) {
                    chk = true;
                    min = j;
                }
            }
            if (chk) {
                swap(data, i, min);
                count++;
            }
        }

        obj[0] = data;
        obj[1] = count;
        return obj;
    }

    static void swap(int[] data, int a, int b) {
        int tmp = data[a];
        data[a] = data[b];
        data[b] = tmp;
    }


} Main public static void main(String args[]) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        int n = Integer.parseInt(br.readLine());
        String[] st = br.readLine().split(" ");
        int[] data = new int[n];
        for (int i = 0; i < n; i++) {
            data[i] = Integer.parseInt(st[i]);
        }

        Object[] obj = selectionSort(data, n);
        data = (int[]) obj[0];
        bw.append("" + data[0]);
        for (int i = 1; i < n; i++) {
            bw.append(" " + data[i]);
        }
        bw.append("\n" + obj[1] + "\n");
        bw.flush();
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        int n = Integer.parseInt(br.readLine());
        String[] st = br.readLine().split(" ");
        int[] data = new int[n];
        for (int i = 0; i < n; i++) {
            data[i] = Integer.parseInt(st[i]);
        }

        Object[] obj = selectionSort(data, n);
        data = (int[]) obj[0];
        bw.append("" + data[0]);
        for (int i = 1; i < n; i++) {
            bw.append(" " + data[i]);
        }
        bw.append("\n" + obj[1] + "\n");
        bw.flush();
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); bw new BufferedWriter(new OutputStreamWriter(System.out)) 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[] data = new int[n]; data new int[n] n for (int i = 0; i < n; i++) {
            data[i] = Integer.parseInt(st[i]);
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            data[i] = Integer.parseInt(st[i]);
        } {
            data[i] = Integer.parseInt(st[i]);
        } data[i] = Integer.parseInt(st[i]) data[i] data i Integer.parseInt(st[i]) Integer.parseInt Integer st[i] st i Object[] obj = selectionSort(data, n); obj selectionSort(data, n) selectionSort data n data = (int[]) obj[0] data (int[]) obj[0] obj 0 bw.append("" + data[0]) bw.append bw "" + data[0] "" data[0] data 0 for (int i = 1; i < n; i++) {
            bw.append(" " + data[i]);
        } int i = 1; int i = 1; i 1 i < n i n i++ i++ i {
            bw.append(" " + data[i]);
        } {
            bw.append(" " + data[i]);
        } bw.append(" " + data[i]) bw.append bw " " + data[i] " " data[i] data i bw.append("\n" + obj[1] + "\n") bw.append bw "\n" + obj[1] + "\n" "\n" + obj[1] + "\n" "\n" obj[1] obj 1 "\n" bw.flush() bw.flush bw String args[] args static Object[] selectionSort(int[] data, int n) {
        Object[] obj = new Object[2];
        int count = 0;
        for (int i = 0; i < n - 1; i++) {
            int min = i;
            boolean chk = false;
            for (int j = i; j < n; j++) {
                if (data[j] < data[min]) {
                    chk = true;
                    min = j;
                }
            }
            if (chk) {
                swap(data, i, min);
                count++;
            }
        }

        obj[0] = data;
        obj[1] = count;
        return obj;
    } selectionSort {
        Object[] obj = new Object[2];
        int count = 0;
        for (int i = 0; i < n - 1; i++) {
            int min = i;
            boolean chk = false;
            for (int j = i; j < n; j++) {
                if (data[j] < data[min]) {
                    chk = true;
                    min = j;
                }
            }
            if (chk) {
                swap(data, i, min);
                count++;
            }
        }

        obj[0] = data;
        obj[1] = count;
        return obj;
    } Object[] obj = new Object[2]; obj new Object[2] 2 int count = 0; count 0 for (int i = 0; i < n - 1; i++) {
            int min = i;
            boolean chk = false;
            for (int j = i; j < n; j++) {
                if (data[j] < data[min]) {
                    chk = true;
                    min = j;
                }
            }
            if (chk) {
                swap(data, i, min);
                count++;
            }
        } int i = 0; int i = 0; i 0 i < n - 1 i n - 1 n 1 i++ i++ i {
            int min = i;
            boolean chk = false;
            for (int j = i; j < n; j++) {
                if (data[j] < data[min]) {
                    chk = true;
                    min = j;
                }
            }
            if (chk) {
                swap(data, i, min);
                count++;
            }
        } {
            int min = i;
            boolean chk = false;
            for (int j = i; j < n; j++) {
                if (data[j] < data[min]) {
                    chk = true;
                    min = j;
                }
            }
            if (chk) {
                swap(data, i, min);
                count++;
            }
        } int min = i; min i boolean chk = false; chk false for (int j = i; j < n; j++) {
                if (data[j] < data[min]) {
                    chk = true;
                    min = j;
                }
            } int j = i; int j = i; j i j < n j n j++ j++ j {
                if (data[j] < data[min]) {
                    chk = true;
                    min = j;
                }
            } {
                if (data[j] < data[min]) {
                    chk = true;
                    min = j;
                }
            } if (data[j] < data[min]) {
                    chk = true;
                    min = j;
                } data[j] < data[min] data[j] data j data[min] data min {
                    chk = true;
                    min = j;
                } chk = true chk true min = j min j if (chk) {
                swap(data, i, min);
                count++;
            } chk {
                swap(data, i, min);
                count++;
            } swap(data, i, min) swap data i min count++ count obj[0] = data obj[0] obj 0 data obj[1] = count obj[1] obj 1 count return obj; obj int[] data data int n n static void swap(int[] data, int a, int b) {
        int tmp = data[a];
        data[a] = data[b];
        data[b] = tmp;
    } swap {
        int tmp = data[a];
        data[a] = data[b];
        data[b] = tmp;
    } int tmp = data[a]; tmp data[a] data a data[a] = data[b] data[a] data a data[b] data b data[b] = tmp data[b] data b tmp int[] data data int a a int b b public class Main {

    public static void main(String args[]) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        int n = Integer.parseInt(br.readLine());
        String[] st = br.readLine().split(" ");
        int[] data = new int[n];
        for (int i = 0; i < n; i++) {
            data[i] = Integer.parseInt(st[i]);
        }

        Object[] obj = selectionSort(data, n);
        data = (int[]) obj[0];
        bw.append("" + data[0]);
        for (int i = 1; i < n; i++) {
            bw.append(" " + data[i]);
        }
        bw.append("\n" + obj[1] + "\n");
        bw.flush();
    }

    static Object[] selectionSort(int[] data, int n) {
        Object[] obj = new Object[2];
        int count = 0;
        for (int i = 0; i < n - 1; i++) {
            int min = i;
            boolean chk = false;
            for (int j = i; j < n; j++) {
                if (data[j] < data[min]) {
                    chk = true;
                    min = j;
                }
            }
            if (chk) {
                swap(data, i, min);
                count++;
            }
        }

        obj[0] = data;
        obj[1] = count;
        return obj;
    }

    static void swap(int[] data, int a, int b) {
        int tmp = data[a];
        data[a] = data[b];
        data[b] = tmp;
    }


} public class Main {

    public static void main(String args[]) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        int n = Integer.parseInt(br.readLine());
        String[] st = br.readLine().split(" ");
        int[] data = new int[n];
        for (int i = 0; i < n; i++) {
            data[i] = Integer.parseInt(st[i]);
        }

        Object[] obj = selectionSort(data, n);
        data = (int[]) obj[0];
        bw.append("" + data[0]);
        for (int i = 1; i < n; i++) {
            bw.append(" " + data[i]);
        }
        bw.append("\n" + obj[1] + "\n");
        bw.flush();
    }

    static Object[] selectionSort(int[] data, int n) {
        Object[] obj = new Object[2];
        int count = 0;
        for (int i = 0; i < n - 1; i++) {
            int min = i;
            boolean chk = false;
            for (int j = i; j < n; j++) {
                if (data[j] < data[min]) {
                    chk = true;
                    min = j;
                }
            }
            if (chk) {
                swap(data, i, min);
                count++;
            }
        }

        obj[0] = data;
        obj[1] = count;
        return obj;
    }

    static void swap(int[] data, int a, int b) {
        int tmp = data[a];
        data[a] = data[b];
        data[b] = tmp;
    }


} Main
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.IOException;

public class Main {

    public static void main(String args[]) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        int n = Integer.parseInt(br.readLine());
        String[] st = br.readLine().split(" ");
        int[] data = new int[n];
        for (int i = 0; i < n; i++) {
            data[i] = Integer.parseInt(st[i]);
        }

        Object[] obj = selectionSort(data, n);
        data = (int[]) obj[0];
        bw.append("" + data[0]);
        for (int i = 1; i < n; i++) {
            bw.append(" " + data[i]);
        }
        bw.append("\n" + obj[1] + "\n");
        bw.flush();
    }

    static Object[] selectionSort(int[] data, int n) {
        Object[] obj = new Object[2];
        int count = 0;
        for (int i = 0; i < n - 1; i++) {
            int min = i;
            boolean chk = false;
            for (int j = i; j < n; j++) {
                if (data[j] < data[min]) {
                    chk = true;
                    min = j;
                }
            }
            if (chk) {
                swap(data, i, min);
                count++;
            }
        }

        obj[0] = data;
        obj[1] = count;
        return obj;
    }

    static void swap(int[] data, int a, int b) {
        int tmp = data[a];
        data[a] = data[b];
        data[b] = tmp;
    }


}
