import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		while(scan.hasNext()){
			int n = scan.nextInt();
			int[] sSort = new int[n];
			for(int i = 0;i < n;i++){
				sSort[i] = scan.nextInt();
			}
			int count = 0;
			for(int i = 0;i < n;i++){
				int min = i;
				for(int j = i+1;j < n;j++){
					if(sSort[min] > sSort[j]){
						min = j;
					}
				}
				if(min != i){
					swap(sSort,i,min);
					count++;
				}
			}
			PrintOut(sSort,n);
			System.out.println(count);
		}
	}
	
	public static void swap(int[] a,int i,int j){
		int t = a[j];a[j] = a[i];a[i] = t;
	}
	
	public static void PrintOut(int[] a,int n){
		for(int i = 0;i < n;i++){
			System.out.print(a[i] + ((i == n-1)?"\n":" "));
		}
	}
} import java.util.Scanner; Scanner java.util public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		while(scan.hasNext()){
			int n = scan.nextInt();
			int[] sSort = new int[n];
			for(int i = 0;i < n;i++){
				sSort[i] = scan.nextInt();
			}
			int count = 0;
			for(int i = 0;i < n;i++){
				int min = i;
				for(int j = i+1;j < n;j++){
					if(sSort[min] > sSort[j]){
						min = j;
					}
				}
				if(min != i){
					swap(sSort,i,min);
					count++;
				}
			}
			PrintOut(sSort,n);
			System.out.println(count);
		}
	}
	
	public static void swap(int[] a,int i,int j){
		int t = a[j];a[j] = a[i];a[i] = t;
	}
	
	public static void PrintOut(int[] a,int n){
		for(int i = 0;i < n;i++){
			System.out.print(a[i] + ((i == n-1)?"\n":" "));
		}
	}
} Main public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		while(scan.hasNext()){
			int n = scan.nextInt();
			int[] sSort = new int[n];
			for(int i = 0;i < n;i++){
				sSort[i] = scan.nextInt();
			}
			int count = 0;
			for(int i = 0;i < n;i++){
				int min = i;
				for(int j = i+1;j < n;j++){
					if(sSort[min] > sSort[j]){
						min = j;
					}
				}
				if(min != i){
					swap(sSort,i,min);
					count++;
				}
			}
			PrintOut(sSort,n);
			System.out.println(count);
		}
	} main {
		Scanner scan = new Scanner(System.in);
		while(scan.hasNext()){
			int n = scan.nextInt();
			int[] sSort = new int[n];
			for(int i = 0;i < n;i++){
				sSort[i] = scan.nextInt();
			}
			int count = 0;
			for(int i = 0;i < n;i++){
				int min = i;
				for(int j = i+1;j < n;j++){
					if(sSort[min] > sSort[j]){
						min = j;
					}
				}
				if(min != i){
					swap(sSort,i,min);
					count++;
				}
			}
			PrintOut(sSort,n);
			System.out.println(count);
		}
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) while(scan.hasNext()){
			int n = scan.nextInt();
			int[] sSort = new int[n];
			for(int i = 0;i < n;i++){
				sSort[i] = scan.nextInt();
			}
			int count = 0;
			for(int i = 0;i < n;i++){
				int min = i;
				for(int j = i+1;j < n;j++){
					if(sSort[min] > sSort[j]){
						min = j;
					}
				}
				if(min != i){
					swap(sSort,i,min);
					count++;
				}
			}
			PrintOut(sSort,n);
			System.out.println(count);
		} scan.hasNext() scan.hasNext scan {
			int n = scan.nextInt();
			int[] sSort = new int[n];
			for(int i = 0;i < n;i++){
				sSort[i] = scan.nextInt();
			}
			int count = 0;
			for(int i = 0;i < n;i++){
				int min = i;
				for(int j = i+1;j < n;j++){
					if(sSort[min] > sSort[j]){
						min = j;
					}
				}
				if(min != i){
					swap(sSort,i,min);
					count++;
				}
			}
			PrintOut(sSort,n);
			System.out.println(count);
		} int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int[] sSort = new int[n]; sSort new int[n] n for(int i = 0;i < n;i++){
				sSort[i] = scan.nextInt();
			} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
				sSort[i] = scan.nextInt();
			} {
				sSort[i] = scan.nextInt();
			} sSort[i] = scan.nextInt() sSort[i] sSort i scan.nextInt() scan.nextInt scan int count = 0; count 0 for(int i = 0;i < n;i++){
				int min = i;
				for(int j = i+1;j < n;j++){
					if(sSort[min] > sSort[j]){
						min = j;
					}
				}
				if(min != i){
					swap(sSort,i,min);
					count++;
				}
			} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
				int min = i;
				for(int j = i+1;j < n;j++){
					if(sSort[min] > sSort[j]){
						min = j;
					}
				}
				if(min != i){
					swap(sSort,i,min);
					count++;
				}
			} {
				int min = i;
				for(int j = i+1;j < n;j++){
					if(sSort[min] > sSort[j]){
						min = j;
					}
				}
				if(min != i){
					swap(sSort,i,min);
					count++;
				}
			} int min = i; min i for(int j = i+1;j < n;j++){
					if(sSort[min] > sSort[j]){
						min = j;
					}
				} int j = i+1; int j = i+1; j i+1 i 1 j < n j n j++ j++ j {
					if(sSort[min] > sSort[j]){
						min = j;
					}
				} {
					if(sSort[min] > sSort[j]){
						min = j;
					}
				} if(sSort[min] > sSort[j]){
						min = j;
					} sSort[min] > sSort[j] sSort[min] sSort min sSort[j] sSort j {
						min = j;
					} min = j min j if(min != i){
					swap(sSort,i,min);
					count++;
				} min != i min i {
					swap(sSort,i,min);
					count++;
				} swap(sSort,i,min) swap sSort i min count++ count PrintOut(sSort,n) PrintOut sSort n System.out.println(count) System.out.println System.out System System.out count String[] args args public static void swap(int[] a,int i,int j){
		int t = a[j];a[j] = a[i];a[i] = t;
	} swap {
		int t = a[j];a[j] = a[i];a[i] = t;
	} int t = a[j]; t a[j] a j a[j] = a[i] a[j] a j a[i] a i a[i] = t a[i] a i t int[] a a int i i int j j public static void PrintOut(int[] a,int n){
		for(int i = 0;i < n;i++){
			System.out.print(a[i] + ((i == n-1)?"\n":" "));
		}
	} PrintOut {
		for(int i = 0;i < n;i++){
			System.out.print(a[i] + ((i == n-1)?"\n":" "));
		}
	} for(int i = 0;i < n;i++){
			System.out.print(a[i] + ((i == n-1)?"\n":" "));
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			System.out.print(a[i] + ((i == n-1)?"\n":" "));
		} {
			System.out.print(a[i] + ((i == n-1)?"\n":" "));
		} System.out.print(a[i] + ((i == n-1)?"\n":" ")) System.out.print System.out System System.out a[i] + ((i == n-1)?"\n":" ") a[i] a i ((i == n-1)?"\n":" ") (i == n-1) i n-1 n 1 "\n" " " int[] a a int n n public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		while(scan.hasNext()){
			int n = scan.nextInt();
			int[] sSort = new int[n];
			for(int i = 0;i < n;i++){
				sSort[i] = scan.nextInt();
			}
			int count = 0;
			for(int i = 0;i < n;i++){
				int min = i;
				for(int j = i+1;j < n;j++){
					if(sSort[min] > sSort[j]){
						min = j;
					}
				}
				if(min != i){
					swap(sSort,i,min);
					count++;
				}
			}
			PrintOut(sSort,n);
			System.out.println(count);
		}
	}
	
	public static void swap(int[] a,int i,int j){
		int t = a[j];a[j] = a[i];a[i] = t;
	}
	
	public static void PrintOut(int[] a,int n){
		for(int i = 0;i < n;i++){
			System.out.print(a[i] + ((i == n-1)?"\n":" "));
		}
	}
} public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		while(scan.hasNext()){
			int n = scan.nextInt();
			int[] sSort = new int[n];
			for(int i = 0;i < n;i++){
				sSort[i] = scan.nextInt();
			}
			int count = 0;
			for(int i = 0;i < n;i++){
				int min = i;
				for(int j = i+1;j < n;j++){
					if(sSort[min] > sSort[j]){
						min = j;
					}
				}
				if(min != i){
					swap(sSort,i,min);
					count++;
				}
			}
			PrintOut(sSort,n);
			System.out.println(count);
		}
	}
	
	public static void swap(int[] a,int i,int j){
		int t = a[j];a[j] = a[i];a[i] = t;
	}
	
	public static void PrintOut(int[] a,int n){
		for(int i = 0;i < n;i++){
			System.out.print(a[i] + ((i == n-1)?"\n":" "));
		}
	}
} Main
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		while(scan.hasNext()){
			int n = scan.nextInt();
			int[] sSort = new int[n];
			for(int i = 0;i < n;i++){
				sSort[i] = scan.nextInt();
			}
			int count = 0;
			for(int i = 0;i < n;i++){
				int min = i;
				for(int j = i+1;j < n;j++){
					if(sSort[min] > sSort[j]){
						min = j;
					}
				}
				if(min != i){
					swap(sSort,i,min);
					count++;
				}
			}
			PrintOut(sSort,n);
			System.out.println(count);
		}
	}
	
	public static void swap(int[] a,int i,int j){
		int t = a[j];a[j] = a[i];a[i] = t;
	}
	
	public static void PrintOut(int[] a,int n){
		for(int i = 0;i < n;i++){
			System.out.print(a[i] + ((i == n-1)?"\n":" "));
		}
	}
}