import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.Arrays;

class Main{
	public static void main(String[] args)throws Exception{
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int[] numbers = new int[n];
		for(int i = 0; i < n; i++){
		    numbers[i] = scanner.nextInt();
		}
		int count = 0;
		int temp = 0;

		for(int i = 0; i < n; i++){
			int minj = i;
			for(int j = i; j < n; j++){
				if(numbers[j] < numbers[minj]){
					minj = j;
				}
			}
			if(i != minj){
			    temp = numbers[i];
    			numbers[i] = numbers[minj];
    			numbers[minj] = temp;
    			count++;
			}
		}

		for(int i = 0; i < n; i++){
			if(i == n-1){
				System.out.print(numbers[i]);
				System.out.print("\n");
			}else{
				System.out.print(numbers[i] + " ");
			}
		}
		System.out.println(count);
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.Scanner; Scanner java.util import java.util.Arrays; Arrays java.util class Main{
	public static void main(String[] args)throws Exception{
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int[] numbers = new int[n];
		for(int i = 0; i < n; i++){
		    numbers[i] = scanner.nextInt();
		}
		int count = 0;
		int temp = 0;

		for(int i = 0; i < n; i++){
			int minj = i;
			for(int j = i; j < n; j++){
				if(numbers[j] < numbers[minj]){
					minj = j;
				}
			}
			if(i != minj){
			    temp = numbers[i];
    			numbers[i] = numbers[minj];
    			numbers[minj] = temp;
    			count++;
			}
		}

		for(int i = 0; i < n; i++){
			if(i == n-1){
				System.out.print(numbers[i]);
				System.out.print("\n");
			}else{
				System.out.print(numbers[i] + " ");
			}
		}
		System.out.println(count);
	}
} Main public static void main(String[] args)throws Exception{
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int[] numbers = new int[n];
		for(int i = 0; i < n; i++){
		    numbers[i] = scanner.nextInt();
		}
		int count = 0;
		int temp = 0;

		for(int i = 0; i < n; i++){
			int minj = i;
			for(int j = i; j < n; j++){
				if(numbers[j] < numbers[minj]){
					minj = j;
				}
			}
			if(i != minj){
			    temp = numbers[i];
    			numbers[i] = numbers[minj];
    			numbers[minj] = temp;
    			count++;
			}
		}

		for(int i = 0; i < n; i++){
			if(i == n-1){
				System.out.print(numbers[i]);
				System.out.print("\n");
			}else{
				System.out.print(numbers[i] + " ");
			}
		}
		System.out.println(count);
	} main {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int[] numbers = new int[n];
		for(int i = 0; i < n; i++){
		    numbers[i] = scanner.nextInt();
		}
		int count = 0;
		int temp = 0;

		for(int i = 0; i < n; i++){
			int minj = i;
			for(int j = i; j < n; j++){
				if(numbers[j] < numbers[minj]){
					minj = j;
				}
			}
			if(i != minj){
			    temp = numbers[i];
    			numbers[i] = numbers[minj];
    			numbers[minj] = temp;
    			count++;
			}
		}

		for(int i = 0; i < n; i++){
			if(i == n-1){
				System.out.print(numbers[i]);
				System.out.print("\n");
			}else{
				System.out.print(numbers[i] + " ");
			}
		}
		System.out.println(count);
	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int n = scanner.nextInt(); n scanner.nextInt() scanner.nextInt scanner int[] numbers = new int[n]; numbers new int[n] n for(int i = 0; i < n; i++){
		    numbers[i] = scanner.nextInt();
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
		    numbers[i] = scanner.nextInt();
		} {
		    numbers[i] = scanner.nextInt();
		} numbers[i] = scanner.nextInt() numbers[i] numbers i scanner.nextInt() scanner.nextInt scanner int count = 0; count 0 int temp = 0; temp 0 for(int i = 0; i < n; i++){
			int minj = i;
			for(int j = i; j < n; j++){
				if(numbers[j] < numbers[minj]){
					minj = j;
				}
			}
			if(i != minj){
			    temp = numbers[i];
    			numbers[i] = numbers[minj];
    			numbers[minj] = temp;
    			count++;
			}
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			int minj = i;
			for(int j = i; j < n; j++){
				if(numbers[j] < numbers[minj]){
					minj = j;
				}
			}
			if(i != minj){
			    temp = numbers[i];
    			numbers[i] = numbers[minj];
    			numbers[minj] = temp;
    			count++;
			}
		} {
			int minj = i;
			for(int j = i; j < n; j++){
				if(numbers[j] < numbers[minj]){
					minj = j;
				}
			}
			if(i != minj){
			    temp = numbers[i];
    			numbers[i] = numbers[minj];
    			numbers[minj] = temp;
    			count++;
			}
		} int minj = i; minj i for(int j = i; j < n; j++){
				if(numbers[j] < numbers[minj]){
					minj = j;
				}
			} int j = i; int j = i; j i j < n j n j++ j++ j {
				if(numbers[j] < numbers[minj]){
					minj = j;
				}
			} {
				if(numbers[j] < numbers[minj]){
					minj = j;
				}
			} if(numbers[j] < numbers[minj]){
					minj = j;
				} numbers[j] < numbers[minj] numbers[j] numbers j numbers[minj] numbers minj {
					minj = j;
				} minj = j minj j if(i != minj){
			    temp = numbers[i];
    			numbers[i] = numbers[minj];
    			numbers[minj] = temp;
    			count++;
			} i != minj i minj {
			    temp = numbers[i];
    			numbers[i] = numbers[minj];
    			numbers[minj] = temp;
    			count++;
			} temp = numbers[i] temp numbers[i] numbers i numbers[i] = numbers[minj] numbers[i] numbers i numbers[minj] numbers minj numbers[minj] = temp numbers[minj] numbers minj temp count++ count for(int i = 0; i < n; i++){
			if(i == n-1){
				System.out.print(numbers[i]);
				System.out.print("\n");
			}else{
				System.out.print(numbers[i] + " ");
			}
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			if(i == n-1){
				System.out.print(numbers[i]);
				System.out.print("\n");
			}else{
				System.out.print(numbers[i] + " ");
			}
		} {
			if(i == n-1){
				System.out.print(numbers[i]);
				System.out.print("\n");
			}else{
				System.out.print(numbers[i] + " ");
			}
		} if(i == n-1){
				System.out.print(numbers[i]);
				System.out.print("\n");
			}else{
				System.out.print(numbers[i] + " ");
			} i == n-1 i n-1 n 1 {
				System.out.print(numbers[i]);
				System.out.print("\n");
			} System.out.print(numbers[i]) System.out.print System.out System System.out numbers[i] numbers i System.out.print("\n") System.out.print System.out System System.out "\n" {
				System.out.print(numbers[i] + " ");
			} System.out.print(numbers[i] + " ") System.out.print System.out System System.out numbers[i] + " " numbers[i] numbers i " " System.out.println(count) System.out.println System.out System System.out count String[] args args
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.Arrays;

class Main{
	public static void main(String[] args)throws Exception{
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int[] numbers = new int[n];
		for(int i = 0; i < n; i++){
		    numbers[i] = scanner.nextInt();
		}
		int count = 0;
		int temp = 0;

		for(int i = 0; i < n; i++){
			int minj = i;
			for(int j = i; j < n; j++){
				if(numbers[j] < numbers[minj]){
					minj = j;
				}
			}
			if(i != minj){
			    temp = numbers[i];
    			numbers[i] = numbers[minj];
    			numbers[minj] = temp;
    			count++;
			}
		}

		for(int i = 0; i < n; i++){
			if(i == n-1){
				System.out.print(numbers[i]);
				System.out.print("\n");
			}else{
				System.out.print(numbers[i] + " ");
			}
		}
		System.out.println(count);
	}
}