import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int[] A = new int[N];
        for (int i = 0; i < N; i++) {
            A[i] = scanner.nextInt();
        }
        int cnt = sort(A);
        for (int i = 0; i < N; i++) {
            System.out.print(A[i]);
            if (i == N - 1) {
                System.out.println("");
            } else {
                System.out.print(" ");
            }
        }
        System.out.println(cnt);
    }

    private static int sort(int[] a) {
        int cnt = 0;
        for (int i = 0; i < a.length; i++) {
            int mi = i;
            for (int j = i + 1; j < a.length; j++) {
                if (a[j] < a[mi]) {
                    mi = j;
                }
            }
            if (i != mi) {
                int t = a[i];
                a[i] = a[mi];
                a[mi] = t;
                cnt++;
            }
       }
        return cnt;
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int[] A = new int[N];
        for (int i = 0; i < N; i++) {
            A[i] = scanner.nextInt();
        }
        int cnt = sort(A);
        for (int i = 0; i < N; i++) {
            System.out.print(A[i]);
            if (i == N - 1) {
                System.out.println("");
            } else {
                System.out.print(" ");
            }
        }
        System.out.println(cnt);
    }

    private static int sort(int[] a) {
        int cnt = 0;
        for (int i = 0; i < a.length; i++) {
            int mi = i;
            for (int j = i + 1; j < a.length; j++) {
                if (a[j] < a[mi]) {
                    mi = j;
                }
            }
            if (i != mi) {
                int t = a[i];
                a[i] = a[mi];
                a[mi] = t;
                cnt++;
            }
       }
        return cnt;
    }
} Main public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int[] A = new int[N];
        for (int i = 0; i < N; i++) {
            A[i] = scanner.nextInt();
        }
        int cnt = sort(A);
        for (int i = 0; i < N; i++) {
            System.out.print(A[i]);
            if (i == N - 1) {
                System.out.println("");
            } else {
                System.out.print(" ");
            }
        }
        System.out.println(cnt);
    } main {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int[] A = new int[N];
        for (int i = 0; i < N; i++) {
            A[i] = scanner.nextInt();
        }
        int cnt = sort(A);
        for (int i = 0; i < N; i++) {
            System.out.print(A[i]);
            if (i == N - 1) {
                System.out.println("");
            } else {
                System.out.print(" ");
            }
        }
        System.out.println(cnt);
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int N = scanner.nextInt(); N scanner.nextInt() scanner.nextInt scanner int[] A = new int[N]; A new int[N] N for (int i = 0; i < N; i++) {
            A[i] = scanner.nextInt();
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            A[i] = scanner.nextInt();
        } {
            A[i] = scanner.nextInt();
        } A[i] = scanner.nextInt() A[i] A i scanner.nextInt() scanner.nextInt scanner int cnt = sort(A); cnt sort(A) sort A for (int i = 0; i < N; i++) {
            System.out.print(A[i]);
            if (i == N - 1) {
                System.out.println("");
            } else {
                System.out.print(" ");
            }
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            System.out.print(A[i]);
            if (i == N - 1) {
                System.out.println("");
            } else {
                System.out.print(" ");
            }
        } {
            System.out.print(A[i]);
            if (i == N - 1) {
                System.out.println("");
            } else {
                System.out.print(" ");
            }
        } System.out.print(A[i]) System.out.print System.out System System.out A[i] A i if (i == N - 1) {
                System.out.println("");
            } else {
                System.out.print(" ");
            } i == N - 1 i N - 1 N 1 {
                System.out.println("");
            } System.out.println("") System.out.println System.out System System.out "" {
                System.out.print(" ");
            } System.out.print(" ") System.out.print System.out System System.out " " System.out.println(cnt) System.out.println System.out System System.out cnt String[] args args private static int sort(int[] a) {
        int cnt = 0;
        for (int i = 0; i < a.length; i++) {
            int mi = i;
            for (int j = i + 1; j < a.length; j++) {
                if (a[j] < a[mi]) {
                    mi = j;
                }
            }
            if (i != mi) {
                int t = a[i];
                a[i] = a[mi];
                a[mi] = t;
                cnt++;
            }
       }
        return cnt;
    } sort {
        int cnt = 0;
        for (int i = 0; i < a.length; i++) {
            int mi = i;
            for (int j = i + 1; j < a.length; j++) {
                if (a[j] < a[mi]) {
                    mi = j;
                }
            }
            if (i != mi) {
                int t = a[i];
                a[i] = a[mi];
                a[mi] = t;
                cnt++;
            }
       }
        return cnt;
    } int cnt = 0; cnt 0 for (int i = 0; i < a.length; i++) {
            int mi = i;
            for (int j = i + 1; j < a.length; j++) {
                if (a[j] < a[mi]) {
                    mi = j;
                }
            }
            if (i != mi) {
                int t = a[i];
                a[i] = a[mi];
                a[mi] = t;
                cnt++;
            }
       } int i = 0; int i = 0; i 0 i < a.length i a.length a a.length i++ i++ i {
            int mi = i;
            for (int j = i + 1; j < a.length; j++) {
                if (a[j] < a[mi]) {
                    mi = j;
                }
            }
            if (i != mi) {
                int t = a[i];
                a[i] = a[mi];
                a[mi] = t;
                cnt++;
            }
       } {
            int mi = i;
            for (int j = i + 1; j < a.length; j++) {
                if (a[j] < a[mi]) {
                    mi = j;
                }
            }
            if (i != mi) {
                int t = a[i];
                a[i] = a[mi];
                a[mi] = t;
                cnt++;
            }
       } int mi = i; mi i for (int j = i + 1; j < a.length; j++) {
                if (a[j] < a[mi]) {
                    mi = j;
                }
            } int j = i + 1; int j = i + 1; j i + 1 i 1 j < a.length j a.length a a.length j++ j++ j {
                if (a[j] < a[mi]) {
                    mi = j;
                }
            } {
                if (a[j] < a[mi]) {
                    mi = j;
                }
            } if (a[j] < a[mi]) {
                    mi = j;
                } a[j] < a[mi] a[j] a j a[mi] a mi {
                    mi = j;
                } mi = j mi j if (i != mi) {
                int t = a[i];
                a[i] = a[mi];
                a[mi] = t;
                cnt++;
            } i != mi i mi {
                int t = a[i];
                a[i] = a[mi];
                a[mi] = t;
                cnt++;
            } int t = a[i]; t a[i] a i a[i] = a[mi] a[i] a i a[mi] a mi a[mi] = t a[mi] a mi t cnt++ cnt return cnt; cnt int[] a a public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int[] A = new int[N];
        for (int i = 0; i < N; i++) {
            A[i] = scanner.nextInt();
        }
        int cnt = sort(A);
        for (int i = 0; i < N; i++) {
            System.out.print(A[i]);
            if (i == N - 1) {
                System.out.println("");
            } else {
                System.out.print(" ");
            }
        }
        System.out.println(cnt);
    }

    private static int sort(int[] a) {
        int cnt = 0;
        for (int i = 0; i < a.length; i++) {
            int mi = i;
            for (int j = i + 1; j < a.length; j++) {
                if (a[j] < a[mi]) {
                    mi = j;
                }
            }
            if (i != mi) {
                int t = a[i];
                a[i] = a[mi];
                a[mi] = t;
                cnt++;
            }
       }
        return cnt;
    }
} public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int[] A = new int[N];
        for (int i = 0; i < N; i++) {
            A[i] = scanner.nextInt();
        }
        int cnt = sort(A);
        for (int i = 0; i < N; i++) {
            System.out.print(A[i]);
            if (i == N - 1) {
                System.out.println("");
            } else {
                System.out.print(" ");
            }
        }
        System.out.println(cnt);
    }

    private static int sort(int[] a) {
        int cnt = 0;
        for (int i = 0; i < a.length; i++) {
            int mi = i;
            for (int j = i + 1; j < a.length; j++) {
                if (a[j] < a[mi]) {
                    mi = j;
                }
            }
            if (i != mi) {
                int t = a[i];
                a[i] = a[mi];
                a[mi] = t;
                cnt++;
            }
       }
        return cnt;
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int[] A = new int[N];
        for (int i = 0; i < N; i++) {
            A[i] = scanner.nextInt();
        }
        int cnt = sort(A);
        for (int i = 0; i < N; i++) {
            System.out.print(A[i]);
            if (i == N - 1) {
                System.out.println("");
            } else {
                System.out.print(" ");
            }
        }
        System.out.println(cnt);
    }

    private static int sort(int[] a) {
        int cnt = 0;
        for (int i = 0; i < a.length; i++) {
            int mi = i;
            for (int j = i + 1; j < a.length; j++) {
                if (a[j] < a[mi]) {
                    mi = j;
                }
            }
            if (i != mi) {
                int t = a[i];
                a[i] = a[mi];
                a[mi] = t;
                cnt++;
            }
       }
        return cnt;
    }
}