import java.util.Scanner;

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

	int n = In.nextInt();

	int []a = new int[n];

	for(int i = 0; i < n; i++)
	     a[i] = In.nextInt();


	int count = 0;

	for(int i = 0; i < n - 1; i++)
	    {
		int minj = i;

		for(int j = i; j < n; j++)
		    {
			if(a[j] < a[minj])
			    {
				minj = j;
			
			    }
			
		    }	
		if(minj != i)
		    {
			int tmp = a[i];
			a[i] = a[minj];
			a[minj] = tmp;	
			count++;
		    }
	    }

	for(int i = 0; i < n - 1; i++)
	    System.out.print(a[i] + " ");

	System.out.println(a[n - 1]);
	System.out.println(count);
    

    }
} import java.util.Scanner; Scanner java.util public class Main
{
    public static void main(String[] args)
    {
	Scanner In = new Scanner(System.in);

	int n = In.nextInt();

	int []a = new int[n];

	for(int i = 0; i < n; i++)
	     a[i] = In.nextInt();


	int count = 0;

	for(int i = 0; i < n - 1; i++)
	    {
		int minj = i;

		for(int j = i; j < n; j++)
		    {
			if(a[j] < a[minj])
			    {
				minj = j;
			
			    }
			
		    }	
		if(minj != i)
		    {
			int tmp = a[i];
			a[i] = a[minj];
			a[minj] = tmp;	
			count++;
		    }
	    }

	for(int i = 0; i < n - 1; i++)
	    System.out.print(a[i] + " ");

	System.out.println(a[n - 1]);
	System.out.println(count);
    

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

	int n = In.nextInt();

	int []a = new int[n];

	for(int i = 0; i < n; i++)
	     a[i] = In.nextInt();


	int count = 0;

	for(int i = 0; i < n - 1; i++)
	    {
		int minj = i;

		for(int j = i; j < n; j++)
		    {
			if(a[j] < a[minj])
			    {
				minj = j;
			
			    }
			
		    }	
		if(minj != i)
		    {
			int tmp = a[i];
			a[i] = a[minj];
			a[minj] = tmp;	
			count++;
		    }
	    }

	for(int i = 0; i < n - 1; i++)
	    System.out.print(a[i] + " ");

	System.out.println(a[n - 1]);
	System.out.println(count);
    

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

	int n = In.nextInt();

	int []a = new int[n];

	for(int i = 0; i < n; i++)
	     a[i] = In.nextInt();


	int count = 0;

	for(int i = 0; i < n - 1; i++)
	    {
		int minj = i;

		for(int j = i; j < n; j++)
		    {
			if(a[j] < a[minj])
			    {
				minj = j;
			
			    }
			
		    }	
		if(minj != i)
		    {
			int tmp = a[i];
			a[i] = a[minj];
			a[minj] = tmp;	
			count++;
		    }
	    }

	for(int i = 0; i < n - 1; i++)
	    System.out.print(a[i] + " ");

	System.out.println(a[n - 1]);
	System.out.println(count);
    

    } Scanner In = new Scanner(System.in); In new Scanner(System.in) int n = In.nextInt(); n In.nextInt() In.nextInt In int []a = new int[n]; a new int[n] n for(int i = 0; i < n; i++)
	     a[i] = In.nextInt(); int i = 0; int i = 0; i 0 i < n i n i++ i++ i a[i] = In.nextInt(); a[i] = In.nextInt() a[i] a i In.nextInt() In.nextInt In int count = 0; count 0 for(int i = 0; i < n - 1; i++)
	    {
		int minj = i;

		for(int j = i; j < n; j++)
		    {
			if(a[j] < a[minj])
			    {
				minj = j;
			
			    }
			
		    }	
		if(minj != i)
		    {
			int tmp = a[i];
			a[i] = a[minj];
			a[minj] = tmp;	
			count++;
		    }
	    } int i = 0; int i = 0; i 0 i < n - 1 i n - 1 n 1 i++ i++ i {
		int minj = i;

		for(int j = i; j < n; j++)
		    {
			if(a[j] < a[minj])
			    {
				minj = j;
			
			    }
			
		    }	
		if(minj != i)
		    {
			int tmp = a[i];
			a[i] = a[minj];
			a[minj] = tmp;	
			count++;
		    }
	    } {
		int minj = i;

		for(int j = i; j < n; j++)
		    {
			if(a[j] < a[minj])
			    {
				minj = j;
			
			    }
			
		    }	
		if(minj != i)
		    {
			int tmp = a[i];
			a[i] = a[minj];
			a[minj] = tmp;	
			count++;
		    }
	    } int minj = i; minj i for(int j = i; j < n; j++)
		    {
			if(a[j] < a[minj])
			    {
				minj = j;
			
			    }
			
		    } int j = i; int j = i; j i j < n j n j++ j++ j {
			if(a[j] < a[minj])
			    {
				minj = j;
			
			    }
			
		    } {
			if(a[j] < a[minj])
			    {
				minj = j;
			
			    }
			
		    } if(a[j] < a[minj])
			    {
				minj = j;
			
			    } a[j] < a[minj] a[j] a j a[minj] a minj {
				minj = j;
			
			    } minj = j minj j if(minj != i)
		    {
			int tmp = a[i];
			a[i] = a[minj];
			a[minj] = tmp;	
			count++;
		    } minj != i minj i {
			int tmp = a[i];
			a[i] = a[minj];
			a[minj] = tmp;	
			count++;
		    } int tmp = a[i]; tmp a[i] a i a[i] = a[minj] a[i] a i a[minj] a minj a[minj] = tmp a[minj] a minj tmp count++ count for(int i = 0; i < n - 1; i++)
	    System.out.print(a[i] + " "); int i = 0; int i = 0; i 0 i < n - 1 i n - 1 n 1 i++ i++ 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.println(a[n - 1]) System.out.println System.out System System.out a[n - 1] a n - 1 n 1 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 In = new Scanner(System.in);

	int n = In.nextInt();

	int []a = new int[n];

	for(int i = 0; i < n; i++)
	     a[i] = In.nextInt();


	int count = 0;

	for(int i = 0; i < n - 1; i++)
	    {
		int minj = i;

		for(int j = i; j < n; j++)
		    {
			if(a[j] < a[minj])
			    {
				minj = j;
			
			    }
			
		    }	
		if(minj != i)
		    {
			int tmp = a[i];
			a[i] = a[minj];
			a[minj] = tmp;	
			count++;
		    }
	    }

	for(int i = 0; i < n - 1; i++)
	    System.out.print(a[i] + " ");

	System.out.println(a[n - 1]);
	System.out.println(count);
    

    }
} public class Main
{
    public static void main(String[] args)
    {
	Scanner In = new Scanner(System.in);

	int n = In.nextInt();

	int []a = new int[n];

	for(int i = 0; i < n; i++)
	     a[i] = In.nextInt();


	int count = 0;

	for(int i = 0; i < n - 1; i++)
	    {
		int minj = i;

		for(int j = i; j < n; j++)
		    {
			if(a[j] < a[minj])
			    {
				minj = j;
			
			    }
			
		    }	
		if(minj != i)
		    {
			int tmp = a[i];
			a[i] = a[minj];
			a[minj] = tmp;	
			count++;
		    }
	    }

	for(int i = 0; i < n - 1; i++)
	    System.out.print(a[i] + " ");

	System.out.println(a[n - 1]);
	System.out.println(count);
    

    }
} Main
import java.util.Scanner;

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

	int n = In.nextInt();

	int []a = new int[n];

	for(int i = 0; i < n; i++)
	     a[i] = In.nextInt();


	int count = 0;

	for(int i = 0; i < n - 1; i++)
	    {
		int minj = i;

		for(int j = i; j < n; j++)
		    {
			if(a[j] < a[minj])
			    {
				minj = j;
			
			    }
			
		    }	
		if(minj != i)
		    {
			int tmp = a[i];
			a[i] = a[minj];
			a[minj] = tmp;	
			count++;
		    }
	    }

	for(int i = 0; i < n - 1; i++)
	    System.out.print(a[i] + " ");

	System.out.println(a[n - 1]);
	System.out.println(count);
    

    }
}