import java.awt.datatransfer.FlavorEvent;
import java.util.Scanner;
import javax.sound.midi.SysexMessage;
  
public class Main{      
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String str = sc.nextLine();
        String str2[] = str.split(" ");
        int ints[] = new int[n];
        int flag = 1;
        int count = 0;

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

        for(int i = 0;i<n;i++)
        {
            int minj=i;
            for(int j=i;j<n;j++)
                {
                    if(ints[j]<ints[minj])
                        minj=j;
                }
                if(minj!=i){
                    int ii = ints[i];
                    ints[i]=ints[minj];
                    ints[minj]=ii;
                    count++;
                }
            
        }

        for (int i = 0; i<n;i++)
        {
          System.out.print(ints[i]);
          if(i!=n-1)
            System.out.print(" ");
        }
        System.out.print("\n"+count+"\n");
    }   
} import java.awt.datatransfer.FlavorEvent; FlavorEvent java.awt.datatransfer import java.util.Scanner; Scanner java.util import javax.sound.midi.SysexMessage; SysexMessage javax.sound.midi public class Main{      
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String str = sc.nextLine();
        String str2[] = str.split(" ");
        int ints[] = new int[n];
        int flag = 1;
        int count = 0;

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

        for(int i = 0;i<n;i++)
        {
            int minj=i;
            for(int j=i;j<n;j++)
                {
                    if(ints[j]<ints[minj])
                        minj=j;
                }
                if(minj!=i){
                    int ii = ints[i];
                    ints[i]=ints[minj];
                    ints[minj]=ii;
                    count++;
                }
            
        }

        for (int i = 0; i<n;i++)
        {
          System.out.print(ints[i]);
          if(i!=n-1)
            System.out.print(" ");
        }
        System.out.print("\n"+count+"\n");
    }   
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String str = sc.nextLine();
        String str2[] = str.split(" ");
        int ints[] = new int[n];
        int flag = 1;
        int count = 0;

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

        for(int i = 0;i<n;i++)
        {
            int minj=i;
            for(int j=i;j<n;j++)
                {
                    if(ints[j]<ints[minj])
                        minj=j;
                }
                if(minj!=i){
                    int ii = ints[i];
                    ints[i]=ints[minj];
                    ints[minj]=ii;
                    count++;
                }
            
        }

        for (int i = 0; i<n;i++)
        {
          System.out.print(ints[i]);
          if(i!=n-1)
            System.out.print(" ");
        }
        System.out.print("\n"+count+"\n");
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String str = sc.nextLine();
        String str2[] = str.split(" ");
        int ints[] = new int[n];
        int flag = 1;
        int count = 0;

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

        for(int i = 0;i<n;i++)
        {
            int minj=i;
            for(int j=i;j<n;j++)
                {
                    if(ints[j]<ints[minj])
                        minj=j;
                }
                if(minj!=i){
                    int ii = ints[i];
                    ints[i]=ints[minj];
                    ints[minj]=ii;
                    count++;
                }
            
        }

        for (int i = 0; i<n;i++)
        {
          System.out.print(ints[i]);
          if(i!=n-1)
            System.out.print(" ");
        }
        System.out.print("\n"+count+"\n");
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc String str = sc.nextLine(); str sc.nextLine() sc.nextLine sc String str2[] = str.split(" "); str2 str.split(" ") str.split str " " int ints[] = new int[n]; ints new int[n] n int flag = 1; flag 1 int count = 0; count 0 for(int i = 0;i<n;i++)
        {
            ints[i]= sc.nextInt();
        } int i = 0; int i = 0; i 0 i<n i n i++ i++ i {
            ints[i]= sc.nextInt();
        } {
            ints[i]= sc.nextInt();
        } ints[i]= sc.nextInt() ints[i] ints i sc.nextInt() sc.nextInt sc for(int i = 0;i<n;i++)
        {
            int minj=i;
            for(int j=i;j<n;j++)
                {
                    if(ints[j]<ints[minj])
                        minj=j;
                }
                if(minj!=i){
                    int ii = ints[i];
                    ints[i]=ints[minj];
                    ints[minj]=ii;
                    count++;
                }
            
        } 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(ints[j]<ints[minj])
                        minj=j;
                }
                if(minj!=i){
                    int ii = ints[i];
                    ints[i]=ints[minj];
                    ints[minj]=ii;
                    count++;
                }
            
        } {
            int minj=i;
            for(int j=i;j<n;j++)
                {
                    if(ints[j]<ints[minj])
                        minj=j;
                }
                if(minj!=i){
                    int ii = ints[i];
                    ints[i]=ints[minj];
                    ints[minj]=ii;
                    count++;
                }
            
        } int minj=i; minj i for(int j=i;j<n;j++)
                {
                    if(ints[j]<ints[minj])
                        minj=j;
                } int j=i; int j=i; j i j<n j n j++ j++ j {
                    if(ints[j]<ints[minj])
                        minj=j;
                } {
                    if(ints[j]<ints[minj])
                        minj=j;
                } if(ints[j]<ints[minj])
                        minj=j; ints[j]<ints[minj] ints[j] ints j ints[minj] ints minj minj=j minj j if(minj!=i){
                    int ii = ints[i];
                    ints[i]=ints[minj];
                    ints[minj]=ii;
                    count++;
                } minj!=i minj i {
                    int ii = ints[i];
                    ints[i]=ints[minj];
                    ints[minj]=ii;
                    count++;
                } int ii = ints[i]; ii ints[i] ints i ints[i]=ints[minj] ints[i] ints i ints[minj] ints minj ints[minj]=ii ints[minj] ints minj ii count++ count for (int i = 0; i<n;i++)
        {
          System.out.print(ints[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(ints[i]);
          if(i!=n-1)
            System.out.print(" ");
        } {
          System.out.print(ints[i]);
          if(i!=n-1)
            System.out.print(" ");
        } System.out.print(ints[i]) System.out.print System.out System System.out ints[i] ints i if(i!=n-1)
            System.out.print(" "); i!=n-1 i n-1 n 1 System.out.print(" ") System.out.print System.out System System.out " " System.out.print("\n"+count+"\n") System.out.print System.out System System.out "\n"+count+"\n" "\n"+count+"\n" "\n" count "\n" String[] args args public class Main{      
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String str = sc.nextLine();
        String str2[] = str.split(" ");
        int ints[] = new int[n];
        int flag = 1;
        int count = 0;

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

        for(int i = 0;i<n;i++)
        {
            int minj=i;
            for(int j=i;j<n;j++)
                {
                    if(ints[j]<ints[minj])
                        minj=j;
                }
                if(minj!=i){
                    int ii = ints[i];
                    ints[i]=ints[minj];
                    ints[minj]=ii;
                    count++;
                }
            
        }

        for (int i = 0; i<n;i++)
        {
          System.out.print(ints[i]);
          if(i!=n-1)
            System.out.print(" ");
        }
        System.out.print("\n"+count+"\n");
    }   
} public class Main{      
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String str = sc.nextLine();
        String str2[] = str.split(" ");
        int ints[] = new int[n];
        int flag = 1;
        int count = 0;

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

        for(int i = 0;i<n;i++)
        {
            int minj=i;
            for(int j=i;j<n;j++)
                {
                    if(ints[j]<ints[minj])
                        minj=j;
                }
                if(minj!=i){
                    int ii = ints[i];
                    ints[i]=ints[minj];
                    ints[minj]=ii;
                    count++;
                }
            
        }

        for (int i = 0; i<n;i++)
        {
          System.out.print(ints[i]);
          if(i!=n-1)
            System.out.print(" ");
        }
        System.out.print("\n"+count+"\n");
    }   
} Main
import java.awt.datatransfer.FlavorEvent;
import java.util.Scanner;
import javax.sound.midi.SysexMessage;
  
public class Main{      
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String str = sc.nextLine();
        String str2[] = str.split(" ");
        int ints[] = new int[n];
        int flag = 1;
        int count = 0;

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

        for(int i = 0;i<n;i++)
        {
            int minj=i;
            for(int j=i;j<n;j++)
                {
                    if(ints[j]<ints[minj])
                        minj=j;
                }
                if(minj!=i){
                    int ii = ints[i];
                    ints[i]=ints[minj];
                    ints[minj]=ii;
                    count++;
                }
            
        }

        for (int i = 0; i<n;i++)
        {
          System.out.print(ints[i]);
          if(i!=n-1)
            System.out.print(" ");
        }
        System.out.print("\n"+count+"\n");
    }   
}
