import java.util.*;
class Main{
public static void main(String[] args) {
    Scanner yin = new Scanner(System.in);
    
    
    int N = yin.nextInt();
    int[] num = new int[N];
   
    
    for (int i = 0,j; i < N; i++) {
             num[i] = yin.nextInt();
        }
    
    int suanchang=0;
        
        for(int i = 0; i < num.length-1; i++){
            int min = i;
            
            for(int j = i+1; j <num.length ;j++){
                if(num[j]<num[min]){
                    min = j;
                }
            }
            if(min!=i){
               int temp = num[i];
                num[i] = num[min];
                 num[min] = temp;
                   suanchang++;
            }
        
        }
    

    
    for(int i=0;i<num.length-1;i++){
        System.out.print(num[i] + " ");
   }
        
        
        System.out.print(num[N-1]);
        System.out.println();
        System.out.println(suanchang);
   
    
    
            }

    } import java.util.*; util.* java class Main{
public static void main(String[] args) {
    Scanner yin = new Scanner(System.in);
    
    
    int N = yin.nextInt();
    int[] num = new int[N];
   
    
    for (int i = 0,j; i < N; i++) {
             num[i] = yin.nextInt();
        }
    
    int suanchang=0;
        
        for(int i = 0; i < num.length-1; i++){
            int min = i;
            
            for(int j = i+1; j <num.length ;j++){
                if(num[j]<num[min]){
                    min = j;
                }
            }
            if(min!=i){
               int temp = num[i];
                num[i] = num[min];
                 num[min] = temp;
                   suanchang++;
            }
        
        }
    

    
    for(int i=0;i<num.length-1;i++){
        System.out.print(num[i] + " ");
   }
        
        
        System.out.print(num[N-1]);
        System.out.println();
        System.out.println(suanchang);
   
    
    
            }

    } Main public static void main(String[] args) {
    Scanner yin = new Scanner(System.in);
    
    
    int N = yin.nextInt();
    int[] num = new int[N];
   
    
    for (int i = 0,j; i < N; i++) {
             num[i] = yin.nextInt();
        }
    
    int suanchang=0;
        
        for(int i = 0; i < num.length-1; i++){
            int min = i;
            
            for(int j = i+1; j <num.length ;j++){
                if(num[j]<num[min]){
                    min = j;
                }
            }
            if(min!=i){
               int temp = num[i];
                num[i] = num[min];
                 num[min] = temp;
                   suanchang++;
            }
        
        }
    

    
    for(int i=0;i<num.length-1;i++){
        System.out.print(num[i] + " ");
   }
        
        
        System.out.print(num[N-1]);
        System.out.println();
        System.out.println(suanchang);
   
    
    
            } main {
    Scanner yin = new Scanner(System.in);
    
    
    int N = yin.nextInt();
    int[] num = new int[N];
   
    
    for (int i = 0,j; i < N; i++) {
             num[i] = yin.nextInt();
        }
    
    int suanchang=0;
        
        for(int i = 0; i < num.length-1; i++){
            int min = i;
            
            for(int j = i+1; j <num.length ;j++){
                if(num[j]<num[min]){
                    min = j;
                }
            }
            if(min!=i){
               int temp = num[i];
                num[i] = num[min];
                 num[min] = temp;
                   suanchang++;
            }
        
        }
    

    
    for(int i=0;i<num.length-1;i++){
        System.out.print(num[i] + " ");
   }
        
        
        System.out.print(num[N-1]);
        System.out.println();
        System.out.println(suanchang);
   
    
    
            } Scanner yin = new Scanner(System.in); yin new Scanner(System.in) int N = yin.nextInt(); N yin.nextInt() yin.nextInt yin int[] num = new int[N]; num new int[N] N for (int i = 0,j; i < N; i++) {
             num[i] = yin.nextInt();
        } int i = 0,j; int i = 0 i 0 j; j i < N i N i++ i++ i {
             num[i] = yin.nextInt();
        } {
             num[i] = yin.nextInt();
        } num[i] = yin.nextInt() num[i] num i yin.nextInt() yin.nextInt yin int suanchang=0; suanchang 0 for(int i = 0; i < num.length-1; i++){
            int min = i;
            
            for(int j = i+1; j <num.length ;j++){
                if(num[j]<num[min]){
                    min = j;
                }
            }
            if(min!=i){
               int temp = num[i];
                num[i] = num[min];
                 num[min] = temp;
                   suanchang++;
            }
        
        } int i = 0; int i = 0; i 0 i < num.length-1 i num.length-1 num.length num num.length 1 i++ i++ i {
            int min = i;
            
            for(int j = i+1; j <num.length ;j++){
                if(num[j]<num[min]){
                    min = j;
                }
            }
            if(min!=i){
               int temp = num[i];
                num[i] = num[min];
                 num[min] = temp;
                   suanchang++;
            }
        
        } {
            int min = i;
            
            for(int j = i+1; j <num.length ;j++){
                if(num[j]<num[min]){
                    min = j;
                }
            }
            if(min!=i){
               int temp = num[i];
                num[i] = num[min];
                 num[min] = temp;
                   suanchang++;
            }
        
        } int min = i; min i for(int j = i+1; j <num.length ;j++){
                if(num[j]<num[min]){
                    min = j;
                }
            } int j = i+1; int j = i+1; j i+1 i 1 j <num.length j num.length num num.length j++ j++ j {
                if(num[j]<num[min]){
                    min = j;
                }
            } {
                if(num[j]<num[min]){
                    min = j;
                }
            } if(num[j]<num[min]){
                    min = j;
                } num[j]<num[min] num[j] num j num[min] num min {
                    min = j;
                } min = j min j if(min!=i){
               int temp = num[i];
                num[i] = num[min];
                 num[min] = temp;
                   suanchang++;
            } min!=i min i {
               int temp = num[i];
                num[i] = num[min];
                 num[min] = temp;
                   suanchang++;
            } int temp = num[i]; temp num[i] num i num[i] = num[min] num[i] num i num[min] num min num[min] = temp num[min] num min temp suanchang++ suanchang for(int i=0;i<num.length-1;i++){
        System.out.print(num[i] + " ");
   } int i=0; int i=0; i 0 i<num.length-1 i num.length-1 num.length num num.length 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.print(num[N-1]) System.out.print System.out System System.out num[N-1] num N-1 N 1 System.out.println() System.out.println System.out System System.out System.out.println(suanchang) System.out.println System.out System System.out suanchang String[] args args
import java.util.*;
class Main{
public static void main(String[] args) {
    Scanner yin = new Scanner(System.in);
    
    
    int N = yin.nextInt();
    int[] num = new int[N];
   
    
    for (int i = 0,j; i < N; i++) {
             num[i] = yin.nextInt();
        }
    
    int suanchang=0;
        
        for(int i = 0; i < num.length-1; i++){
            int min = i;
            
            for(int j = i+1; j <num.length ;j++){
                if(num[j]<num[min]){
                    min = j;
                }
            }
            if(min!=i){
               int temp = num[i];
                num[i] = num[min];
                 num[min] = temp;
                   suanchang++;
            }
        
        }
    

    
    for(int i=0;i<num.length-1;i++){
        System.out.print(num[i] + " ");
   }
        
        
        System.out.print(num[N-1]);
        System.out.println();
        System.out.println(suanchang);
   
    
    
            }

    }
