import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            solve(in);
        }
    }

    private static void solve(Scanner in) {
        int N = in.nextInt();
        int[] A = new int[N];
        for (int i = 0; i < N; i++) {
            A[i] = in.nextInt();
        }
        int cnt = 0;
        for (int i = 0; i < N; i++) {
            int mini = i;
            for (int j = i; j < N; j++) {
                if (A[mini] > A[j]) {
                    mini = j;
                }
            }
            if (mini != i) {
                int tmp = A[mini];
                A[mini] = A[i];
                A[i] = tmp;
                cnt++;
            }
        }
        for (int i = 0; i < N; i++) {
            System.out.print(A[i] + ((i == N - 1) ? "\n" : " "));
        }
        System.out.println(cnt);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            solve(in);
        }
    }

    private static void solve(Scanner in) {
        int N = in.nextInt();
        int[] A = new int[N];
        for (int i = 0; i < N; i++) {
            A[i] = in.nextInt();
        }
        int cnt = 0;
        for (int i = 0; i < N; i++) {
            int mini = i;
            for (int j = i; j < N; j++) {
                if (A[mini] > A[j]) {
                    mini = j;
                }
            }
            if (mini != i) {
                int tmp = A[mini];
                A[mini] = A[i];
                A[i] = tmp;
                cnt++;
            }
        }
        for (int i = 0; i < N; i++) {
            System.out.print(A[i] + ((i == N - 1) ? "\n" : " "));
        }
        System.out.println(cnt);
    }
} Main public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            solve(in);
        }
    } main {
        try (Scanner in = new Scanner(System.in)) {
            solve(in);
        }
    } try (Scanner in = new Scanner(System.in)) {
            solve(in);
        } {
            solve(in);
        } Scanner in = new Scanner(System.in) Scanner in = new Scanner(System.in) new Scanner(System.in) solve(in) solve in String[] args args private static void solve(Scanner in) {
        int N = in.nextInt();
        int[] A = new int[N];
        for (int i = 0; i < N; i++) {
            A[i] = in.nextInt();
        }
        int cnt = 0;
        for (int i = 0; i < N; i++) {
            int mini = i;
            for (int j = i; j < N; j++) {
                if (A[mini] > A[j]) {
                    mini = j;
                }
            }
            if (mini != i) {
                int tmp = A[mini];
                A[mini] = A[i];
                A[i] = tmp;
                cnt++;
            }
        }
        for (int i = 0; i < N; i++) {
            System.out.print(A[i] + ((i == N - 1) ? "\n" : " "));
        }
        System.out.println(cnt);
    } solve {
        int N = in.nextInt();
        int[] A = new int[N];
        for (int i = 0; i < N; i++) {
            A[i] = in.nextInt();
        }
        int cnt = 0;
        for (int i = 0; i < N; i++) {
            int mini = i;
            for (int j = i; j < N; j++) {
                if (A[mini] > A[j]) {
                    mini = j;
                }
            }
            if (mini != i) {
                int tmp = A[mini];
                A[mini] = A[i];
                A[i] = tmp;
                cnt++;
            }
        }
        for (int i = 0; i < N; i++) {
            System.out.print(A[i] + ((i == N - 1) ? "\n" : " "));
        }
        System.out.println(cnt);
    } int N = in.nextInt(); N in.nextInt() in.nextInt in int[] A = new int[N]; A new int[N] N for (int i = 0; i < N; i++) {
            A[i] = in.nextInt();
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            A[i] = in.nextInt();
        } {
            A[i] = in.nextInt();
        } A[i] = in.nextInt() A[i] A i in.nextInt() in.nextInt in int cnt = 0; cnt 0 for (int i = 0; i < N; i++) {
            int mini = i;
            for (int j = i; j < N; j++) {
                if (A[mini] > A[j]) {
                    mini = j;
                }
            }
            if (mini != i) {
                int tmp = A[mini];
                A[mini] = A[i];
                A[i] = tmp;
                cnt++;
            }
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            int mini = i;
            for (int j = i; j < N; j++) {
                if (A[mini] > A[j]) {
                    mini = j;
                }
            }
            if (mini != i) {
                int tmp = A[mini];
                A[mini] = A[i];
                A[i] = tmp;
                cnt++;
            }
        } {
            int mini = i;
            for (int j = i; j < N; j++) {
                if (A[mini] > A[j]) {
                    mini = j;
                }
            }
            if (mini != i) {
                int tmp = A[mini];
                A[mini] = A[i];
                A[i] = tmp;
                cnt++;
            }
        } int mini = i; mini i for (int j = i; j < N; j++) {
                if (A[mini] > A[j]) {
                    mini = j;
                }
            } int j = i; int j = i; j i j < N j N j++ j++ j {
                if (A[mini] > A[j]) {
                    mini = j;
                }
            } {
                if (A[mini] > A[j]) {
                    mini = j;
                }
            } if (A[mini] > A[j]) {
                    mini = j;
                } A[mini] > A[j] A[mini] A mini A[j] A j {
                    mini = j;
                } mini = j mini j if (mini != i) {
                int tmp = A[mini];
                A[mini] = A[i];
                A[i] = tmp;
                cnt++;
            } mini != i mini i {
                int tmp = A[mini];
                A[mini] = A[i];
                A[i] = tmp;
                cnt++;
            } int tmp = A[mini]; tmp A[mini] A mini A[mini] = A[i] A[mini] A mini A[i] A i A[i] = tmp A[i] A i tmp cnt++ cnt for (int i = 0; i < N; i++) {
            System.out.print(A[i] + ((i == N - 1) ? "\n" : " "));
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            System.out.print(A[i] + ((i == N - 1) ? "\n" : " "));
        } {
            System.out.print(A[i] + ((i == N - 1) ? "\n" : " "));
        } System.out.print(A[i] + ((i == N - 1) ? "\n" : " ")) System.out.print System.out System System.out A[i] + ((i == N - 1) ? "\n" : " ") A[i] A i ((i == N - 1) ? "\n" : " ") (i == N - 1) i N - 1 N 1 "\n" " " System.out.println(cnt) System.out.println System.out System System.out cnt Scanner in in public class Main {
    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            solve(in);
        }
    }

    private static void solve(Scanner in) {
        int N = in.nextInt();
        int[] A = new int[N];
        for (int i = 0; i < N; i++) {
            A[i] = in.nextInt();
        }
        int cnt = 0;
        for (int i = 0; i < N; i++) {
            int mini = i;
            for (int j = i; j < N; j++) {
                if (A[mini] > A[j]) {
                    mini = j;
                }
            }
            if (mini != i) {
                int tmp = A[mini];
                A[mini] = A[i];
                A[i] = tmp;
                cnt++;
            }
        }
        for (int i = 0; i < N; i++) {
            System.out.print(A[i] + ((i == N - 1) ? "\n" : " "));
        }
        System.out.println(cnt);
    }
} public class Main {
    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            solve(in);
        }
    }

    private static void solve(Scanner in) {
        int N = in.nextInt();
        int[] A = new int[N];
        for (int i = 0; i < N; i++) {
            A[i] = in.nextInt();
        }
        int cnt = 0;
        for (int i = 0; i < N; i++) {
            int mini = i;
            for (int j = i; j < N; j++) {
                if (A[mini] > A[j]) {
                    mini = j;
                }
            }
            if (mini != i) {
                int tmp = A[mini];
                A[mini] = A[i];
                A[i] = tmp;
                cnt++;
            }
        }
        for (int i = 0; i < N; i++) {
            System.out.print(A[i] + ((i == N - 1) ? "\n" : " "));
        }
        System.out.println(cnt);
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            solve(in);
        }
    }

    private static void solve(Scanner in) {
        int N = in.nextInt();
        int[] A = new int[N];
        for (int i = 0; i < N; i++) {
            A[i] = in.nextInt();
        }
        int cnt = 0;
        for (int i = 0; i < N; i++) {
            int mini = i;
            for (int j = i; j < N; j++) {
                if (A[mini] > A[j]) {
                    mini = j;
                }
            }
            if (mini != i) {
                int tmp = A[mini];
                A[mini] = A[i];
                A[i] = tmp;
                cnt++;
            }
        }
        for (int i = 0; i < N; i++) {
            System.out.print(A[i] + ((i == N - 1) ? "\n" : " "));
        }
        System.out.println(cnt);
    }
}