import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner a = new Scanner(System.in);
        int n = a.nextInt();
        int A[] = new int[n];
        for(int i=0; i<n; i++){
            A[i] = a.nextInt();
        }
        int minj;
        int count = 0;
        for(int i=0; i<=n-2; i++){
            minj = i;
            int c=0;
            for(int j=i+1; j<=n-1; j++){
                if(A[j] < A[minj]){
                    minj = j;
                    c = 1;
                }
            }
            if(c==1){
                int x = A[i];
                A[i] = A[minj];
                A[minj] = x; 
                count++;
            }
        }
        for(int i=0; i<n; i++){
            System.out.print(A[i]);
            if(i<n-1){
                System.out.print(" ");
            }
        }
        System.out.println();
        System.out.println(count);
    }
} import java.util.*; util.* java public class Main{
    public static void main(String[] args){
        Scanner a = new Scanner(System.in);
        int n = a.nextInt();
        int A[] = new int[n];
        for(int i=0; i<n; i++){
            A[i] = a.nextInt();
        }
        int minj;
        int count = 0;
        for(int i=0; i<=n-2; i++){
            minj = i;
            int c=0;
            for(int j=i+1; j<=n-1; j++){
                if(A[j] < A[minj]){
                    minj = j;
                    c = 1;
                }
            }
            if(c==1){
                int x = A[i];
                A[i] = A[minj];
                A[minj] = x; 
                count++;
            }
        }
        for(int i=0; i<n; i++){
            System.out.print(A[i]);
            if(i<n-1){
                System.out.print(" ");
            }
        }
        System.out.println();
        System.out.println(count);
    }
} Main public static void main(String[] args){
        Scanner a = new Scanner(System.in);
        int n = a.nextInt();
        int A[] = new int[n];
        for(int i=0; i<n; i++){
            A[i] = a.nextInt();
        }
        int minj;
        int count = 0;
        for(int i=0; i<=n-2; i++){
            minj = i;
            int c=0;
            for(int j=i+1; j<=n-1; j++){
                if(A[j] < A[minj]){
                    minj = j;
                    c = 1;
                }
            }
            if(c==1){
                int x = A[i];
                A[i] = A[minj];
                A[minj] = x; 
                count++;
            }
        }
        for(int i=0; i<n; i++){
            System.out.print(A[i]);
            if(i<n-1){
                System.out.print(" ");
            }
        }
        System.out.println();
        System.out.println(count);
    } main {
        Scanner a = new Scanner(System.in);
        int n = a.nextInt();
        int A[] = new int[n];
        for(int i=0; i<n; i++){
            A[i] = a.nextInt();
        }
        int minj;
        int count = 0;
        for(int i=0; i<=n-2; i++){
            minj = i;
            int c=0;
            for(int j=i+1; j<=n-1; j++){
                if(A[j] < A[minj]){
                    minj = j;
                    c = 1;
                }
            }
            if(c==1){
                int x = A[i];
                A[i] = A[minj];
                A[minj] = x; 
                count++;
            }
        }
        for(int i=0; i<n; i++){
            System.out.print(A[i]);
            if(i<n-1){
                System.out.print(" ");
            }
        }
        System.out.println();
        System.out.println(count);
    } Scanner a = new Scanner(System.in); a new Scanner(System.in) int n = a.nextInt(); n a.nextInt() a.nextInt a int A[] = new int[n]; A new int[n] n for(int i=0; i<n; i++){
            A[i] = a.nextInt();
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            A[i] = a.nextInt();
        } {
            A[i] = a.nextInt();
        } A[i] = a.nextInt() A[i] A i a.nextInt() a.nextInt a int minj; minj int count = 0; count 0 for(int i=0; i<=n-2; i++){
            minj = i;
            int c=0;
            for(int j=i+1; j<=n-1; j++){
                if(A[j] < A[minj]){
                    minj = j;
                    c = 1;
                }
            }
            if(c==1){
                int x = A[i];
                A[i] = A[minj];
                A[minj] = x; 
                count++;
            }
        } int i=0; int i=0; i 0 i<=n-2 i n-2 n 2 i++ i++ i {
            minj = i;
            int c=0;
            for(int j=i+1; j<=n-1; j++){
                if(A[j] < A[minj]){
                    minj = j;
                    c = 1;
                }
            }
            if(c==1){
                int x = A[i];
                A[i] = A[minj];
                A[minj] = x; 
                count++;
            }
        } {
            minj = i;
            int c=0;
            for(int j=i+1; j<=n-1; j++){
                if(A[j] < A[minj]){
                    minj = j;
                    c = 1;
                }
            }
            if(c==1){
                int x = A[i];
                A[i] = A[minj];
                A[minj] = x; 
                count++;
            }
        } minj = i minj i int c=0; c 0 for(int j=i+1; j<=n-1; j++){
                if(A[j] < A[minj]){
                    minj = j;
                    c = 1;
                }
            } int j=i+1; int j=i+1; j i+1 i 1 j<=n-1 j n-1 n 1 j++ j++ j {
                if(A[j] < A[minj]){
                    minj = j;
                    c = 1;
                }
            } {
                if(A[j] < A[minj]){
                    minj = j;
                    c = 1;
                }
            } if(A[j] < A[minj]){
                    minj = j;
                    c = 1;
                } A[j] < A[minj] A[j] A j A[minj] A minj {
                    minj = j;
                    c = 1;
                } minj = j minj j c = 1 c 1 if(c==1){
                int x = A[i];
                A[i] = A[minj];
                A[minj] = x; 
                count++;
            } c==1 c 1 {
                int x = A[i];
                A[i] = A[minj];
                A[minj] = x; 
                count++;
            } int x = A[i]; x A[i] A i A[i] = A[minj] A[i] A i A[minj] A minj A[minj] = x A[minj] A minj x count++ count for(int i=0; i<n; i++){
            System.out.print(A[i]);
            if(i<n-1){
                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.print(" ");
            }
        } {
            System.out.print(A[i]);
            if(i<n-1){
                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.print(" ");
            } i<n-1 i n-1 n 1 {
                System.out.print(" ");
            } System.out.print(" ") System.out.print System.out System System.out " " System.out.println() System.out.println System.out System System.out System.out.println(count) System.out.println System.out System System.out count String[] args args public class Main{
    public static void main(String[] args){
        Scanner a = new Scanner(System.in);
        int n = a.nextInt();
        int A[] = new int[n];
        for(int i=0; i<n; i++){
            A[i] = a.nextInt();
        }
        int minj;
        int count = 0;
        for(int i=0; i<=n-2; i++){
            minj = i;
            int c=0;
            for(int j=i+1; j<=n-1; j++){
                if(A[j] < A[minj]){
                    minj = j;
                    c = 1;
                }
            }
            if(c==1){
                int x = A[i];
                A[i] = A[minj];
                A[minj] = x; 
                count++;
            }
        }
        for(int i=0; i<n; i++){
            System.out.print(A[i]);
            if(i<n-1){
                System.out.print(" ");
            }
        }
        System.out.println();
        System.out.println(count);
    }
} public class Main{
    public static void main(String[] args){
        Scanner a = new Scanner(System.in);
        int n = a.nextInt();
        int A[] = new int[n];
        for(int i=0; i<n; i++){
            A[i] = a.nextInt();
        }
        int minj;
        int count = 0;
        for(int i=0; i<=n-2; i++){
            minj = i;
            int c=0;
            for(int j=i+1; j<=n-1; j++){
                if(A[j] < A[minj]){
                    minj = j;
                    c = 1;
                }
            }
            if(c==1){
                int x = A[i];
                A[i] = A[minj];
                A[minj] = x; 
                count++;
            }
        }
        for(int i=0; i<n; i++){
            System.out.print(A[i]);
            if(i<n-1){
                System.out.print(" ");
            }
        }
        System.out.println();
        System.out.println(count);
    }
} Main
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner a = new Scanner(System.in);
        int n = a.nextInt();
        int A[] = new int[n];
        for(int i=0; i<n; i++){
            A[i] = a.nextInt();
        }
        int minj;
        int count = 0;
        for(int i=0; i<=n-2; i++){
            minj = i;
            int c=0;
            for(int j=i+1; j<=n-1; j++){
                if(A[j] < A[minj]){
                    minj = j;
                    c = 1;
                }
            }
            if(c==1){
                int x = A[i];
                A[i] = A[minj];
                A[minj] = x; 
                count++;
            }
        }
        for(int i=0; i<n; i++){
            System.out.print(A[i]);
            if(i<n-1){
                System.out.print(" ");
            }
        }
        System.out.println();
        System.out.println(count);
    }
}
