import java.util.Scanner;

public class Main {

    public Main() {
    }

    public static void main(String[] args) {
        new Main().solve();
    }

    private Scanner sc;

    private void solve() {
        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 cnt = 0;
        for (int i = 0; i < N; i++) {
            int minj = i;
            for (int j = i; j < N; j++) {
                if (A[j] < A[minj]) {
                    minj = j;
                }
            }
            if (minj != i) {
                int tmp = A[i];
                A[i] = A[minj];
                A[minj] = tmp;
                cnt++;
            }
        }
        String ans = "";
        for (int num : A) {
            ans += num;
            ans += " ";
        }

        System.out.println(ans.trim());
        System.out.println(cnt);
    }
} import java.util.Scanner; Scanner java.util public class Main {

    public Main() {
    }

    public static void main(String[] args) {
        new Main().solve();
    }

    private Scanner sc;

    private void solve() {
        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 cnt = 0;
        for (int i = 0; i < N; i++) {
            int minj = i;
            for (int j = i; j < N; j++) {
                if (A[j] < A[minj]) {
                    minj = j;
                }
            }
            if (minj != i) {
                int tmp = A[i];
                A[i] = A[minj];
                A[minj] = tmp;
                cnt++;
            }
        }
        String ans = "";
        for (int num : A) {
            ans += num;
            ans += " ";
        }

        System.out.println(ans.trim());
        System.out.println(cnt);
    }
} Main private Scanner sc; sc public Main() {
    } Main {
    } public static void main(String[] args) {
        new Main().solve();
    } main {
        new Main().solve();
    } new Main().solve() new Main().solve new Main() String[] args args private void solve() {
        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 cnt = 0;
        for (int i = 0; i < N; i++) {
            int minj = i;
            for (int j = i; j < N; j++) {
                if (A[j] < A[minj]) {
                    minj = j;
                }
            }
            if (minj != i) {
                int tmp = A[i];
                A[i] = A[minj];
                A[minj] = tmp;
                cnt++;
            }
        }
        String ans = "";
        for (int num : A) {
            ans += num;
            ans += " ";
        }

        System.out.println(ans.trim());
        System.out.println(cnt);
    } solve {
        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 cnt = 0;
        for (int i = 0; i < N; i++) {
            int minj = i;
            for (int j = i; j < N; j++) {
                if (A[j] < A[minj]) {
                    minj = j;
                }
            }
            if (minj != i) {
                int tmp = A[i];
                A[i] = A[minj];
                A[minj] = tmp;
                cnt++;
            }
        }
        String ans = "";
        for (int num : A) {
            ans += num;
            ans += " ";
        }

        System.out.println(ans.trim());
        System.out.println(cnt);
    } 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 cnt = 0; cnt 0 for (int i = 0; i < N; i++) {
            int minj = i;
            for (int j = i; j < N; j++) {
                if (A[j] < A[minj]) {
                    minj = j;
                }
            }
            if (minj != i) {
                int tmp = A[i];
                A[i] = A[minj];
                A[minj] = tmp;
                cnt++;
            }
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            int minj = i;
            for (int j = i; j < N; j++) {
                if (A[j] < A[minj]) {
                    minj = j;
                }
            }
            if (minj != i) {
                int tmp = A[i];
                A[i] = A[minj];
                A[minj] = tmp;
                cnt++;
            }
        } {
            int minj = i;
            for (int j = i; j < N; j++) {
                if (A[j] < A[minj]) {
                    minj = j;
                }
            }
            if (minj != i) {
                int tmp = A[i];
                A[i] = A[minj];
                A[minj] = tmp;
                cnt++;
            }
        } int minj = i; minj i for (int j = i; j < N; j++) {
                if (A[j] < A[minj]) {
                    minj = j;
                }
            } int j = i; int j = i; j i j < N j N j++ j++ j {
                if (A[j] < A[minj]) {
                    minj = j;
                }
            } {
                if (A[j] < A[minj]) {
                    minj = j;
                }
            } if (A[j] < A[minj]) {
                    minj = j;
                } A[j] < A[minj] A[j] A j A[minj] A minj {
                    minj = j;
                } minj = j minj j if (minj != i) {
                int tmp = A[i];
                A[i] = A[minj];
                A[minj] = tmp;
                cnt++;
            } minj != i minj i {
                int tmp = A[i];
                A[i] = A[minj];
                A[minj] = tmp;
                cnt++;
            } 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 cnt++ cnt String ans = ""; ans "" for (int num : A) {
            ans += num;
            ans += " ";
        } int num A {
            ans += num;
            ans += " ";
        } {
            ans += num;
            ans += " ";
        } ans += num ans num ans += " " ans " " System.out.println(ans.trim()) System.out.println System.out System System.out ans.trim() ans.trim ans System.out.println(cnt) System.out.println System.out System System.out cnt public class Main {

    public Main() {
    }

    public static void main(String[] args) {
        new Main().solve();
    }

    private Scanner sc;

    private void solve() {
        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 cnt = 0;
        for (int i = 0; i < N; i++) {
            int minj = i;
            for (int j = i; j < N; j++) {
                if (A[j] < A[minj]) {
                    minj = j;
                }
            }
            if (minj != i) {
                int tmp = A[i];
                A[i] = A[minj];
                A[minj] = tmp;
                cnt++;
            }
        }
        String ans = "";
        for (int num : A) {
            ans += num;
            ans += " ";
        }

        System.out.println(ans.trim());
        System.out.println(cnt);
    }
} public class Main {

    public Main() {
    }

    public static void main(String[] args) {
        new Main().solve();
    }

    private Scanner sc;

    private void solve() {
        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 cnt = 0;
        for (int i = 0; i < N; i++) {
            int minj = i;
            for (int j = i; j < N; j++) {
                if (A[j] < A[minj]) {
                    minj = j;
                }
            }
            if (minj != i) {
                int tmp = A[i];
                A[i] = A[minj];
                A[minj] = tmp;
                cnt++;
            }
        }
        String ans = "";
        for (int num : A) {
            ans += num;
            ans += " ";
        }

        System.out.println(ans.trim());
        System.out.println(cnt);
    }
} Main
import java.util.Scanner;

public class Main {

    public Main() {
    }

    public static void main(String[] args) {
        new Main().solve();
    }

    private Scanner sc;

    private void solve() {
        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 cnt = 0;
        for (int i = 0; i < N; i++) {
            int minj = i;
            for (int j = i; j < N; j++) {
                if (A[j] < A[minj]) {
                    minj = j;
                }
            }
            if (minj != i) {
                int tmp = A[i];
                A[i] = A[minj];
                A[minj] = tmp;
                cnt++;
            }
        }
        String ans = "";
        for (int num : A) {
            ans += num;
            ans += " ";
        }

        System.out.println(ans.trim());
        System.out.println(cnt);
    }
}