import 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();
        }

        // sort begin
        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 (i!=minj){
                int temp = a[i];
                a[i] = a[minj];
                a[minj] = temp;
                cnt++;
            }
        }
        //sort end
        print(a);
        System.out.println(cnt);
    }

    public static void print(int[] a){
        System.out.print(a[0]);
        for (int i=1;i<a.length;i++){
            System.out.print(" "+a[i]);
        }
        System.out.println();
    }
} 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[] a = new int[n];
        for (int i = 0; i<n;i++){
            a[i] = sc.nextInt();
        }

        // sort begin
        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 (i!=minj){
                int temp = a[i];
                a[i] = a[minj];
                a[minj] = temp;
                cnt++;
            }
        }
        //sort end
        print(a);
        System.out.println(cnt);
    }

    public static void print(int[] a){
        System.out.print(a[0]);
        for (int i=1;i<a.length;i++){
            System.out.print(" "+a[i]);
        }
        System.out.println();
    }
} 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();
        }

        // sort begin
        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 (i!=minj){
                int temp = a[i];
                a[i] = a[minj];
                a[minj] = temp;
                cnt++;
            }
        }
        //sort end
        print(a);
        System.out.println(cnt);
    } 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();
        }

        // sort begin
        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 (i!=minj){
                int temp = a[i];
                a[i] = a[minj];
                a[minj] = temp;
                cnt++;
            }
        }
        //sort end
        print(a);
        System.out.println(cnt);
    } 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 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 (i!=minj){
                int temp = a[i];
                a[i] = a[minj];
                a[minj] = temp;
                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 (i!=minj){
                int temp = a[i];
                a[i] = a[minj];
                a[minj] = temp;
                cnt++;
            }
        } {
            int minj = i;
            for (int j = i; j < n; j++){
                if (a[j]<a[minj]){
                    minj = j;
                }
            }
            if (i!=minj){
                int temp = a[i];
                a[i] = a[minj];
                a[minj] = temp;
                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 (i!=minj){
                int temp = a[i];
                a[i] = a[minj];
                a[minj] = temp;
                cnt++;
            } i!=minj i minj {
                int temp = a[i];
                a[i] = a[minj];
                a[minj] = temp;
                cnt++;
            } int temp = a[i]; temp a[i] a i a[i] = a[minj] a[i] a i a[minj] a minj a[minj] = temp a[minj] a minj temp cnt++ cnt print(a) print a System.out.println(cnt) System.out.println System.out System System.out cnt String args[] args public static void print(int[] a){
        System.out.print(a[0]);
        for (int i=1;i<a.length;i++){
            System.out.print(" "+a[i]);
        }
        System.out.println();
    } print {
        System.out.print(a[0]);
        for (int i=1;i<a.length;i++){
            System.out.print(" "+a[i]);
        }
        System.out.println();
    } System.out.print(a[0]) System.out.print System.out System System.out a[0] a 0 for (int i=1;i<a.length;i++){
            System.out.print(" "+a[i]);
        } int i=1; int i=1; i 1 i<a.length i a.length a a.length i++ i++ i {
            System.out.print(" "+a[i]);
        } {
            System.out.print(" "+a[i]);
        } System.out.print(" "+a[i]) System.out.print System.out System System.out " "+a[i] " " a[i] a i System.out.println() System.out.println System.out System System.out int[] a a 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();
        }

        // sort begin
        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 (i!=minj){
                int temp = a[i];
                a[i] = a[minj];
                a[minj] = temp;
                cnt++;
            }
        }
        //sort end
        print(a);
        System.out.println(cnt);
    }

    public static void print(int[] a){
        System.out.print(a[0]);
        for (int i=1;i<a.length;i++){
            System.out.print(" "+a[i]);
        }
        System.out.println();
    }
} 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();
        }

        // sort begin
        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 (i!=minj){
                int temp = a[i];
                a[i] = a[minj];
                a[minj] = temp;
                cnt++;
            }
        }
        //sort end
        print(a);
        System.out.println(cnt);
    }

    public static void print(int[] a){
        System.out.print(a[0]);
        for (int i=1;i<a.length;i++){
            System.out.print(" "+a[i]);
        }
        System.out.println();
    }
} Main
import 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();
        }

        // sort begin
        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 (i!=minj){
                int temp = a[i];
                a[i] = a[minj];
                a[minj] = temp;
                cnt++;
            }
        }
        //sort end
        print(a);
        System.out.println(cnt);
    }

    public static void print(int[] a){
        System.out.print(a[0]);
        for (int i=1;i<a.length;i++){
            System.out.print(" "+a[i]);
        }
        System.out.println();
    }
}