import java.util.Scanner;

public class Main {

    public static int Num;
    public static int[] List;
    public static int Count=0;
    public static int min_j;
    public static int tmp;

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

        Num=scan.nextInt();

        List=new int[Num];

        for(int i=0;i<Num;i++)
        {
            List[i]=scan.nextInt();
        }

        SelectionSort();

        if(Num==1) System.out.println(List[0]);
        else
        {
            for (int i = 0; i < Num; i++)
            {
                if(i==Num-1) System.out.println(List[Num-1]);
                else System.out.print(List[i] + " ");
            }
        }
        System.out.println(Count);

    }

    public static void SelectionSort()
    {
        for(int i=0;i<Num;i++)
        {
            min_j=i;
            for(int j=i;j<Num;j++)
            {
                if(List[j]<List[min_j])
                {
                    min_j=j;
                }
            }
            if(min_j!=i){
                tmp=List[i];
                List[i]=List[min_j];
                List[min_j]=tmp;
                Count++;
            }
        }
    }
} import java.util.Scanner; Scanner java.util public class Main {

    public static int Num;
    public static int[] List;
    public static int Count=0;
    public static int min_j;
    public static int tmp;

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

        Num=scan.nextInt();

        List=new int[Num];

        for(int i=0;i<Num;i++)
        {
            List[i]=scan.nextInt();
        }

        SelectionSort();

        if(Num==1) System.out.println(List[0]);
        else
        {
            for (int i = 0; i < Num; i++)
            {
                if(i==Num-1) System.out.println(List[Num-1]);
                else System.out.print(List[i] + " ");
            }
        }
        System.out.println(Count);

    }

    public static void SelectionSort()
    {
        for(int i=0;i<Num;i++)
        {
            min_j=i;
            for(int j=i;j<Num;j++)
            {
                if(List[j]<List[min_j])
                {
                    min_j=j;
                }
            }
            if(min_j!=i){
                tmp=List[i];
                List[i]=List[min_j];
                List[min_j]=tmp;
                Count++;
            }
        }
    }
} Main public static int Num; Num public static int[] List; List public static int Count=0; Count 0 public static int min_j; min_j public static int tmp; tmp public static void main(String[] args)
    {
        Scanner scan=new Scanner(System.in);

        Num=scan.nextInt();

        List=new int[Num];

        for(int i=0;i<Num;i++)
        {
            List[i]=scan.nextInt();
        }

        SelectionSort();

        if(Num==1) System.out.println(List[0]);
        else
        {
            for (int i = 0; i < Num; i++)
            {
                if(i==Num-1) System.out.println(List[Num-1]);
                else System.out.print(List[i] + " ");
            }
        }
        System.out.println(Count);

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

        Num=scan.nextInt();

        List=new int[Num];

        for(int i=0;i<Num;i++)
        {
            List[i]=scan.nextInt();
        }

        SelectionSort();

        if(Num==1) System.out.println(List[0]);
        else
        {
            for (int i = 0; i < Num; i++)
            {
                if(i==Num-1) System.out.println(List[Num-1]);
                else System.out.print(List[i] + " ");
            }
        }
        System.out.println(Count);

    } Scanner scan=new Scanner(System.in); scan new Scanner(System.in) Num=scan.nextInt() Num scan.nextInt() scan.nextInt scan List=new int[Num] List new int[Num] Num for(int i=0;i<Num;i++)
        {
            List[i]=scan.nextInt();
        } int i=0; int i=0; i 0 i<Num i Num i++ i++ i {
            List[i]=scan.nextInt();
        } {
            List[i]=scan.nextInt();
        } List[i]=scan.nextInt() List[i] List i scan.nextInt() scan.nextInt scan SelectionSort() SelectionSort if(Num==1) System.out.println(List[0]);
        else
        {
            for (int i = 0; i < Num; i++)
            {
                if(i==Num-1) System.out.println(List[Num-1]);
                else System.out.print(List[i] + " ");
            }
        } Num==1 Num 1 System.out.println(List[0]) System.out.println System.out System System.out List[0] List 0 {
            for (int i = 0; i < Num; i++)
            {
                if(i==Num-1) System.out.println(List[Num-1]);
                else System.out.print(List[i] + " ");
            }
        } for (int i = 0; i < Num; i++)
            {
                if(i==Num-1) System.out.println(List[Num-1]);
                else System.out.print(List[i] + " ");
            } int i = 0; int i = 0; i 0 i < Num i Num i++ i++ i {
                if(i==Num-1) System.out.println(List[Num-1]);
                else System.out.print(List[i] + " ");
            } {
                if(i==Num-1) System.out.println(List[Num-1]);
                else System.out.print(List[i] + " ");
            } if(i==Num-1) System.out.println(List[Num-1]);
                else System.out.print(List[i] + " "); i==Num-1 i Num-1 Num 1 System.out.println(List[Num-1]) System.out.println System.out System System.out List[Num-1] List Num-1 Num 1 System.out.print(List[i] + " ") System.out.print System.out System System.out List[i] + " " List[i] List i " " System.out.println(Count) System.out.println System.out System System.out Count String[] args args public static void SelectionSort()
    {
        for(int i=0;i<Num;i++)
        {
            min_j=i;
            for(int j=i;j<Num;j++)
            {
                if(List[j]<List[min_j])
                {
                    min_j=j;
                }
            }
            if(min_j!=i){
                tmp=List[i];
                List[i]=List[min_j];
                List[min_j]=tmp;
                Count++;
            }
        }
    } SelectionSort {
        for(int i=0;i<Num;i++)
        {
            min_j=i;
            for(int j=i;j<Num;j++)
            {
                if(List[j]<List[min_j])
                {
                    min_j=j;
                }
            }
            if(min_j!=i){
                tmp=List[i];
                List[i]=List[min_j];
                List[min_j]=tmp;
                Count++;
            }
        }
    } for(int i=0;i<Num;i++)
        {
            min_j=i;
            for(int j=i;j<Num;j++)
            {
                if(List[j]<List[min_j])
                {
                    min_j=j;
                }
            }
            if(min_j!=i){
                tmp=List[i];
                List[i]=List[min_j];
                List[min_j]=tmp;
                Count++;
            }
        } int i=0; int i=0; i 0 i<Num i Num i++ i++ i {
            min_j=i;
            for(int j=i;j<Num;j++)
            {
                if(List[j]<List[min_j])
                {
                    min_j=j;
                }
            }
            if(min_j!=i){
                tmp=List[i];
                List[i]=List[min_j];
                List[min_j]=tmp;
                Count++;
            }
        } {
            min_j=i;
            for(int j=i;j<Num;j++)
            {
                if(List[j]<List[min_j])
                {
                    min_j=j;
                }
            }
            if(min_j!=i){
                tmp=List[i];
                List[i]=List[min_j];
                List[min_j]=tmp;
                Count++;
            }
        } min_j=i min_j i for(int j=i;j<Num;j++)
            {
                if(List[j]<List[min_j])
                {
                    min_j=j;
                }
            } int j=i; int j=i; j i j<Num j Num j++ j++ j {
                if(List[j]<List[min_j])
                {
                    min_j=j;
                }
            } {
                if(List[j]<List[min_j])
                {
                    min_j=j;
                }
            } if(List[j]<List[min_j])
                {
                    min_j=j;
                } List[j]<List[min_j] List[j] List j List[min_j] List min_j {
                    min_j=j;
                } min_j=j min_j j if(min_j!=i){
                tmp=List[i];
                List[i]=List[min_j];
                List[min_j]=tmp;
                Count++;
            } min_j!=i min_j i {
                tmp=List[i];
                List[i]=List[min_j];
                List[min_j]=tmp;
                Count++;
            } tmp=List[i] tmp List[i] List i List[i]=List[min_j] List[i] List i List[min_j] List min_j List[min_j]=tmp List[min_j] List min_j tmp Count++ Count public class Main {

    public static int Num;
    public static int[] List;
    public static int Count=0;
    public static int min_j;
    public static int tmp;

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

        Num=scan.nextInt();

        List=new int[Num];

        for(int i=0;i<Num;i++)
        {
            List[i]=scan.nextInt();
        }

        SelectionSort();

        if(Num==1) System.out.println(List[0]);
        else
        {
            for (int i = 0; i < Num; i++)
            {
                if(i==Num-1) System.out.println(List[Num-1]);
                else System.out.print(List[i] + " ");
            }
        }
        System.out.println(Count);

    }

    public static void SelectionSort()
    {
        for(int i=0;i<Num;i++)
        {
            min_j=i;
            for(int j=i;j<Num;j++)
            {
                if(List[j]<List[min_j])
                {
                    min_j=j;
                }
            }
            if(min_j!=i){
                tmp=List[i];
                List[i]=List[min_j];
                List[min_j]=tmp;
                Count++;
            }
        }
    }
} public class Main {

    public static int Num;
    public static int[] List;
    public static int Count=0;
    public static int min_j;
    public static int tmp;

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

        Num=scan.nextInt();

        List=new int[Num];

        for(int i=0;i<Num;i++)
        {
            List[i]=scan.nextInt();
        }

        SelectionSort();

        if(Num==1) System.out.println(List[0]);
        else
        {
            for (int i = 0; i < Num; i++)
            {
                if(i==Num-1) System.out.println(List[Num-1]);
                else System.out.print(List[i] + " ");
            }
        }
        System.out.println(Count);

    }

    public static void SelectionSort()
    {
        for(int i=0;i<Num;i++)
        {
            min_j=i;
            for(int j=i;j<Num;j++)
            {
                if(List[j]<List[min_j])
                {
                    min_j=j;
                }
            }
            if(min_j!=i){
                tmp=List[i];
                List[i]=List[min_j];
                List[min_j]=tmp;
                Count++;
            }
        }
    }
} Main
import java.util.Scanner;

public class Main {

    public static int Num;
    public static int[] List;
    public static int Count=0;
    public static int min_j;
    public static int tmp;

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

        Num=scan.nextInt();

        List=new int[Num];

        for(int i=0;i<Num;i++)
        {
            List[i]=scan.nextInt();
        }

        SelectionSort();

        if(Num==1) System.out.println(List[0]);
        else
        {
            for (int i = 0; i < Num; i++)
            {
                if(i==Num-1) System.out.println(List[Num-1]);
                else System.out.print(List[i] + " ");
            }
        }
        System.out.println(Count);

    }

    public static void SelectionSort()
    {
        for(int i=0;i<Num;i++)
        {
            min_j=i;
            for(int j=i;j<Num;j++)
            {
                if(List[j]<List[min_j])
                {
                    min_j=j;
                }
            }
            if(min_j!=i){
                tmp=List[i];
                List[i]=List[min_j];
                List[min_j]=tmp;
                Count++;
            }
        }
    }
}