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 < N; i++) {
            A[i] = sc.nextInt();
        }
        int sortCount = 0;
        for (int i = 0; i < N; i++) {
            int flag = 0;
            int minj = i;
            for (int j = i; j < N; j++) {
                if (A[j] < A[minj]) {
                    minj = j;
                    flag = 1;
                }
            }
            if (flag == 1) {
                int tmp = A[i];
                A[i] = A[minj];
                A[minj] = tmp;
                sortCount++;
            }
        }
        String delimiter = "";
        for (int a : A) {
            System.out.print(delimiter + a);
            delimiter = " ";
        }
        System.out.println();
        System.out.println(sortCount);
        sc.close();
    }
} 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 < N; i++) {
            A[i] = sc.nextInt();
        }
        int sortCount = 0;
        for (int i = 0; i < N; i++) {
            int flag = 0;
            int minj = i;
            for (int j = i; j < N; j++) {
                if (A[j] < A[minj]) {
                    minj = j;
                    flag = 1;
                }
            }
            if (flag == 1) {
                int tmp = A[i];
                A[i] = A[minj];
                A[minj] = tmp;
                sortCount++;
            }
        }
        String delimiter = "";
        for (int a : A) {
            System.out.print(delimiter + a);
            delimiter = " ";
        }
        System.out.println();
        System.out.println(sortCount);
        sc.close();
    }
} 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 < N; i++) {
            A[i] = sc.nextInt();
        }
        int sortCount = 0;
        for (int i = 0; i < N; i++) {
            int flag = 0;
            int minj = i;
            for (int j = i; j < N; j++) {
                if (A[j] < A[minj]) {
                    minj = j;
                    flag = 1;
                }
            }
            if (flag == 1) {
                int tmp = A[i];
                A[i] = A[minj];
                A[minj] = tmp;
                sortCount++;
            }
        }
        String delimiter = "";
        for (int a : A) {
            System.out.print(delimiter + a);
            delimiter = " ";
        }
        System.out.println();
        System.out.println(sortCount);
        sc.close();
    } main {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] A = new int[N];
        for (int i = 0; i < N; i++) {
            A[i] = sc.nextInt();
        }
        int sortCount = 0;
        for (int i = 0; i < N; i++) {
            int flag = 0;
            int minj = i;
            for (int j = i; j < N; j++) {
                if (A[j] < A[minj]) {
                    minj = j;
                    flag = 1;
                }
            }
            if (flag == 1) {
                int tmp = A[i];
                A[i] = A[minj];
                A[minj] = tmp;
                sortCount++;
            }
        }
        String delimiter = "";
        for (int a : A) {
            System.out.print(delimiter + a);
            delimiter = " ";
        }
        System.out.println();
        System.out.println(sortCount);
        sc.close();
    } 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 < N; i++) {
            A[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < N i N 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 sortCount = 0; sortCount 0 for (int i = 0; i < N; i++) {
            int flag = 0;
            int minj = i;
            for (int j = i; j < N; j++) {
                if (A[j] < A[minj]) {
                    minj = j;
                    flag = 1;
                }
            }
            if (flag == 1) {
                int tmp = A[i];
                A[i] = A[minj];
                A[minj] = tmp;
                sortCount++;
            }
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            int flag = 0;
            int minj = i;
            for (int j = i; j < N; j++) {
                if (A[j] < A[minj]) {
                    minj = j;
                    flag = 1;
                }
            }
            if (flag == 1) {
                int tmp = A[i];
                A[i] = A[minj];
                A[minj] = tmp;
                sortCount++;
            }
        } {
            int flag = 0;
            int minj = i;
            for (int j = i; j < N; j++) {
                if (A[j] < A[minj]) {
                    minj = j;
                    flag = 1;
                }
            }
            if (flag == 1) {
                int tmp = A[i];
                A[i] = A[minj];
                A[minj] = tmp;
                sortCount++;
            }
        } int flag = 0; flag 0 int minj = i; minj i for (int j = i; j < N; j++) {
                if (A[j] < A[minj]) {
                    minj = j;
                    flag = 1;
                }
            } int j = i; int j = i; j i j < N j N j++ j++ j {
                if (A[j] < A[minj]) {
                    minj = j;
                    flag = 1;
                }
            } {
                if (A[j] < A[minj]) {
                    minj = j;
                    flag = 1;
                }
            } if (A[j] < A[minj]) {
                    minj = j;
                    flag = 1;
                } A[j] < A[minj] A[j] A j A[minj] A minj {
                    minj = j;
                    flag = 1;
                } minj = j minj j flag = 1 flag 1 if (flag == 1) {
                int tmp = A[i];
                A[i] = A[minj];
                A[minj] = tmp;
                sortCount++;
            } flag == 1 flag 1 {
                int tmp = A[i];
                A[i] = A[minj];
                A[minj] = tmp;
                sortCount++;
            } int tmp = A[i]; tmp A[i] A i A[i] = A[minj] A[i] A i A[minj] A minj A[minj] = tmp A[minj] A minj tmp sortCount++ sortCount String delimiter = ""; delimiter "" for (int a : A) {
            System.out.print(delimiter + a);
            delimiter = " ";
        } int a A {
            System.out.print(delimiter + a);
            delimiter = " ";
        } {
            System.out.print(delimiter + a);
            delimiter = " ";
        } System.out.print(delimiter + a) System.out.print System.out System System.out delimiter + a delimiter a delimiter = " " delimiter " " System.out.println() System.out.println System.out System System.out System.out.println(sortCount) System.out.println System.out System System.out sortCount sc.close() sc.close sc String[] args args 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 < N; i++) {
            A[i] = sc.nextInt();
        }
        int sortCount = 0;
        for (int i = 0; i < N; i++) {
            int flag = 0;
            int minj = i;
            for (int j = i; j < N; j++) {
                if (A[j] < A[minj]) {
                    minj = j;
                    flag = 1;
                }
            }
            if (flag == 1) {
                int tmp = A[i];
                A[i] = A[minj];
                A[minj] = tmp;
                sortCount++;
            }
        }
        String delimiter = "";
        for (int a : A) {
            System.out.print(delimiter + a);
            delimiter = " ";
        }
        System.out.println();
        System.out.println(sortCount);
        sc.close();
    }
} 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 < N; i++) {
            A[i] = sc.nextInt();
        }
        int sortCount = 0;
        for (int i = 0; i < N; i++) {
            int flag = 0;
            int minj = i;
            for (int j = i; j < N; j++) {
                if (A[j] < A[minj]) {
                    minj = j;
                    flag = 1;
                }
            }
            if (flag == 1) {
                int tmp = A[i];
                A[i] = A[minj];
                A[minj] = tmp;
                sortCount++;
            }
        }
        String delimiter = "";
        for (int a : A) {
            System.out.print(delimiter + a);
            delimiter = " ";
        }
        System.out.println();
        System.out.println(sortCount);
        sc.close();
    }
} Main
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 < N; i++) {
            A[i] = sc.nextInt();
        }
        int sortCount = 0;
        for (int i = 0; i < N; i++) {
            int flag = 0;
            int minj = i;
            for (int j = i; j < N; j++) {
                if (A[j] < A[minj]) {
                    minj = j;
                    flag = 1;
                }
            }
            if (flag == 1) {
                int tmp = A[i];
                A[i] = A[minj];
                A[minj] = tmp;
                sortCount++;
            }
        }
        String delimiter = "";
        for (int a : A) {
            System.out.print(delimiter + a);
            delimiter = " ";
        }
        System.out.println();
        System.out.println(sortCount);
        sc.close();
    }
}
