import java.util.*;

public class Main{
	private static final Scanner scan = new Scanner(System.in);

	public static void main(String[] args){
		int n = scan.nextInt();
		int[] arr = new int[n];
		for(int i = 0; i < n; i++){
			arr[i] = scan.nextInt();
		}

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

		for(int i = 0; i < n; i++){
			System.out.printf(i != n-1? "%d ": "%d\n", arr[i]);
		}
		System.out.printf("%d\n", count);
	}
} import java.util.*; util.* java public class Main{
	private static final Scanner scan = new Scanner(System.in);

	public static void main(String[] args){
		int n = scan.nextInt();
		int[] arr = new int[n];
		for(int i = 0; i < n; i++){
			arr[i] = scan.nextInt();
		}

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

		for(int i = 0; i < n; i++){
			System.out.printf(i != n-1? "%d ": "%d\n", arr[i]);
		}
		System.out.printf("%d\n", count);
	}
} Main private static final Scanner scan = new Scanner(System.in); scan new Scanner(System.in) public static void main(String[] args){
		int n = scan.nextInt();
		int[] arr = new int[n];
		for(int i = 0; i < n; i++){
			arr[i] = scan.nextInt();
		}

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

		for(int i = 0; i < n; i++){
			System.out.printf(i != n-1? "%d ": "%d\n", arr[i]);
		}
		System.out.printf("%d\n", count);
	} main {
		int n = scan.nextInt();
		int[] arr = new int[n];
		for(int i = 0; i < n; i++){
			arr[i] = scan.nextInt();
		}

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

		for(int i = 0; i < n; i++){
			System.out.printf(i != n-1? "%d ": "%d\n", arr[i]);
		}
		System.out.printf("%d\n", count);
	} int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int[] arr = new int[n]; arr new int[n] n for(int i = 0; i < n; i++){
			arr[i] = scan.nextInt();
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			arr[i] = scan.nextInt();
		} {
			arr[i] = scan.nextInt();
		} arr[i] = scan.nextInt() arr[i] arr i scan.nextInt() scan.nextInt scan int count = 0; count 0 for(int i = 0; i < n; i++){
			int minj = i;
			for(int j = i; j < n; j++){
				if(arr[j] < arr[minj]){
					minj = j;
				}
			}
			if(i != minj){
				int small = arr[minj];
				arr[minj] = arr[i];
				arr[i] = small;
				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(arr[j] < arr[minj]){
					minj = j;
				}
			}
			if(i != minj){
				int small = arr[minj];
				arr[minj] = arr[i];
				arr[i] = small;
				count++;
			}
		} {
			int minj = i;
			for(int j = i; j < n; j++){
				if(arr[j] < arr[minj]){
					minj = j;
				}
			}
			if(i != minj){
				int small = arr[minj];
				arr[minj] = arr[i];
				arr[i] = small;
				count++;
			}
		} int minj = i; minj i for(int j = i; j < n; j++){
				if(arr[j] < arr[minj]){
					minj = j;
				}
			} int j = i; int j = i; j i j < n j n j++ j++ j {
				if(arr[j] < arr[minj]){
					minj = j;
				}
			} {
				if(arr[j] < arr[minj]){
					minj = j;
				}
			} if(arr[j] < arr[minj]){
					minj = j;
				} arr[j] < arr[minj] arr[j] arr j arr[minj] arr minj {
					minj = j;
				} minj = j minj j if(i != minj){
				int small = arr[minj];
				arr[minj] = arr[i];
				arr[i] = small;
				count++;
			} i != minj i minj {
				int small = arr[minj];
				arr[minj] = arr[i];
				arr[i] = small;
				count++;
			} int small = arr[minj]; small arr[minj] arr minj arr[minj] = arr[i] arr[minj] arr minj arr[i] arr i arr[i] = small arr[i] arr i small count++ count for(int i = 0; i < n; i++){
			System.out.printf(i != n-1? "%d ": "%d\n", arr[i]);
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			System.out.printf(i != n-1? "%d ": "%d\n", arr[i]);
		} {
			System.out.printf(i != n-1? "%d ": "%d\n", arr[i]);
		} System.out.printf(i != n-1? "%d ": "%d\n", arr[i]) System.out.printf System.out System System.out i != n-1? "%d ": "%d\n" i != n-1 i n-1 n 1 "%d " "%d\n" arr[i] arr i System.out.printf("%d\n", count) System.out.printf System.out System System.out "%d\n" count String[] args args public class Main{
	private static final Scanner scan = new Scanner(System.in);

	public static void main(String[] args){
		int n = scan.nextInt();
		int[] arr = new int[n];
		for(int i = 0; i < n; i++){
			arr[i] = scan.nextInt();
		}

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

		for(int i = 0; i < n; i++){
			System.out.printf(i != n-1? "%d ": "%d\n", arr[i]);
		}
		System.out.printf("%d\n", count);
	}
} public class Main{
	private static final Scanner scan = new Scanner(System.in);

	public static void main(String[] args){
		int n = scan.nextInt();
		int[] arr = new int[n];
		for(int i = 0; i < n; i++){
			arr[i] = scan.nextInt();
		}

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

		for(int i = 0; i < n; i++){
			System.out.printf(i != n-1? "%d ": "%d\n", arr[i]);
		}
		System.out.printf("%d\n", count);
	}
} Main
import java.util.*;

public class Main{
	private static final Scanner scan = new Scanner(System.in);

	public static void main(String[] args){
		int n = scan.nextInt();
		int[] arr = new int[n];
		for(int i = 0; i < n; i++){
			arr[i] = scan.nextInt();
		}

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

		for(int i = 0; i < n; i++){
			System.out.printf(i != n-1? "%d ": "%d\n", arr[i]);
		}
		System.out.printf("%d\n", count);
	}
}