import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Scanner;
import java.util.Deque;
import java.util.ArrayDeque;

public class Main {

	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String tmp_arr[] = new String[n];
		int arr[] = new int[n];
		tmp_arr = br.readLine().split(" ");
		for(int i=0; i<n; i++){
			arr[i] = Integer.parseInt(tmp_arr[i]);
		}
		selection_sort(arr);
	}
	
	public static void selection_sort(int[] arr){
		int ans = 0;
		for(int i=0; i<arr.length; i++){
			int min_ix = i;
			for(int j=i; j<arr.length; j++){
				if(arr[min_ix] > arr[j]) min_ix = j;
			}
			if(min_ix != i){
				// swap
				int tmp = arr[min_ix];
				arr[min_ix] = arr[i];
				arr[i] = tmp;
				ans++;
			}
		}
		print_array(arr);
		System.out.println(ans);
	}
	public static void print_array(int[] arr){
		for(int i=0; i<arr.length; i++){
			System.out.print(arr[i]);
			if(i != arr.length-1) System.out.print(" ");
			else System.out.print("\n");
		}
	}


}
 import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.IOException; IOException java.io import java.util.Scanner; Scanner java.util import java.util.Deque; Deque java.util import java.util.ArrayDeque; ArrayDeque java.util public class Main {

	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String tmp_arr[] = new String[n];
		int arr[] = new int[n];
		tmp_arr = br.readLine().split(" ");
		for(int i=0; i<n; i++){
			arr[i] = Integer.parseInt(tmp_arr[i]);
		}
		selection_sort(arr);
	}
	
	public static void selection_sort(int[] arr){
		int ans = 0;
		for(int i=0; i<arr.length; i++){
			int min_ix = i;
			for(int j=i; j<arr.length; j++){
				if(arr[min_ix] > arr[j]) min_ix = j;
			}
			if(min_ix != i){
				// swap
				int tmp = arr[min_ix];
				arr[min_ix] = arr[i];
				arr[i] = tmp;
				ans++;
			}
		}
		print_array(arr);
		System.out.println(ans);
	}
	public static void print_array(int[] arr){
		for(int i=0; i<arr.length; i++){
			System.out.print(arr[i]);
			if(i != arr.length-1) System.out.print(" ");
			else System.out.print("\n");
		}
	}


} Main public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String tmp_arr[] = new String[n];
		int arr[] = new int[n];
		tmp_arr = br.readLine().split(" ");
		for(int i=0; i<n; i++){
			arr[i] = Integer.parseInt(tmp_arr[i]);
		}
		selection_sort(arr);
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String tmp_arr[] = new String[n];
		int arr[] = new int[n];
		tmp_arr = br.readLine().split(" ");
		for(int i=0; i<n; i++){
			arr[i] = Integer.parseInt(tmp_arr[i]);
		}
		selection_sort(arr);
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int n = Integer.parseInt(br.readLine()); n Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br String tmp_arr[] = new String[n]; tmp_arr new String[n] n int arr[] = new int[n]; arr new int[n] n tmp_arr = br.readLine().split(" ") tmp_arr br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " for(int i=0; i<n; i++){
			arr[i] = Integer.parseInt(tmp_arr[i]);
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			arr[i] = Integer.parseInt(tmp_arr[i]);
		} {
			arr[i] = Integer.parseInt(tmp_arr[i]);
		} arr[i] = Integer.parseInt(tmp_arr[i]) arr[i] arr i Integer.parseInt(tmp_arr[i]) Integer.parseInt Integer tmp_arr[i] tmp_arr i selection_sort(arr) selection_sort arr String[] args args public static void selection_sort(int[] arr){
		int ans = 0;
		for(int i=0; i<arr.length; i++){
			int min_ix = i;
			for(int j=i; j<arr.length; j++){
				if(arr[min_ix] > arr[j]) min_ix = j;
			}
			if(min_ix != i){
				// swap
				int tmp = arr[min_ix];
				arr[min_ix] = arr[i];
				arr[i] = tmp;
				ans++;
			}
		}
		print_array(arr);
		System.out.println(ans);
	} selection_sort {
		int ans = 0;
		for(int i=0; i<arr.length; i++){
			int min_ix = i;
			for(int j=i; j<arr.length; j++){
				if(arr[min_ix] > arr[j]) min_ix = j;
			}
			if(min_ix != i){
				// swap
				int tmp = arr[min_ix];
				arr[min_ix] = arr[i];
				arr[i] = tmp;
				ans++;
			}
		}
		print_array(arr);
		System.out.println(ans);
	} int ans = 0; ans 0 for(int i=0; i<arr.length; i++){
			int min_ix = i;
			for(int j=i; j<arr.length; j++){
				if(arr[min_ix] > arr[j]) min_ix = j;
			}
			if(min_ix != i){
				// swap
				int tmp = arr[min_ix];
				arr[min_ix] = arr[i];
				arr[i] = tmp;
				ans++;
			}
		} int i=0; int i=0; i 0 i<arr.length i arr.length arr arr.length i++ i++ i {
			int min_ix = i;
			for(int j=i; j<arr.length; j++){
				if(arr[min_ix] > arr[j]) min_ix = j;
			}
			if(min_ix != i){
				// swap
				int tmp = arr[min_ix];
				arr[min_ix] = arr[i];
				arr[i] = tmp;
				ans++;
			}
		} {
			int min_ix = i;
			for(int j=i; j<arr.length; j++){
				if(arr[min_ix] > arr[j]) min_ix = j;
			}
			if(min_ix != i){
				// swap
				int tmp = arr[min_ix];
				arr[min_ix] = arr[i];
				arr[i] = tmp;
				ans++;
			}
		} int min_ix = i; min_ix i for(int j=i; j<arr.length; j++){
				if(arr[min_ix] > arr[j]) min_ix = j;
			} int j=i; int j=i; j i j<arr.length j arr.length arr arr.length j++ j++ j {
				if(arr[min_ix] > arr[j]) min_ix = j;
			} {
				if(arr[min_ix] > arr[j]) min_ix = j;
			} if(arr[min_ix] > arr[j]) min_ix = j; arr[min_ix] > arr[j] arr[min_ix] arr min_ix arr[j] arr j min_ix = j min_ix j if(min_ix != i){
				// swap
				int tmp = arr[min_ix];
				arr[min_ix] = arr[i];
				arr[i] = tmp;
				ans++;
			} min_ix != i min_ix i {
				// swap
				int tmp = arr[min_ix];
				arr[min_ix] = arr[i];
				arr[i] = tmp;
				ans++;
			} int tmp = arr[min_ix]; tmp arr[min_ix] arr min_ix arr[min_ix] = arr[i] arr[min_ix] arr min_ix arr[i] arr i arr[i] = tmp arr[i] arr i tmp ans++ ans print_array(arr) print_array arr System.out.println(ans) System.out.println System.out System System.out ans int[] arr arr public static void print_array(int[] arr){
		for(int i=0; i<arr.length; i++){
			System.out.print(arr[i]);
			if(i != arr.length-1) System.out.print(" ");
			else System.out.print("\n");
		}
	} print_array {
		for(int i=0; i<arr.length; i++){
			System.out.print(arr[i]);
			if(i != arr.length-1) System.out.print(" ");
			else System.out.print("\n");
		}
	} for(int i=0; i<arr.length; i++){
			System.out.print(arr[i]);
			if(i != arr.length-1) System.out.print(" ");
			else System.out.print("\n");
		} int i=0; int i=0; i 0 i<arr.length i arr.length arr arr.length i++ i++ i {
			System.out.print(arr[i]);
			if(i != arr.length-1) System.out.print(" ");
			else System.out.print("\n");
		} {
			System.out.print(arr[i]);
			if(i != arr.length-1) System.out.print(" ");
			else System.out.print("\n");
		} System.out.print(arr[i]) System.out.print System.out System System.out arr[i] arr i if(i != arr.length-1) System.out.print(" ");
			else System.out.print("\n"); i != arr.length-1 i arr.length-1 arr.length arr arr.length 1 System.out.print(" ") System.out.print System.out System System.out " " System.out.print("\n") System.out.print System.out System System.out "\n" int[] arr arr public class Main {

	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String tmp_arr[] = new String[n];
		int arr[] = new int[n];
		tmp_arr = br.readLine().split(" ");
		for(int i=0; i<n; i++){
			arr[i] = Integer.parseInt(tmp_arr[i]);
		}
		selection_sort(arr);
	}
	
	public static void selection_sort(int[] arr){
		int ans = 0;
		for(int i=0; i<arr.length; i++){
			int min_ix = i;
			for(int j=i; j<arr.length; j++){
				if(arr[min_ix] > arr[j]) min_ix = j;
			}
			if(min_ix != i){
				// swap
				int tmp = arr[min_ix];
				arr[min_ix] = arr[i];
				arr[i] = tmp;
				ans++;
			}
		}
		print_array(arr);
		System.out.println(ans);
	}
	public static void print_array(int[] arr){
		for(int i=0; i<arr.length; i++){
			System.out.print(arr[i]);
			if(i != arr.length-1) System.out.print(" ");
			else System.out.print("\n");
		}
	}


} public class Main {

	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String tmp_arr[] = new String[n];
		int arr[] = new int[n];
		tmp_arr = br.readLine().split(" ");
		for(int i=0; i<n; i++){
			arr[i] = Integer.parseInt(tmp_arr[i]);
		}
		selection_sort(arr);
	}
	
	public static void selection_sort(int[] arr){
		int ans = 0;
		for(int i=0; i<arr.length; i++){
			int min_ix = i;
			for(int j=i; j<arr.length; j++){
				if(arr[min_ix] > arr[j]) min_ix = j;
			}
			if(min_ix != i){
				// swap
				int tmp = arr[min_ix];
				arr[min_ix] = arr[i];
				arr[i] = tmp;
				ans++;
			}
		}
		print_array(arr);
		System.out.println(ans);
	}
	public static void print_array(int[] arr){
		for(int i=0; i<arr.length; i++){
			System.out.print(arr[i]);
			if(i != arr.length-1) System.out.print(" ");
			else System.out.print("\n");
		}
	}


} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Scanner;
import java.util.Deque;
import java.util.ArrayDeque;

public class Main {

	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String tmp_arr[] = new String[n];
		int arr[] = new int[n];
		tmp_arr = br.readLine().split(" ");
		for(int i=0; i<n; i++){
			arr[i] = Integer.parseInt(tmp_arr[i]);
		}
		selection_sort(arr);
	}
	
	public static void selection_sort(int[] arr){
		int ans = 0;
		for(int i=0; i<arr.length; i++){
			int min_ix = i;
			for(int j=i; j<arr.length; j++){
				if(arr[min_ix] > arr[j]) min_ix = j;
			}
			if(min_ix != i){
				// swap
				int tmp = arr[min_ix];
				arr[min_ix] = arr[i];
				arr[i] = tmp;
				ans++;
			}
		}
		print_array(arr);
		System.out.println(ans);
	}
	public static void print_array(int[] arr){
		for(int i=0; i<arr.length; i++){
			System.out.print(arr[i]);
			if(i != arr.length-1) System.out.print(" ");
			else System.out.print("\n");
		}
	}


}

