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

public 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[] array = br.readLine().split(" ");
        int count = 0;

        for (int i = 0; i < n - 1; i++) {
            int min0 = Integer.parseInt(array[i]);
            int min1 = Integer.MAX_VALUE;
            int indexOfMin1 = 0;
            for (int j = i + 1; j < n; j++) {
                int aj = Integer.parseInt(array[j]);
                if (aj < min1) {
                    min1 = aj;
                    indexOfMin1 = j;
                }
            }
            if (min1 < min0) {
                String tmp = array[i];
                array[i] = array[indexOfMin1];
                array[indexOfMin1] = tmp;
                count++;
            }
        }

        System.out.println(String.join(" ", array));
        System.out.println(count);
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io public 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[] array = br.readLine().split(" ");
        int count = 0;

        for (int i = 0; i < n - 1; i++) {
            int min0 = Integer.parseInt(array[i]);
            int min1 = Integer.MAX_VALUE;
            int indexOfMin1 = 0;
            for (int j = i + 1; j < n; j++) {
                int aj = Integer.parseInt(array[j]);
                if (aj < min1) {
                    min1 = aj;
                    indexOfMin1 = j;
                }
            }
            if (min1 < min0) {
                String tmp = array[i];
                array[i] = array[indexOfMin1];
                array[indexOfMin1] = tmp;
                count++;
            }
        }

        System.out.println(String.join(" ", array));
        System.out.println(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[] array = br.readLine().split(" ");
        int count = 0;

        for (int i = 0; i < n - 1; i++) {
            int min0 = Integer.parseInt(array[i]);
            int min1 = Integer.MAX_VALUE;
            int indexOfMin1 = 0;
            for (int j = i + 1; j < n; j++) {
                int aj = Integer.parseInt(array[j]);
                if (aj < min1) {
                    min1 = aj;
                    indexOfMin1 = j;
                }
            }
            if (min1 < min0) {
                String tmp = array[i];
                array[i] = array[indexOfMin1];
                array[indexOfMin1] = tmp;
                count++;
            }
        }

        System.out.println(String.join(" ", array));
        System.out.println(count);
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        String[] array = br.readLine().split(" ");
        int count = 0;

        for (int i = 0; i < n - 1; i++) {
            int min0 = Integer.parseInt(array[i]);
            int min1 = Integer.MAX_VALUE;
            int indexOfMin1 = 0;
            for (int j = i + 1; j < n; j++) {
                int aj = Integer.parseInt(array[j]);
                if (aj < min1) {
                    min1 = aj;
                    indexOfMin1 = j;
                }
            }
            if (min1 < min0) {
                String tmp = array[i];
                array[i] = array[indexOfMin1];
                array[indexOfMin1] = tmp;
                count++;
            }
        }

        System.out.println(String.join(" ", 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[] array = br.readLine().split(" "); array br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int count = 0; count 0 for (int i = 0; i < n - 1; i++) {
            int min0 = Integer.parseInt(array[i]);
            int min1 = Integer.MAX_VALUE;
            int indexOfMin1 = 0;
            for (int j = i + 1; j < n; j++) {
                int aj = Integer.parseInt(array[j]);
                if (aj < min1) {
                    min1 = aj;
                    indexOfMin1 = j;
                }
            }
            if (min1 < min0) {
                String tmp = array[i];
                array[i] = array[indexOfMin1];
                array[indexOfMin1] = tmp;
                count++;
            }
        } int i = 0; int i = 0; i 0 i < n - 1 i n - 1 n 1 i++ i++ i {
            int min0 = Integer.parseInt(array[i]);
            int min1 = Integer.MAX_VALUE;
            int indexOfMin1 = 0;
            for (int j = i + 1; j < n; j++) {
                int aj = Integer.parseInt(array[j]);
                if (aj < min1) {
                    min1 = aj;
                    indexOfMin1 = j;
                }
            }
            if (min1 < min0) {
                String tmp = array[i];
                array[i] = array[indexOfMin1];
                array[indexOfMin1] = tmp;
                count++;
            }
        } {
            int min0 = Integer.parseInt(array[i]);
            int min1 = Integer.MAX_VALUE;
            int indexOfMin1 = 0;
            for (int j = i + 1; j < n; j++) {
                int aj = Integer.parseInt(array[j]);
                if (aj < min1) {
                    min1 = aj;
                    indexOfMin1 = j;
                }
            }
            if (min1 < min0) {
                String tmp = array[i];
                array[i] = array[indexOfMin1];
                array[indexOfMin1] = tmp;
                count++;
            }
        } int min0 = Integer.parseInt(array[i]); min0 Integer.parseInt(array[i]) Integer.parseInt Integer array[i] array i int min1 = Integer.MAX_VALUE; min1 Integer.MAX_VALUE Integer Integer.MAX_VALUE int indexOfMin1 = 0; indexOfMin1 0 for (int j = i + 1; j < n; j++) {
                int aj = Integer.parseInt(array[j]);
                if (aj < min1) {
                    min1 = aj;
                    indexOfMin1 = j;
                }
            } int j = i + 1; int j = i + 1; j i + 1 i 1 j < n j n j++ j++ j {
                int aj = Integer.parseInt(array[j]);
                if (aj < min1) {
                    min1 = aj;
                    indexOfMin1 = j;
                }
            } {
                int aj = Integer.parseInt(array[j]);
                if (aj < min1) {
                    min1 = aj;
                    indexOfMin1 = j;
                }
            } int aj = Integer.parseInt(array[j]); aj Integer.parseInt(array[j]) Integer.parseInt Integer array[j] array j if (aj < min1) {
                    min1 = aj;
                    indexOfMin1 = j;
                } aj < min1 aj min1 {
                    min1 = aj;
                    indexOfMin1 = j;
                } min1 = aj min1 aj indexOfMin1 = j indexOfMin1 j if (min1 < min0) {
                String tmp = array[i];
                array[i] = array[indexOfMin1];
                array[indexOfMin1] = tmp;
                count++;
            } min1 < min0 min1 min0 {
                String tmp = array[i];
                array[i] = array[indexOfMin1];
                array[indexOfMin1] = tmp;
                count++;
            } String tmp = array[i]; tmp array[i] array i array[i] = array[indexOfMin1] array[i] array i array[indexOfMin1] array indexOfMin1 array[indexOfMin1] = tmp array[indexOfMin1] array indexOfMin1 tmp count++ count System.out.println(String.join(" ", array)) System.out.println System.out System System.out String.join(" ", array) String.join String " " array System.out.println(count) System.out.println System.out System System.out count String[] args args public 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[] array = br.readLine().split(" ");
        int count = 0;

        for (int i = 0; i < n - 1; i++) {
            int min0 = Integer.parseInt(array[i]);
            int min1 = Integer.MAX_VALUE;
            int indexOfMin1 = 0;
            for (int j = i + 1; j < n; j++) {
                int aj = Integer.parseInt(array[j]);
                if (aj < min1) {
                    min1 = aj;
                    indexOfMin1 = j;
                }
            }
            if (min1 < min0) {
                String tmp = array[i];
                array[i] = array[indexOfMin1];
                array[indexOfMin1] = tmp;
                count++;
            }
        }

        System.out.println(String.join(" ", array));
        System.out.println(count);
    }
} public 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[] array = br.readLine().split(" ");
        int count = 0;

        for (int i = 0; i < n - 1; i++) {
            int min0 = Integer.parseInt(array[i]);
            int min1 = Integer.MAX_VALUE;
            int indexOfMin1 = 0;
            for (int j = i + 1; j < n; j++) {
                int aj = Integer.parseInt(array[j]);
                if (aj < min1) {
                    min1 = aj;
                    indexOfMin1 = j;
                }
            }
            if (min1 < min0) {
                String tmp = array[i];
                array[i] = array[indexOfMin1];
                array[indexOfMin1] = tmp;
                count++;
            }
        }

        System.out.println(String.join(" ", array));
        System.out.println(count);
    }
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;

public 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[] array = br.readLine().split(" ");
        int count = 0;

        for (int i = 0; i < n - 1; i++) {
            int min0 = Integer.parseInt(array[i]);
            int min1 = Integer.MAX_VALUE;
            int indexOfMin1 = 0;
            for (int j = i + 1; j < n; j++) {
                int aj = Integer.parseInt(array[j]);
                if (aj < min1) {
                    min1 = aj;
                    indexOfMin1 = j;
                }
            }
            if (min1 < min0) {
                String tmp = array[i];
                array[i] = array[indexOfMin1];
                array[indexOfMin1] = tmp;
                count++;
            }
        }

        System.out.println(String.join(" ", array));
        System.out.println(count);
    }
}