import java.util.*;
public class Main {
	static int count = 0;
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int n =sc.nextInt();
		int[] nums  =new int[n];
		for(int i=0;i<n;i++){
			nums[i] = sc.nextInt();
		}
		selectionSort(nums);
		for(int i=0;i<nums.length;i++){
			if(i>0)System.out.print(" ");
			System.out.print(nums[i]);
		}
		System.out.println();
		System.out.println(count);
	}
	public static void selectionSort(int[] nums){
		for(int i=0;i<nums.length;i++){
			int min = i;
			for(int j=i;j<nums.length;j++){
				if(nums[j]<nums[min]){
					min  = j;
				}
			}
			if(min!=i){
				count++;
				swap(nums,min,i);
			}
		}
	}
	public static void swap(int[] A,int i ,int j){
		int t = A[j];
		A[j] = A[i];
		A[i] = t;
	}
} import java.util.*; util.* java public class Main {
	static int count = 0;
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int n =sc.nextInt();
		int[] nums  =new int[n];
		for(int i=0;i<n;i++){
			nums[i] = sc.nextInt();
		}
		selectionSort(nums);
		for(int i=0;i<nums.length;i++){
			if(i>0)System.out.print(" ");
			System.out.print(nums[i]);
		}
		System.out.println();
		System.out.println(count);
	}
	public static void selectionSort(int[] nums){
		for(int i=0;i<nums.length;i++){
			int min = i;
			for(int j=i;j<nums.length;j++){
				if(nums[j]<nums[min]){
					min  = j;
				}
			}
			if(min!=i){
				count++;
				swap(nums,min,i);
			}
		}
	}
	public static void swap(int[] A,int i ,int j){
		int t = A[j];
		A[j] = A[i];
		A[i] = t;
	}
} Main static int count = 0; count 0 public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int n =sc.nextInt();
		int[] nums  =new int[n];
		for(int i=0;i<n;i++){
			nums[i] = sc.nextInt();
		}
		selectionSort(nums);
		for(int i=0;i<nums.length;i++){
			if(i>0)System.out.print(" ");
			System.out.print(nums[i]);
		}
		System.out.println();
		System.out.println(count);
	} main {
		Scanner sc = new Scanner(System.in);
		int n =sc.nextInt();
		int[] nums  =new int[n];
		for(int i=0;i<n;i++){
			nums[i] = sc.nextInt();
		}
		selectionSort(nums);
		for(int i=0;i<nums.length;i++){
			if(i>0)System.out.print(" ");
			System.out.print(nums[i]);
		}
		System.out.println();
		System.out.println(count);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n =sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] nums  =new int[n]; nums new int[n] n for(int i=0;i<n;i++){
			nums[i] = sc.nextInt();
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			nums[i] = sc.nextInt();
		} {
			nums[i] = sc.nextInt();
		} nums[i] = sc.nextInt() nums[i] nums i sc.nextInt() sc.nextInt sc selectionSort(nums) selectionSort nums for(int i=0;i<nums.length;i++){
			if(i>0)System.out.print(" ");
			System.out.print(nums[i]);
		} int i=0; int i=0; i 0 i<nums.length i nums.length nums nums.length i++ i++ i {
			if(i>0)System.out.print(" ");
			System.out.print(nums[i]);
		} {
			if(i>0)System.out.print(" ");
			System.out.print(nums[i]);
		} if(i>0)System.out.print(" "); i>0 i 0 System.out.print(" ") System.out.print System.out System System.out " " System.out.print(nums[i]) System.out.print System.out System System.out nums[i] nums i System.out.println() System.out.println System.out System System.out System.out.println(count) System.out.println System.out System System.out count String args[] args public static void selectionSort(int[] nums){
		for(int i=0;i<nums.length;i++){
			int min = i;
			for(int j=i;j<nums.length;j++){
				if(nums[j]<nums[min]){
					min  = j;
				}
			}
			if(min!=i){
				count++;
				swap(nums,min,i);
			}
		}
	} selectionSort {
		for(int i=0;i<nums.length;i++){
			int min = i;
			for(int j=i;j<nums.length;j++){
				if(nums[j]<nums[min]){
					min  = j;
				}
			}
			if(min!=i){
				count++;
				swap(nums,min,i);
			}
		}
	} for(int i=0;i<nums.length;i++){
			int min = i;
			for(int j=i;j<nums.length;j++){
				if(nums[j]<nums[min]){
					min  = j;
				}
			}
			if(min!=i){
				count++;
				swap(nums,min,i);
			}
		} int i=0; int i=0; i 0 i<nums.length i nums.length nums nums.length i++ i++ i {
			int min = i;
			for(int j=i;j<nums.length;j++){
				if(nums[j]<nums[min]){
					min  = j;
				}
			}
			if(min!=i){
				count++;
				swap(nums,min,i);
			}
		} {
			int min = i;
			for(int j=i;j<nums.length;j++){
				if(nums[j]<nums[min]){
					min  = j;
				}
			}
			if(min!=i){
				count++;
				swap(nums,min,i);
			}
		} int min = i; min i for(int j=i;j<nums.length;j++){
				if(nums[j]<nums[min]){
					min  = j;
				}
			} int j=i; int j=i; j i j<nums.length j nums.length nums nums.length j++ j++ j {
				if(nums[j]<nums[min]){
					min  = j;
				}
			} {
				if(nums[j]<nums[min]){
					min  = j;
				}
			} if(nums[j]<nums[min]){
					min  = j;
				} nums[j]<nums[min] nums[j] nums j nums[min] nums min {
					min  = j;
				} min  = j min j if(min!=i){
				count++;
				swap(nums,min,i);
			} min!=i min i {
				count++;
				swap(nums,min,i);
			} count++ count swap(nums,min,i) swap nums min i int[] nums nums 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 class Main {
	static int count = 0;
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int n =sc.nextInt();
		int[] nums  =new int[n];
		for(int i=0;i<n;i++){
			nums[i] = sc.nextInt();
		}
		selectionSort(nums);
		for(int i=0;i<nums.length;i++){
			if(i>0)System.out.print(" ");
			System.out.print(nums[i]);
		}
		System.out.println();
		System.out.println(count);
	}
	public static void selectionSort(int[] nums){
		for(int i=0;i<nums.length;i++){
			int min = i;
			for(int j=i;j<nums.length;j++){
				if(nums[j]<nums[min]){
					min  = j;
				}
			}
			if(min!=i){
				count++;
				swap(nums,min,i);
			}
		}
	}
	public static void swap(int[] A,int i ,int j){
		int t = A[j];
		A[j] = A[i];
		A[i] = t;
	}
} public class Main {
	static int count = 0;
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int n =sc.nextInt();
		int[] nums  =new int[n];
		for(int i=0;i<n;i++){
			nums[i] = sc.nextInt();
		}
		selectionSort(nums);
		for(int i=0;i<nums.length;i++){
			if(i>0)System.out.print(" ");
			System.out.print(nums[i]);
		}
		System.out.println();
		System.out.println(count);
	}
	public static void selectionSort(int[] nums){
		for(int i=0;i<nums.length;i++){
			int min = i;
			for(int j=i;j<nums.length;j++){
				if(nums[j]<nums[min]){
					min  = j;
				}
			}
			if(min!=i){
				count++;
				swap(nums,min,i);
			}
		}
	}
	public static void swap(int[] A,int i ,int j){
		int t = A[j];
		A[j] = A[i];
		A[i] = t;
	}
} Main
import java.util.*;
public class Main {
	static int count = 0;
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int n =sc.nextInt();
		int[] nums  =new int[n];
		for(int i=0;i<n;i++){
			nums[i] = sc.nextInt();
		}
		selectionSort(nums);
		for(int i=0;i<nums.length;i++){
			if(i>0)System.out.print(" ");
			System.out.print(nums[i]);
		}
		System.out.println();
		System.out.println(count);
	}
	public static void selectionSort(int[] nums){
		for(int i=0;i<nums.length;i++){
			int min = i;
			for(int j=i;j<nums.length;j++){
				if(nums[j]<nums[min]){
					min  = j;
				}
			}
			if(min!=i){
				count++;
				swap(nums,min,i);
			}
		}
	}
	public static void swap(int[] A,int i ,int j){
		int t = A[j];
		A[j] = A[i];
		A[i] = t;
	}
}