import java.util.Scanner;
class Main
{
	static void sort( int A[] )
	{
		int counter = 0;
		for( int i = 0 ; i < A.length ; i++ )
		{
			int min = i;
			for( int j = i ; j < A.length ; j++ )
				if( A[j] < A[min] )min = j;
			if( min!=i )
			{
				int work = A[i];
				A[i] = A[min];
				A[min] = work;
				counter++;
			}
		}
		for( int i = 0 ; i < A.length ; i++ )
			if( i==A.length-1 )
				System.out.printf( "%d\n%d\n", A[i], counter );
			else
				System.out.print( A[i]+" " );
	}
	public static void main( String[] args )
	{
		Scanner sc = new java.util.Scanner( System.in );
		
		int n = sc.nextInt();
		int A[] = new int[n];
		for( int i = 0 ; i < n ; i++ )A[i]=sc.nextInt();
		
		sort( A );
	}
} import java.util.Scanner; Scanner java.util class Main
{
	static void sort( int A[] )
	{
		int counter = 0;
		for( int i = 0 ; i < A.length ; i++ )
		{
			int min = i;
			for( int j = i ; j < A.length ; j++ )
				if( A[j] < A[min] )min = j;
			if( min!=i )
			{
				int work = A[i];
				A[i] = A[min];
				A[min] = work;
				counter++;
			}
		}
		for( int i = 0 ; i < A.length ; i++ )
			if( i==A.length-1 )
				System.out.printf( "%d\n%d\n", A[i], counter );
			else
				System.out.print( A[i]+" " );
	}
	public static void main( String[] args )
	{
		Scanner sc = new java.util.Scanner( System.in );
		
		int n = sc.nextInt();
		int A[] = new int[n];
		for( int i = 0 ; i < n ; i++ )A[i]=sc.nextInt();
		
		sort( A );
	}
} Main static void sort( int A[] )
	{
		int counter = 0;
		for( int i = 0 ; i < A.length ; i++ )
		{
			int min = i;
			for( int j = i ; j < A.length ; j++ )
				if( A[j] < A[min] )min = j;
			if( min!=i )
			{
				int work = A[i];
				A[i] = A[min];
				A[min] = work;
				counter++;
			}
		}
		for( int i = 0 ; i < A.length ; i++ )
			if( i==A.length-1 )
				System.out.printf( "%d\n%d\n", A[i], counter );
			else
				System.out.print( A[i]+" " );
	} sort {
		int counter = 0;
		for( int i = 0 ; i < A.length ; i++ )
		{
			int min = i;
			for( int j = i ; j < A.length ; j++ )
				if( A[j] < A[min] )min = j;
			if( min!=i )
			{
				int work = A[i];
				A[i] = A[min];
				A[min] = work;
				counter++;
			}
		}
		for( int i = 0 ; i < A.length ; i++ )
			if( i==A.length-1 )
				System.out.printf( "%d\n%d\n", A[i], counter );
			else
				System.out.print( A[i]+" " );
	} int counter = 0; counter 0 for( int i = 0 ; i < A.length ; i++ )
		{
			int min = i;
			for( int j = i ; j < A.length ; j++ )
				if( A[j] < A[min] )min = j;
			if( min!=i )
			{
				int work = A[i];
				A[i] = A[min];
				A[min] = work;
				counter++;
			}
		} int i = 0 ; int i = 0 ; i 0 i < A.length i A.length A A.length i++ i++ i {
			int min = i;
			for( int j = i ; j < A.length ; j++ )
				if( A[j] < A[min] )min = j;
			if( min!=i )
			{
				int work = A[i];
				A[i] = A[min];
				A[min] = work;
				counter++;
			}
		} {
			int min = i;
			for( int j = i ; j < A.length ; j++ )
				if( A[j] < A[min] )min = j;
			if( min!=i )
			{
				int work = A[i];
				A[i] = A[min];
				A[min] = work;
				counter++;
			}
		} int min = i; min i for( int j = i ; j < A.length ; j++ )
				if( A[j] < A[min] )min = j; int j = i ; int j = i ; j i j < A.length j A.length A A.length j++ j++ j if( A[j] < A[min] )min = j; if( A[j] < A[min] )min = j; A[j] < A[min] A[j] A j A[min] A min min = j min j if( min!=i )
			{
				int work = A[i];
				A[i] = A[min];
				A[min] = work;
				counter++;
			} min!=i min i {
				int work = A[i];
				A[i] = A[min];
				A[min] = work;
				counter++;
			} int work = A[i]; work A[i] A i A[i] = A[min] A[i] A i A[min] A min A[min] = work A[min] A min work counter++ counter for( int i = 0 ; i < A.length ; i++ )
			if( i==A.length-1 )
				System.out.printf( "%d\n%d\n", A[i], counter );
			else
				System.out.print( A[i]+" " ); int i = 0 ; int i = 0 ; i 0 i < A.length i A.length A A.length i++ i++ i if( i==A.length-1 )
				System.out.printf( "%d\n%d\n", A[i], counter );
			else
				System.out.print( A[i]+" " ); if( i==A.length-1 )
				System.out.printf( "%d\n%d\n", A[i], counter );
			else
				System.out.print( A[i]+" " ); i==A.length-1 i A.length-1 A.length A A.length 1 System.out.printf( "%d\n%d\n", A[i], counter ) System.out.printf System.out System System.out "%d\n%d\n" A[i] A i counter System.out.print( A[i]+" " ) System.out.print System.out System System.out A[i]+" " A[i] A i " " int A[] A public static void main( String[] args )
	{
		Scanner sc = new java.util.Scanner( System.in );
		
		int n = sc.nextInt();
		int A[] = new int[n];
		for( int i = 0 ; i < n ; i++ )A[i]=sc.nextInt();
		
		sort( A );
	} main {
		Scanner sc = new java.util.Scanner( System.in );
		
		int n = sc.nextInt();
		int A[] = new int[n];
		for( int i = 0 ; i < n ; i++ )A[i]=sc.nextInt();
		
		sort( A );
	} Scanner sc = new java.util.Scanner( System.in ); sc new java.util.Scanner( System.in ) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int A[] = new int[n]; A new int[n] n for( int i = 0 ; i < n ; i++ )A[i]=sc.nextInt(); int i = 0 ; int i = 0 ; i 0 i < n i n i++ i++ i A[i]=sc.nextInt(); A[i]=sc.nextInt() A[i] A i sc.nextInt() sc.nextInt sc sort( A ) sort A String[] args args
import java.util.Scanner;
class Main
{
	static void sort( int A[] )
	{
		int counter = 0;
		for( int i = 0 ; i < A.length ; i++ )
		{
			int min = i;
			for( int j = i ; j < A.length ; j++ )
				if( A[j] < A[min] )min = j;
			if( min!=i )
			{
				int work = A[i];
				A[i] = A[min];
				A[min] = work;
				counter++;
			}
		}
		for( int i = 0 ; i < A.length ; i++ )
			if( i==A.length-1 )
				System.out.printf( "%d\n%d\n", A[i], counter );
			else
				System.out.print( A[i]+" " );
	}
	public static void main( String[] args )
	{
		Scanner sc = new java.util.Scanner( System.in );
		
		int n = sc.nextInt();
		int A[] = new int[n];
		for( int i = 0 ; i < n ; i++ )A[i]=sc.nextInt();
		
		sort( A );
	}
}