import java.util.Scanner;

class Main {
	public static void main(String args[]){
		Scanner scan = new Scanner(System.in);
		
		int n = scan.nextInt();
		int[] a = new int[n];
	
		for(int i = 0; i < n; i++){
			a[i] = scan.nextInt();
		}
	
		boolean flag = true;
		int swap;
		int count = 0;
		int min;

		for(int i = 0; i < n; i++){
			min = i;
			for(int j = i; j < n; j++){
				if(a[j] < a[min]){
					min = j;
				}
			}
			if(a[i] != a[min]){
				swap = a[i];
				a[i] = a[min];
				a[min] = swap;
				count++;
			}
		}
		
		for(int i = 0; i < n; i++) {
			System.out.print(a[i]);

			if(i != n-1) System.out.print(" ");
		}
		System.out.println();
		System.out.println(count);
	}
} import java.util.Scanner; Scanner java.util class Main {
	public static void main(String args[]){
		Scanner scan = new Scanner(System.in);
		
		int n = scan.nextInt();
		int[] a = new int[n];
	
		for(int i = 0; i < n; i++){
			a[i] = scan.nextInt();
		}
	
		boolean flag = true;
		int swap;
		int count = 0;
		int min;

		for(int i = 0; i < n; i++){
			min = i;
			for(int j = i; j < n; j++){
				if(a[j] < a[min]){
					min = j;
				}
			}
			if(a[i] != a[min]){
				swap = a[i];
				a[i] = a[min];
				a[min] = swap;
				count++;
			}
		}
		
		for(int i = 0; i < n; i++) {
			System.out.print(a[i]);

			if(i != n-1) System.out.print(" ");
		}
		System.out.println();
		System.out.println(count);
	}
} Main public static void main(String args[]){
		Scanner scan = new Scanner(System.in);
		
		int n = scan.nextInt();
		int[] a = new int[n];
	
		for(int i = 0; i < n; i++){
			a[i] = scan.nextInt();
		}
	
		boolean flag = true;
		int swap;
		int count = 0;
		int min;

		for(int i = 0; i < n; i++){
			min = i;
			for(int j = i; j < n; j++){
				if(a[j] < a[min]){
					min = j;
				}
			}
			if(a[i] != a[min]){
				swap = a[i];
				a[i] = a[min];
				a[min] = swap;
				count++;
			}
		}
		
		for(int i = 0; i < n; i++) {
			System.out.print(a[i]);

			if(i != n-1) System.out.print(" ");
		}
		System.out.println();
		System.out.println(count);
	} main {
		Scanner scan = new Scanner(System.in);
		
		int n = scan.nextInt();
		int[] a = new int[n];
	
		for(int i = 0; i < n; i++){
			a[i] = scan.nextInt();
		}
	
		boolean flag = true;
		int swap;
		int count = 0;
		int min;

		for(int i = 0; i < n; i++){
			min = i;
			for(int j = i; j < n; j++){
				if(a[j] < a[min]){
					min = j;
				}
			}
			if(a[i] != a[min]){
				swap = a[i];
				a[i] = a[min];
				a[min] = swap;
				count++;
			}
		}
		
		for(int i = 0; i < n; i++) {
			System.out.print(a[i]);

			if(i != n-1) System.out.print(" ");
		}
		System.out.println();
		System.out.println(count);
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int[] a = new int[n]; a new int[n] n for(int i = 0; i < n; i++){
			a[i] = scan.nextInt();
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			a[i] = scan.nextInt();
		} {
			a[i] = scan.nextInt();
		} a[i] = scan.nextInt() a[i] a i scan.nextInt() scan.nextInt scan boolean flag = true; flag true int swap; swap int count = 0; count 0 int min; min for(int i = 0; i < n; i++){
			min = i;
			for(int j = i; j < n; j++){
				if(a[j] < a[min]){
					min = j;
				}
			}
			if(a[i] != a[min]){
				swap = a[i];
				a[i] = a[min];
				a[min] = swap;
				count++;
			}
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			min = i;
			for(int j = i; j < n; j++){
				if(a[j] < a[min]){
					min = j;
				}
			}
			if(a[i] != a[min]){
				swap = a[i];
				a[i] = a[min];
				a[min] = swap;
				count++;
			}
		} {
			min = i;
			for(int j = i; j < n; j++){
				if(a[j] < a[min]){
					min = j;
				}
			}
			if(a[i] != a[min]){
				swap = a[i];
				a[i] = a[min];
				a[min] = swap;
				count++;
			}
		} min = i min i for(int j = i; j < n; j++){
				if(a[j] < a[min]){
					min = j;
				}
			} int j = i; int j = i; j i j < n j n j++ j++ j {
				if(a[j] < a[min]){
					min = j;
				}
			} {
				if(a[j] < a[min]){
					min = j;
				}
			} if(a[j] < a[min]){
					min = j;
				} a[j] < a[min] a[j] a j a[min] a min {
					min = j;
				} min = j min j if(a[i] != a[min]){
				swap = a[i];
				a[i] = a[min];
				a[min] = swap;
				count++;
			} a[i] != a[min] a[i] a i a[min] a min {
				swap = a[i];
				a[i] = a[min];
				a[min] = swap;
				count++;
			} swap = a[i] swap a[i] a i a[i] = a[min] a[i] a i a[min] a min a[min] = swap a[min] a min swap count++ count for(int i = 0; i < n; i++) {
			System.out.print(a[i]);

			if(i != n-1) System.out.print(" ");
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			System.out.print(a[i]);

			if(i != n-1) System.out.print(" ");
		} {
			System.out.print(a[i]);

			if(i != n-1) System.out.print(" ");
		} System.out.print(a[i]) System.out.print System.out System System.out a[i] a i if(i != n-1) System.out.print(" "); i != n-1 i n-1 n 1 System.out.print(" ") System.out.print System.out System System.out " " 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
import java.util.Scanner;

class Main {
	public static void main(String args[]){
		Scanner scan = new Scanner(System.in);
		
		int n = scan.nextInt();
		int[] a = new int[n];
	
		for(int i = 0; i < n; i++){
			a[i] = scan.nextInt();
		}
	
		boolean flag = true;
		int swap;
		int count = 0;
		int min;

		for(int i = 0; i < n; i++){
			min = i;
			for(int j = i; j < n; j++){
				if(a[j] < a[min]){
					min = j;
				}
			}
			if(a[i] != a[min]){
				swap = a[i];
				a[i] = a[min];
				a[min] = swap;
				count++;
			}
		}
		
		for(int i = 0; i < n; i++) {
			System.out.print(a[i]);

			if(i != n-1) System.out.print(" ");
		}
		System.out.println();
		System.out.println(count);
	}
}