import java.util.Scanner;

public class Main {

    static Scanner sc = new Scanner(System.in);

    static void checkArray(int[] a){
        int i ;
        for( i = 0; i < a.length -1; i++){
                System.out.print(a[i] +" ");
        }
        System.out.print(a[i]);
        System.out.println();
    }
    static int[] makeArray(int num){
        int[] arr = new int[num];
        for( int i = 0; i < num; i++){
            arr[i] = sc.nextInt();
        }
        return arr;
    } 
    static int minOf(int[] a, int start) {
        int index = start;
        int min = a[start];
        for(int i = start; i < a.length; i++) {
            if(a[i] < min) {
                min = a[i];
                index = i;
            }
        }
        return index;
    }
    static void swap(int[] a,int i, int j ){
        int temp = a[i];
        a[i] = a[j];
        a[j] = temp;    
    }
    
    public static void main(String[] args) {
        int N = sc.nextInt();
        int[] arr = makeArray(N);
        
        int index;
        int count = 0;
        for(int i = 0; i < N; i++) {
            index = minOf(arr,i);
            if(arr[index] != arr[i]) {
                swap(arr,i,index);
                count++;
            }
            
        }
        checkArray(arr);
        System.out.println(count);
    }

} import java.util.Scanner; Scanner java.util public class Main {

    static Scanner sc = new Scanner(System.in);

    static void checkArray(int[] a){
        int i ;
        for( i = 0; i < a.length -1; i++){
                System.out.print(a[i] +" ");
        }
        System.out.print(a[i]);
        System.out.println();
    }
    static int[] makeArray(int num){
        int[] arr = new int[num];
        for( int i = 0; i < num; i++){
            arr[i] = sc.nextInt();
        }
        return arr;
    } 
    static int minOf(int[] a, int start) {
        int index = start;
        int min = a[start];
        for(int i = start; i < a.length; i++) {
            if(a[i] < min) {
                min = a[i];
                index = i;
            }
        }
        return index;
    }
    static void swap(int[] a,int i, int j ){
        int temp = a[i];
        a[i] = a[j];
        a[j] = temp;    
    }
    
    public static void main(String[] args) {
        int N = sc.nextInt();
        int[] arr = makeArray(N);
        
        int index;
        int count = 0;
        for(int i = 0; i < N; i++) {
            index = minOf(arr,i);
            if(arr[index] != arr[i]) {
                swap(arr,i,index);
                count++;
            }
            
        }
        checkArray(arr);
        System.out.println(count);
    }

} Main static Scanner sc = new Scanner(System.in); sc new Scanner(System.in) static void checkArray(int[] a){
        int i ;
        for( i = 0; i < a.length -1; i++){
                System.out.print(a[i] +" ");
        }
        System.out.print(a[i]);
        System.out.println();
    } checkArray {
        int i ;
        for( i = 0; i < a.length -1; i++){
                System.out.print(a[i] +" ");
        }
        System.out.print(a[i]);
        System.out.println();
    } int i ; i for( i = 0; i < a.length -1; i++){
                System.out.print(a[i] +" ");
        } i = 0; i = 0 i 0 i < a.length -1 i a.length -1 a.length a a.length 1 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.print(a[i]) System.out.print System.out System System.out a[i] a i System.out.println() System.out.println System.out System System.out int[] a a static int[] makeArray(int num){
        int[] arr = new int[num];
        for( int i = 0; i < num; i++){
            arr[i] = sc.nextInt();
        }
        return arr;
    } makeArray {
        int[] arr = new int[num];
        for( int i = 0; i < num; i++){
            arr[i] = sc.nextInt();
        }
        return arr;
    } int[] arr = new int[num]; arr new int[num] num for( int i = 0; i < num; i++){
            arr[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < num i num i++ i++ i {
            arr[i] = sc.nextInt();
        } {
            arr[i] = sc.nextInt();
        } arr[i] = sc.nextInt() arr[i] arr i sc.nextInt() sc.nextInt sc return arr; arr int num num static int minOf(int[] a, int start) {
        int index = start;
        int min = a[start];
        for(int i = start; i < a.length; i++) {
            if(a[i] < min) {
                min = a[i];
                index = i;
            }
        }
        return index;
    } minOf {
        int index = start;
        int min = a[start];
        for(int i = start; i < a.length; i++) {
            if(a[i] < min) {
                min = a[i];
                index = i;
            }
        }
        return index;
    } int index = start; index start int min = a[start]; min a[start] a start for(int i = start; i < a.length; i++) {
            if(a[i] < min) {
                min = a[i];
                index = i;
            }
        } int i = start; int i = start; i start i < a.length i a.length a a.length i++ i++ i {
            if(a[i] < min) {
                min = a[i];
                index = i;
            }
        } {
            if(a[i] < min) {
                min = a[i];
                index = i;
            }
        } if(a[i] < min) {
                min = a[i];
                index = i;
            } a[i] < min a[i] a i min {
                min = a[i];
                index = i;
            } min = a[i] min a[i] a i index = i index i return index; index int[] a a int start start static void swap(int[] a,int i, int j ){
        int temp = a[i];
        a[i] = a[j];
        a[j] = temp;    
    } swap {
        int temp = a[i];
        a[i] = a[j];
        a[j] = temp;    
    } int temp = a[i]; temp a[i] a i a[i] = a[j] a[i] a i a[j] a j a[j] = temp a[j] a j temp int[] a a int i i int j j public static void main(String[] args) {
        int N = sc.nextInt();
        int[] arr = makeArray(N);
        
        int index;
        int count = 0;
        for(int i = 0; i < N; i++) {
            index = minOf(arr,i);
            if(arr[index] != arr[i]) {
                swap(arr,i,index);
                count++;
            }
            
        }
        checkArray(arr);
        System.out.println(count);
    } main {
        int N = sc.nextInt();
        int[] arr = makeArray(N);
        
        int index;
        int count = 0;
        for(int i = 0; i < N; i++) {
            index = minOf(arr,i);
            if(arr[index] != arr[i]) {
                swap(arr,i,index);
                count++;
            }
            
        }
        checkArray(arr);
        System.out.println(count);
    } int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int[] arr = makeArray(N); arr makeArray(N) makeArray N int index; index int count = 0; count 0 for(int i = 0; i < N; i++) {
            index = minOf(arr,i);
            if(arr[index] != arr[i]) {
                swap(arr,i,index);
                count++;
            }
            
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            index = minOf(arr,i);
            if(arr[index] != arr[i]) {
                swap(arr,i,index);
                count++;
            }
            
        } {
            index = minOf(arr,i);
            if(arr[index] != arr[i]) {
                swap(arr,i,index);
                count++;
            }
            
        } index = minOf(arr,i) index minOf(arr,i) minOf arr i if(arr[index] != arr[i]) {
                swap(arr,i,index);
                count++;
            } arr[index] != arr[i] arr[index] arr index arr[i] arr i {
                swap(arr,i,index);
                count++;
            } swap(arr,i,index) swap arr i index count++ count checkArray(arr) checkArray arr System.out.println(count) System.out.println System.out System System.out count String[] args args public class Main {

    static Scanner sc = new Scanner(System.in);

    static void checkArray(int[] a){
        int i ;
        for( i = 0; i < a.length -1; i++){
                System.out.print(a[i] +" ");
        }
        System.out.print(a[i]);
        System.out.println();
    }
    static int[] makeArray(int num){
        int[] arr = new int[num];
        for( int i = 0; i < num; i++){
            arr[i] = sc.nextInt();
        }
        return arr;
    } 
    static int minOf(int[] a, int start) {
        int index = start;
        int min = a[start];
        for(int i = start; i < a.length; i++) {
            if(a[i] < min) {
                min = a[i];
                index = i;
            }
        }
        return index;
    }
    static void swap(int[] a,int i, int j ){
        int temp = a[i];
        a[i] = a[j];
        a[j] = temp;    
    }
    
    public static void main(String[] args) {
        int N = sc.nextInt();
        int[] arr = makeArray(N);
        
        int index;
        int count = 0;
        for(int i = 0; i < N; i++) {
            index = minOf(arr,i);
            if(arr[index] != arr[i]) {
                swap(arr,i,index);
                count++;
            }
            
        }
        checkArray(arr);
        System.out.println(count);
    }

} public class Main {

    static Scanner sc = new Scanner(System.in);

    static void checkArray(int[] a){
        int i ;
        for( i = 0; i < a.length -1; i++){
                System.out.print(a[i] +" ");
        }
        System.out.print(a[i]);
        System.out.println();
    }
    static int[] makeArray(int num){
        int[] arr = new int[num];
        for( int i = 0; i < num; i++){
            arr[i] = sc.nextInt();
        }
        return arr;
    } 
    static int minOf(int[] a, int start) {
        int index = start;
        int min = a[start];
        for(int i = start; i < a.length; i++) {
            if(a[i] < min) {
                min = a[i];
                index = i;
            }
        }
        return index;
    }
    static void swap(int[] a,int i, int j ){
        int temp = a[i];
        a[i] = a[j];
        a[j] = temp;    
    }
    
    public static void main(String[] args) {
        int N = sc.nextInt();
        int[] arr = makeArray(N);
        
        int index;
        int count = 0;
        for(int i = 0; i < N; i++) {
            index = minOf(arr,i);
            if(arr[index] != arr[i]) {
                swap(arr,i,index);
                count++;
            }
            
        }
        checkArray(arr);
        System.out.println(count);
    }

} Main
import java.util.Scanner;

public class Main {

    static Scanner sc = new Scanner(System.in);

    static void checkArray(int[] a){
        int i ;
        for( i = 0; i < a.length -1; i++){
                System.out.print(a[i] +" ");
        }
        System.out.print(a[i]);
        System.out.println();
    }
    static int[] makeArray(int num){
        int[] arr = new int[num];
        for( int i = 0; i < num; i++){
            arr[i] = sc.nextInt();
        }
        return arr;
    } 
    static int minOf(int[] a, int start) {
        int index = start;
        int min = a[start];
        for(int i = start; i < a.length; i++) {
            if(a[i] < min) {
                min = a[i];
                index = i;
            }
        }
        return index;
    }
    static void swap(int[] a,int i, int j ){
        int temp = a[i];
        a[i] = a[j];
        a[j] = temp;    
    }
    
    public static void main(String[] args) {
        int N = sc.nextInt();
        int[] arr = makeArray(N);
        
        int index;
        int count = 0;
        for(int i = 0; i < N; i++) {
            index = minOf(arr,i);
            if(arr[index] != arr[i]) {
                swap(arr,i,index);
                count++;
            }
            
        }
        checkArray(arr);
        System.out.println(count);
    }

}