import java.util.Scanner;

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

        int i, j, t;
        int cnt = 0;
        int check = 0;
        int mini, minikey;
        int n = sc.nextInt();
        int[] num;
        num = new int[n];

        for(i=0; i<n; i++){
            num[i] = sc.nextInt();
        }

        for(i=0; i<n-1; i++){
            mini =i;
            minikey = num[i];
            for(j=i+1; j < n; j++){
                if(num[j] < minikey){
                    mini = j;
                    minikey = num[j];
                    check++;
                }
            }
            t = num[i];
            num[i] = num[mini];
            num[mini] = t;
            if(check >0)
                cnt++; check=0;
        }

        for(i=0; i<n-1; i++){
            System.out.print(num[i]+" ");
        }
        System.out.println(num[n-1]);
        System.out.println(cnt);
        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 i, j, t;
        int cnt = 0;
        int check = 0;
        int mini, minikey;
        int n = sc.nextInt();
        int[] num;
        num = new int[n];

        for(i=0; i<n; i++){
            num[i] = sc.nextInt();
        }

        for(i=0; i<n-1; i++){
            mini =i;
            minikey = num[i];
            for(j=i+1; j < n; j++){
                if(num[j] < minikey){
                    mini = j;
                    minikey = num[j];
                    check++;
                }
            }
            t = num[i];
            num[i] = num[mini];
            num[mini] = t;
            if(check >0)
                cnt++; check=0;
        }

        for(i=0; i<n-1; i++){
            System.out.print(num[i]+" ");
        }
        System.out.println(num[n-1]);
        System.out.println(cnt);
        sc.close();


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

        int i, j, t;
        int cnt = 0;
        int check = 0;
        int mini, minikey;
        int n = sc.nextInt();
        int[] num;
        num = new int[n];

        for(i=0; i<n; i++){
            num[i] = sc.nextInt();
        }

        for(i=0; i<n-1; i++){
            mini =i;
            minikey = num[i];
            for(j=i+1; j < n; j++){
                if(num[j] < minikey){
                    mini = j;
                    minikey = num[j];
                    check++;
                }
            }
            t = num[i];
            num[i] = num[mini];
            num[mini] = t;
            if(check >0)
                cnt++; check=0;
        }

        for(i=0; i<n-1; i++){
            System.out.print(num[i]+" ");
        }
        System.out.println(num[n-1]);
        System.out.println(cnt);
        sc.close();


    } main {
        Scanner sc = new Scanner(System.in);

        int i, j, t;
        int cnt = 0;
        int check = 0;
        int mini, minikey;
        int n = sc.nextInt();
        int[] num;
        num = new int[n];

        for(i=0; i<n; i++){
            num[i] = sc.nextInt();
        }

        for(i=0; i<n-1; i++){
            mini =i;
            minikey = num[i];
            for(j=i+1; j < n; j++){
                if(num[j] < minikey){
                    mini = j;
                    minikey = num[j];
                    check++;
                }
            }
            t = num[i];
            num[i] = num[mini];
            num[mini] = t;
            if(check >0)
                cnt++; check=0;
        }

        for(i=0; i<n-1; i++){
            System.out.print(num[i]+" ");
        }
        System.out.println(num[n-1]);
        System.out.println(cnt);
        sc.close();


    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int i i j j t; t int cnt = 0; cnt 0 int check = 0; check 0 int mini mini minikey; minikey int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] num; num num = new int[n] num new int[n] n for(i=0; i<n; i++){
            num[i] = sc.nextInt();
        } i=0; i=0 i 0 i<n i n i++ i++ i {
            num[i] = sc.nextInt();
        } {
            num[i] = sc.nextInt();
        } num[i] = sc.nextInt() num[i] num i sc.nextInt() sc.nextInt sc for(i=0; i<n-1; i++){
            mini =i;
            minikey = num[i];
            for(j=i+1; j < n; j++){
                if(num[j] < minikey){
                    mini = j;
                    minikey = num[j];
                    check++;
                }
            }
            t = num[i];
            num[i] = num[mini];
            num[mini] = t;
            if(check >0)
                cnt++; check=0;
        } i=0; i=0 i 0 i<n-1 i n-1 n 1 i++ i++ i {
            mini =i;
            minikey = num[i];
            for(j=i+1; j < n; j++){
                if(num[j] < minikey){
                    mini = j;
                    minikey = num[j];
                    check++;
                }
            }
            t = num[i];
            num[i] = num[mini];
            num[mini] = t;
            if(check >0)
                cnt++; check=0;
        } {
            mini =i;
            minikey = num[i];
            for(j=i+1; j < n; j++){
                if(num[j] < minikey){
                    mini = j;
                    minikey = num[j];
                    check++;
                }
            }
            t = num[i];
            num[i] = num[mini];
            num[mini] = t;
            if(check >0)
                cnt++; check=0;
        } mini =i mini i minikey = num[i] minikey num[i] num i for(j=i+1; j < n; j++){
                if(num[j] < minikey){
                    mini = j;
                    minikey = num[j];
                    check++;
                }
            } j=i+1; j=i+1 j i+1 i 1 j < n j n j++ j++ j {
                if(num[j] < minikey){
                    mini = j;
                    minikey = num[j];
                    check++;
                }
            } {
                if(num[j] < minikey){
                    mini = j;
                    minikey = num[j];
                    check++;
                }
            } if(num[j] < minikey){
                    mini = j;
                    minikey = num[j];
                    check++;
                } num[j] < minikey num[j] num j minikey {
                    mini = j;
                    minikey = num[j];
                    check++;
                } mini = j mini j minikey = num[j] minikey num[j] num j check++ check t = num[i] t num[i] num i num[i] = num[mini] num[i] num i num[mini] num mini num[mini] = t num[mini] num mini t if(check >0)
                cnt++; check >0 check 0 cnt++ cnt check=0 check 0 for(i=0; i<n-1; i++){
            System.out.print(num[i]+" ");
        } i=0; i=0 i 0 i<n-1 i n-1 n 1 i++ i++ i {
            System.out.print(num[i]+" ");
        } {
            System.out.print(num[i]+" ");
        } System.out.print(num[i]+" ") System.out.print System.out System System.out num[i]+" " num[i] num i " " System.out.println(num[n-1]) System.out.println System.out System System.out num[n-1] num n-1 n 1 System.out.println(cnt) System.out.println System.out System System.out cnt sc.close() sc.close sc String[] args args public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int i, j, t;
        int cnt = 0;
        int check = 0;
        int mini, minikey;
        int n = sc.nextInt();
        int[] num;
        num = new int[n];

        for(i=0; i<n; i++){
            num[i] = sc.nextInt();
        }

        for(i=0; i<n-1; i++){
            mini =i;
            minikey = num[i];
            for(j=i+1; j < n; j++){
                if(num[j] < minikey){
                    mini = j;
                    minikey = num[j];
                    check++;
                }
            }
            t = num[i];
            num[i] = num[mini];
            num[mini] = t;
            if(check >0)
                cnt++; check=0;
        }

        for(i=0; i<n-1; i++){
            System.out.print(num[i]+" ");
        }
        System.out.println(num[n-1]);
        System.out.println(cnt);
        sc.close();


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

        int i, j, t;
        int cnt = 0;
        int check = 0;
        int mini, minikey;
        int n = sc.nextInt();
        int[] num;
        num = new int[n];

        for(i=0; i<n; i++){
            num[i] = sc.nextInt();
        }

        for(i=0; i<n-1; i++){
            mini =i;
            minikey = num[i];
            for(j=i+1; j < n; j++){
                if(num[j] < minikey){
                    mini = j;
                    minikey = num[j];
                    check++;
                }
            }
            t = num[i];
            num[i] = num[mini];
            num[mini] = t;
            if(check >0)
                cnt++; check=0;
        }

        for(i=0; i<n-1; i++){
            System.out.print(num[i]+" ");
        }
        System.out.println(num[n-1]);
        System.out.println(cnt);
        sc.close();


    }
} Main
import java.util.Scanner;

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

        int i, j, t;
        int cnt = 0;
        int check = 0;
        int mini, minikey;
        int n = sc.nextInt();
        int[] num;
        num = new int[n];

        for(i=0; i<n; i++){
            num[i] = sc.nextInt();
        }

        for(i=0; i<n-1; i++){
            mini =i;
            minikey = num[i];
            for(j=i+1; j < n; j++){
                if(num[j] < minikey){
                    mini = j;
                    minikey = num[j];
                    check++;
                }
            }
            t = num[i];
            num[i] = num[mini];
            num[mini] = t;
            if(check >0)
                cnt++; check=0;
        }

        for(i=0; i<n-1; i++){
            System.out.print(num[i]+" ");
        }
        System.out.println(num[n-1]);
        System.out.println(cnt);
        sc.close();


    }
}
