import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = sc.nextInt();
        }
        int count = 0;
        for (int i = 0; i < n; i++) {
            int minj = i;
            for (int j = i + 1; j < n; j++) {
                if (arr[minj] > arr[j]) {
                    minj = j;
                }
            }
            if (minj != i) {
                int tmp = arr[minj];
                arr[minj] = arr[i];
                arr[i] = tmp;
                count++;
            }
        }
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < n; i++) {
            if (i > 0) {
                sb.append(" ");
            }
            sb.append(arr[i]);
        }
        System.out.println(sb);
        System.out.println(count);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = sc.nextInt();
        }
        int count = 0;
        for (int i = 0; i < n; i++) {
            int minj = i;
            for (int j = i + 1; j < n; j++) {
                if (arr[minj] > arr[j]) {
                    minj = j;
                }
            }
            if (minj != i) {
                int tmp = arr[minj];
                arr[minj] = arr[i];
                arr[i] = tmp;
                count++;
            }
        }
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < n; i++) {
            if (i > 0) {
                sb.append(" ");
            }
            sb.append(arr[i]);
        }
        System.out.println(sb);
        System.out.println(count);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = sc.nextInt();
        }
        int count = 0;
        for (int i = 0; i < n; i++) {
            int minj = i;
            for (int j = i + 1; j < n; j++) {
                if (arr[minj] > arr[j]) {
                    minj = j;
                }
            }
            if (minj != i) {
                int tmp = arr[minj];
                arr[minj] = arr[i];
                arr[i] = tmp;
                count++;
            }
        }
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < n; i++) {
            if (i > 0) {
                sb.append(" ");
            }
            sb.append(arr[i]);
        }
        System.out.println(sb);
        System.out.println(count);
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = sc.nextInt();
        }
        int count = 0;
        for (int i = 0; i < n; i++) {
            int minj = i;
            for (int j = i + 1; j < n; j++) {
                if (arr[minj] > arr[j]) {
                    minj = j;
                }
            }
            if (minj != i) {
                int tmp = arr[minj];
                arr[minj] = arr[i];
                arr[i] = tmp;
                count++;
            }
        }
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < n; i++) {
            if (i > 0) {
                sb.append(" ");
            }
            sb.append(arr[i]);
        }
        System.out.println(sb);
        System.out.println(count);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] arr = new int[n]; arr new int[n] n for (int i = 0; i < n; i++) {
            arr[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            arr[i] = sc.nextInt();
        } {
            arr[i] = sc.nextInt();
        } arr[i] = sc.nextInt() arr[i] arr i sc.nextInt() sc.nextInt sc int count = 0; count 0 for (int i = 0; i < n; i++) {
            int minj = i;
            for (int j = i + 1; j < n; j++) {
                if (arr[minj] > arr[j]) {
                    minj = j;
                }
            }
            if (minj != i) {
                int tmp = arr[minj];
                arr[minj] = arr[i];
                arr[i] = tmp;
                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 (arr[minj] > arr[j]) {
                    minj = j;
                }
            }
            if (minj != i) {
                int tmp = arr[minj];
                arr[minj] = arr[i];
                arr[i] = tmp;
                count++;
            }
        } {
            int minj = i;
            for (int j = i + 1; j < n; j++) {
                if (arr[minj] > arr[j]) {
                    minj = j;
                }
            }
            if (minj != i) {
                int tmp = arr[minj];
                arr[minj] = arr[i];
                arr[i] = tmp;
                count++;
            }
        } int minj = i; minj i for (int j = i + 1; j < n; j++) {
                if (arr[minj] > arr[j]) {
                    minj = j;
                }
            } int j = i + 1; int j = i + 1; j i + 1 i 1 j < n j n j++ j++ j {
                if (arr[minj] > arr[j]) {
                    minj = j;
                }
            } {
                if (arr[minj] > arr[j]) {
                    minj = j;
                }
            } if (arr[minj] > arr[j]) {
                    minj = j;
                } arr[minj] > arr[j] arr[minj] arr minj arr[j] arr j {
                    minj = j;
                } minj = j minj j if (minj != i) {
                int tmp = arr[minj];
                arr[minj] = arr[i];
                arr[i] = tmp;
                count++;
            } minj != i minj i {
                int tmp = arr[minj];
                arr[minj] = arr[i];
                arr[i] = tmp;
                count++;
            } int tmp = arr[minj]; tmp arr[minj] arr minj arr[minj] = arr[i] arr[minj] arr minj arr[i] arr i arr[i] = tmp arr[i] arr i tmp count++ count StringBuilder sb = new StringBuilder(); sb new StringBuilder() for (int i = 0; i < n; i++) {
            if (i > 0) {
                sb.append(" ");
            }
            sb.append(arr[i]);
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            if (i > 0) {
                sb.append(" ");
            }
            sb.append(arr[i]);
        } {
            if (i > 0) {
                sb.append(" ");
            }
            sb.append(arr[i]);
        } if (i > 0) {
                sb.append(" ");
            } i > 0 i 0 {
                sb.append(" ");
            } sb.append(" ") sb.append sb " " sb.append(arr[i]) sb.append sb arr[i] arr i System.out.println(sb) System.out.println System.out System System.out sb 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) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = sc.nextInt();
        }
        int count = 0;
        for (int i = 0; i < n; i++) {
            int minj = i;
            for (int j = i + 1; j < n; j++) {
                if (arr[minj] > arr[j]) {
                    minj = j;
                }
            }
            if (minj != i) {
                int tmp = arr[minj];
                arr[minj] = arr[i];
                arr[i] = tmp;
                count++;
            }
        }
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < n; i++) {
            if (i > 0) {
                sb.append(" ");
            }
            sb.append(arr[i]);
        }
        System.out.println(sb);
        System.out.println(count);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = sc.nextInt();
        }
        int count = 0;
        for (int i = 0; i < n; i++) {
            int minj = i;
            for (int j = i + 1; j < n; j++) {
                if (arr[minj] > arr[j]) {
                    minj = j;
                }
            }
            if (minj != i) {
                int tmp = arr[minj];
                arr[minj] = arr[i];
                arr[i] = tmp;
                count++;
            }
        }
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < n; i++) {
            if (i > 0) {
                sb.append(" ");
            }
            sb.append(arr[i]);
        }
        System.out.println(sb);
        System.out.println(count);
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = sc.nextInt();
        }
        int count = 0;
        for (int i = 0; i < n; i++) {
            int minj = i;
            for (int j = i + 1; j < n; j++) {
                if (arr[minj] > arr[j]) {
                    minj = j;
                }
            }
            if (minj != i) {
                int tmp = arr[minj];
                arr[minj] = arr[i];
                arr[i] = tmp;
                count++;
            }
        }
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < n; i++) {
            if (i > 0) {
                sb.append(" ");
            }
            sb.append(arr[i]);
        }
        System.out.println(sb);
        System.out.println(count);
    }
}
