import java.util.Scanner;
class Main {
    public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int input = scan.nextInt();
		int[] num = new int[input];
		int count;
		
		for(int c = 0; c < input; c++){
			num[c] = scan.nextInt();
		}
		
		count = SelectionSort(num, input);
		
		for(int i = 0; i < input; i++){
			if(i != input - 1){
				System.out.print(num[i] + " ");
			}else{
				System.out.println(num[i]);
			}
		}
		System.out.println(count);
	}
	
	static int SelectionSort(int data[], int n){
		int temp;
		int c = 0;
		int min;
		boolean b;
		
		for(int i = 0; i < n - 1; i++){
			min = i;
			b = false;
			
			for(int j = i + 1; j < n; j++){
				if(data[j] < data[min]){
					min = j;
					b = true;
				}
			}
			if(b){
				temp = data[i];
				data[i] = data[min];
				data[min] = temp;
				c++;
			}
		}
		
		return c;
	}
} import java.util.Scanner; Scanner java.util class Main {
    public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int input = scan.nextInt();
		int[] num = new int[input];
		int count;
		
		for(int c = 0; c < input; c++){
			num[c] = scan.nextInt();
		}
		
		count = SelectionSort(num, input);
		
		for(int i = 0; i < input; i++){
			if(i != input - 1){
				System.out.print(num[i] + " ");
			}else{
				System.out.println(num[i]);
			}
		}
		System.out.println(count);
	}
	
	static int SelectionSort(int data[], int n){
		int temp;
		int c = 0;
		int min;
		boolean b;
		
		for(int i = 0; i < n - 1; i++){
			min = i;
			b = false;
			
			for(int j = i + 1; j < n; j++){
				if(data[j] < data[min]){
					min = j;
					b = true;
				}
			}
			if(b){
				temp = data[i];
				data[i] = data[min];
				data[min] = temp;
				c++;
			}
		}
		
		return c;
	}
} Main public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int input = scan.nextInt();
		int[] num = new int[input];
		int count;
		
		for(int c = 0; c < input; c++){
			num[c] = scan.nextInt();
		}
		
		count = SelectionSort(num, input);
		
		for(int i = 0; i < input; i++){
			if(i != input - 1){
				System.out.print(num[i] + " ");
			}else{
				System.out.println(num[i]);
			}
		}
		System.out.println(count);
	} main {
		Scanner scan = new Scanner(System.in);
		int input = scan.nextInt();
		int[] num = new int[input];
		int count;
		
		for(int c = 0; c < input; c++){
			num[c] = scan.nextInt();
		}
		
		count = SelectionSort(num, input);
		
		for(int i = 0; i < input; i++){
			if(i != input - 1){
				System.out.print(num[i] + " ");
			}else{
				System.out.println(num[i]);
			}
		}
		System.out.println(count);
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int input = scan.nextInt(); input scan.nextInt() scan.nextInt scan int[] num = new int[input]; num new int[input] input int count; count for(int c = 0; c < input; c++){
			num[c] = scan.nextInt();
		} int c = 0; int c = 0; c 0 c < input c input c++ c++ c {
			num[c] = scan.nextInt();
		} {
			num[c] = scan.nextInt();
		} num[c] = scan.nextInt() num[c] num c scan.nextInt() scan.nextInt scan count = SelectionSort(num, input) count SelectionSort(num, input) SelectionSort num input for(int i = 0; i < input; i++){
			if(i != input - 1){
				System.out.print(num[i] + " ");
			}else{
				System.out.println(num[i]);
			}
		} int i = 0; int i = 0; i 0 i < input i input i++ i++ i {
			if(i != input - 1){
				System.out.print(num[i] + " ");
			}else{
				System.out.println(num[i]);
			}
		} {
			if(i != input - 1){
				System.out.print(num[i] + " ");
			}else{
				System.out.println(num[i]);
			}
		} if(i != input - 1){
				System.out.print(num[i] + " ");
			}else{
				System.out.println(num[i]);
			} i != input - 1 i input - 1 input 1 {
				System.out.print(num[i] + " ");
			} System.out.print(num[i] + " ") System.out.print System.out System System.out num[i] + " " num[i] num i " " {
				System.out.println(num[i]);
			} System.out.println(num[i]) System.out.println System.out System System.out num[i] num i System.out.println(count) System.out.println System.out System System.out count String[] args args static int SelectionSort(int data[], int n){
		int temp;
		int c = 0;
		int min;
		boolean b;
		
		for(int i = 0; i < n - 1; i++){
			min = i;
			b = false;
			
			for(int j = i + 1; j < n; j++){
				if(data[j] < data[min]){
					min = j;
					b = true;
				}
			}
			if(b){
				temp = data[i];
				data[i] = data[min];
				data[min] = temp;
				c++;
			}
		}
		
		return c;
	} SelectionSort {
		int temp;
		int c = 0;
		int min;
		boolean b;
		
		for(int i = 0; i < n - 1; i++){
			min = i;
			b = false;
			
			for(int j = i + 1; j < n; j++){
				if(data[j] < data[min]){
					min = j;
					b = true;
				}
			}
			if(b){
				temp = data[i];
				data[i] = data[min];
				data[min] = temp;
				c++;
			}
		}
		
		return c;
	} int temp; temp int c = 0; c 0 int min; min boolean b; b for(int i = 0; i < n - 1; i++){
			min = i;
			b = false;
			
			for(int j = i + 1; j < n; j++){
				if(data[j] < data[min]){
					min = j;
					b = true;
				}
			}
			if(b){
				temp = data[i];
				data[i] = data[min];
				data[min] = temp;
				c++;
			}
		} int i = 0; int i = 0; i 0 i < n - 1 i n - 1 n 1 i++ i++ i {
			min = i;
			b = false;
			
			for(int j = i + 1; j < n; j++){
				if(data[j] < data[min]){
					min = j;
					b = true;
				}
			}
			if(b){
				temp = data[i];
				data[i] = data[min];
				data[min] = temp;
				c++;
			}
		} {
			min = i;
			b = false;
			
			for(int j = i + 1; j < n; j++){
				if(data[j] < data[min]){
					min = j;
					b = true;
				}
			}
			if(b){
				temp = data[i];
				data[i] = data[min];
				data[min] = temp;
				c++;
			}
		} min = i min i b = false b false for(int j = i + 1; j < n; j++){
				if(data[j] < data[min]){
					min = j;
					b = true;
				}
			} int j = i + 1; int j = i + 1; j i + 1 i 1 j < n j n j++ j++ j {
				if(data[j] < data[min]){
					min = j;
					b = true;
				}
			} {
				if(data[j] < data[min]){
					min = j;
					b = true;
				}
			} if(data[j] < data[min]){
					min = j;
					b = true;
				} data[j] < data[min] data[j] data j data[min] data min {
					min = j;
					b = true;
				} min = j min j b = true b true if(b){
				temp = data[i];
				data[i] = data[min];
				data[min] = temp;
				c++;
			} b {
				temp = data[i];
				data[i] = data[min];
				data[min] = temp;
				c++;
			} temp = data[i] temp data[i] data i data[i] = data[min] data[i] data i data[min] data min data[min] = temp data[min] data min temp c++ c return c; c int data[] data int n n
import java.util.Scanner;
class Main {
    public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int input = scan.nextInt();
		int[] num = new int[input];
		int count;
		
		for(int c = 0; c < input; c++){
			num[c] = scan.nextInt();
		}
		
		count = SelectionSort(num, input);
		
		for(int i = 0; i < input; i++){
			if(i != input - 1){
				System.out.print(num[i] + " ");
			}else{
				System.out.println(num[i]);
			}
		}
		System.out.println(count);
	}
	
	static int SelectionSort(int data[], int n){
		int temp;
		int c = 0;
		int min;
		boolean b;
		
		for(int i = 0; i < n - 1; i++){
			min = i;
			b = false;
			
			for(int j = i + 1; j < n; j++){
				if(data[j] < data[min]){
					min = j;
					b = true;
				}
			}
			if(b){
				temp = data[i];
				data[i] = data[min];
				data[min] = temp;
				c++;
			}
		}
		
		return c;
	}
}