import java.util.Arrays;
import java.util.Scanner;
 
//選択ソート
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] A = new int[n];
        for (int i = 0; i < A.length; i++) {
            A[i] = sc.nextInt();
        }
        int cnt = new Main().selectionSort(A);
        String ans = Arrays.toString(A);
        System.out.println(ans.replace("[", "").replace(",", "").replace("]", ""));
        System.out.println(cnt);
 
    }
 
    int selectionSort(int[] array) {
        int cnt = 0; // 交換回数
        for (int i = 0; i < array.length - 1; i++) { // 最後の要素1つだけのときはやらなくていいのでn-1
            int minv = i;
            for (int j = i + 1; j < array.length; j++) {
                if (array[j] < array[minv]) {
                    minv = j;
                }
            }
            if (minv != i) {
                int tmp = array[i];
                array[i] = array[minv];
                array[minv] = tmp;
                cnt++;
            }
        }
        return cnt;
    }
 
} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] A = new int[n];
        for (int i = 0; i < A.length; i++) {
            A[i] = sc.nextInt();
        }
        int cnt = new Main().selectionSort(A);
        String ans = Arrays.toString(A);
        System.out.println(ans.replace("[", "").replace(",", "").replace("]", ""));
        System.out.println(cnt);
 
    }
 
    int selectionSort(int[] array) {
        int cnt = 0; // 交換回数
        for (int i = 0; i < array.length - 1; i++) { // 最後の要素1つだけのときはやらなくていいのでn-1
            int minv = i;
            for (int j = i + 1; j < array.length; j++) {
                if (array[j] < array[minv]) {
                    minv = j;
                }
            }
            if (minv != i) {
                int tmp = array[i];
                array[i] = array[minv];
                array[minv] = tmp;
                cnt++;
            }
        }
        return cnt;
    }
 
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] A = new int[n];
        for (int i = 0; i < A.length; i++) {
            A[i] = sc.nextInt();
        }
        int cnt = new Main().selectionSort(A);
        String ans = Arrays.toString(A);
        System.out.println(ans.replace("[", "").replace(",", "").replace("]", ""));
        System.out.println(cnt);
 
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] A = new int[n];
        for (int i = 0; i < A.length; i++) {
            A[i] = sc.nextInt();
        }
        int cnt = new Main().selectionSort(A);
        String ans = Arrays.toString(A);
        System.out.println(ans.replace("[", "").replace(",", "").replace("]", ""));
        System.out.println(cnt);
 
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] A = new int[n]; A new int[n] n for (int i = 0; i < A.length; i++) {
            A[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < A.length i A.length A A.length i++ i++ i {
            A[i] = sc.nextInt();
        } {
            A[i] = sc.nextInt();
        } A[i] = sc.nextInt() A[i] A i sc.nextInt() sc.nextInt sc int cnt = new Main().selectionSort(A); cnt new Main().selectionSort(A) new Main().selectionSort new Main() A String ans = Arrays.toString(A); ans Arrays.toString(A) Arrays.toString Arrays A System.out.println(ans.replace("[", "").replace(",", "").replace("]", "")) System.out.println System.out System System.out ans.replace("[", "").replace(",", "").replace("]", "") ans.replace("[", "").replace(",", "").replace ans.replace("[", "").replace(",", "") ans.replace("[", "").replace ans.replace("[", "") ans.replace ans "[" "" "," "" "]" "" System.out.println(cnt) System.out.println System.out System System.out cnt String[] args args int selectionSort(int[] array) {
        int cnt = 0; // 交換回数
        for (int i = 0; i < array.length - 1; i++) { // 最後の要素1つだけのときはやらなくていいのでn-1
            int minv = i;
            for (int j = i + 1; j < array.length; j++) {
                if (array[j] < array[minv]) {
                    minv = j;
                }
            }
            if (minv != i) {
                int tmp = array[i];
                array[i] = array[minv];
                array[minv] = tmp;
                cnt++;
            }
        }
        return cnt;
    } selectionSort {
        int cnt = 0; // 交換回数
        for (int i = 0; i < array.length - 1; i++) { // 最後の要素1つだけのときはやらなくていいのでn-1
            int minv = i;
            for (int j = i + 1; j < array.length; j++) {
                if (array[j] < array[minv]) {
                    minv = j;
                }
            }
            if (minv != i) {
                int tmp = array[i];
                array[i] = array[minv];
                array[minv] = tmp;
                cnt++;
            }
        }
        return cnt;
    } int cnt = 0; cnt 0 for (int i = 0; i < array.length - 1; i++) { // 最後の要素1つだけのときはやらなくていいのでn-1
            int minv = i;
            for (int j = i + 1; j < array.length; j++) {
                if (array[j] < array[minv]) {
                    minv = j;
                }
            }
            if (minv != i) {
                int tmp = array[i];
                array[i] = array[minv];
                array[minv] = tmp;
                cnt++;
            }
        } int i = 0; int i = 0; i 0 i < array.length - 1 i array.length - 1 array.length array array.length 1 i++ i++ i { // 最後の要素1つだけのときはやらなくていいのでn-1
            int minv = i;
            for (int j = i + 1; j < array.length; j++) {
                if (array[j] < array[minv]) {
                    minv = j;
                }
            }
            if (minv != i) {
                int tmp = array[i];
                array[i] = array[minv];
                array[minv] = tmp;
                cnt++;
            }
        } { // 最後の要素1つだけのときはやらなくていいのでn-1
            int minv = i;
            for (int j = i + 1; j < array.length; j++) {
                if (array[j] < array[minv]) {
                    minv = j;
                }
            }
            if (minv != i) {
                int tmp = array[i];
                array[i] = array[minv];
                array[minv] = tmp;
                cnt++;
            }
        } int minv = i; minv i for (int j = i + 1; j < array.length; j++) {
                if (array[j] < array[minv]) {
                    minv = j;
                }
            } int j = i + 1; int j = i + 1; j i + 1 i 1 j < array.length j array.length array array.length j++ j++ j {
                if (array[j] < array[minv]) {
                    minv = j;
                }
            } {
                if (array[j] < array[minv]) {
                    minv = j;
                }
            } if (array[j] < array[minv]) {
                    minv = j;
                } array[j] < array[minv] array[j] array j array[minv] array minv {
                    minv = j;
                } minv = j minv j if (minv != i) {
                int tmp = array[i];
                array[i] = array[minv];
                array[minv] = tmp;
                cnt++;
            } minv != i minv i {
                int tmp = array[i];
                array[i] = array[minv];
                array[minv] = tmp;
                cnt++;
            } int tmp = array[i]; tmp array[i] array i array[i] = array[minv] array[i] array i array[minv] array minv array[minv] = tmp array[minv] array minv tmp cnt++ cnt return cnt; cnt int[] array array public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] A = new int[n];
        for (int i = 0; i < A.length; i++) {
            A[i] = sc.nextInt();
        }
        int cnt = new Main().selectionSort(A);
        String ans = Arrays.toString(A);
        System.out.println(ans.replace("[", "").replace(",", "").replace("]", ""));
        System.out.println(cnt);
 
    }
 
    int selectionSort(int[] array) {
        int cnt = 0; // 交換回数
        for (int i = 0; i < array.length - 1; i++) { // 最後の要素1つだけのときはやらなくていいのでn-1
            int minv = i;
            for (int j = i + 1; j < array.length; j++) {
                if (array[j] < array[minv]) {
                    minv = j;
                }
            }
            if (minv != i) {
                int tmp = array[i];
                array[i] = array[minv];
                array[minv] = tmp;
                cnt++;
            }
        }
        return cnt;
    }
 
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] A = new int[n];
        for (int i = 0; i < A.length; i++) {
            A[i] = sc.nextInt();
        }
        int cnt = new Main().selectionSort(A);
        String ans = Arrays.toString(A);
        System.out.println(ans.replace("[", "").replace(",", "").replace("]", ""));
        System.out.println(cnt);
 
    }
 
    int selectionSort(int[] array) {
        int cnt = 0; // 交換回数
        for (int i = 0; i < array.length - 1; i++) { // 最後の要素1つだけのときはやらなくていいのでn-1
            int minv = i;
            for (int j = i + 1; j < array.length; j++) {
                if (array[j] < array[minv]) {
                    minv = j;
                }
            }
            if (minv != i) {
                int tmp = array[i];
                array[i] = array[minv];
                array[minv] = tmp;
                cnt++;
            }
        }
        return cnt;
    }
 
} Main
import java.util.Arrays;
import java.util.Scanner;
 
//選択ソート
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] A = new int[n];
        for (int i = 0; i < A.length; i++) {
            A[i] = sc.nextInt();
        }
        int cnt = new Main().selectionSort(A);
        String ans = Arrays.toString(A);
        System.out.println(ans.replace("[", "").replace(",", "").replace("]", ""));
        System.out.println(cnt);
 
    }
 
    int selectionSort(int[] array) {
        int cnt = 0; // 交換回数
        for (int i = 0; i < array.length - 1; i++) { // 最後の要素1つだけのときはやらなくていいのでn-1
            int minv = i;
            for (int j = i + 1; j < array.length; j++) {
                if (array[j] < array[minv]) {
                    minv = j;
                }
            }
            if (minv != i) {
                int tmp = array[i];
                array[i] = array[minv];
                array[minv] = tmp;
                cnt++;
            }
        }
        return cnt;
    }
 
}
