import java.util.Scanner;
public class Main {
	public static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int i, j, k;
		int n = sc.nextInt();
		int a[] = new int[n];
		
		for(i = 0; i < n; i++){
			a[i] = sc.nextInt();
		}
		
		selectionsort(n, a);
	}
	public static void selectionsort(int n, int a[]){
		int count = 0;
		for (int i = 0; i <= n - 1; i++){
			int minj = i;
			for(int j = i; j <= n - 1; j++){
				if(a[j] < a[minj]){
					minj = j;
				}
			}
			if(a[i] != a[minj]) count++;
			int temp = a[i];
			a[i] = a[minj];
			a[minj] = temp;
		}
		for(int i = 0; i < n; i++){
			System.out.print(( i == 0 ? "" : " ") + a[i]);
		}
		
		System.out.printf("\n%d\n", count);
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int i, j, k;
		int n = sc.nextInt();
		int a[] = new int[n];
		
		for(i = 0; i < n; i++){
			a[i] = sc.nextInt();
		}
		
		selectionsort(n, a);
	}
	public static void selectionsort(int n, int a[]){
		int count = 0;
		for (int i = 0; i <= n - 1; i++){
			int minj = i;
			for(int j = i; j <= n - 1; j++){
				if(a[j] < a[minj]){
					minj = j;
				}
			}
			if(a[i] != a[minj]) count++;
			int temp = a[i];
			a[i] = a[minj];
			a[minj] = temp;
		}
		for(int i = 0; i < n; i++){
			System.out.print(( i == 0 ? "" : " ") + a[i]);
		}
		
		System.out.printf("\n%d\n", count);
	}
} Main public static Scanner sc = new Scanner(System.in); sc new Scanner(System.in) public static void main(String[] args) {
		int i, j, k;
		int n = sc.nextInt();
		int a[] = new int[n];
		
		for(i = 0; i < n; i++){
			a[i] = sc.nextInt();
		}
		
		selectionsort(n, a);
	} main {
		int i, j, k;
		int n = sc.nextInt();
		int a[] = new int[n];
		
		for(i = 0; i < n; i++){
			a[i] = sc.nextInt();
		}
		
		selectionsort(n, a);
	} int i i j j k; k int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int a[] = new int[n]; a new int[n] n for(i = 0; i < n; i++){
			a[i] = sc.nextInt();
		} i = 0; i = 0 i 0 i < n i n i++ i++ i {
			a[i] = sc.nextInt();
		} {
			a[i] = sc.nextInt();
		} a[i] = sc.nextInt() a[i] a i sc.nextInt() sc.nextInt sc selectionsort(n, a) selectionsort n a String[] args args public static void selectionsort(int n, int a[]){
		int count = 0;
		for (int i = 0; i <= n - 1; i++){
			int minj = i;
			for(int j = i; j <= n - 1; j++){
				if(a[j] < a[minj]){
					minj = j;
				}
			}
			if(a[i] != a[minj]) count++;
			int temp = a[i];
			a[i] = a[minj];
			a[minj] = temp;
		}
		for(int i = 0; i < n; i++){
			System.out.print(( i == 0 ? "" : " ") + a[i]);
		}
		
		System.out.printf("\n%d\n", count);
	} selectionsort {
		int count = 0;
		for (int i = 0; i <= n - 1; i++){
			int minj = i;
			for(int j = i; j <= n - 1; j++){
				if(a[j] < a[minj]){
					minj = j;
				}
			}
			if(a[i] != a[minj]) count++;
			int temp = a[i];
			a[i] = a[minj];
			a[minj] = temp;
		}
		for(int i = 0; i < n; i++){
			System.out.print(( i == 0 ? "" : " ") + a[i]);
		}
		
		System.out.printf("\n%d\n", count);
	} int count = 0; count 0 for (int i = 0; i <= n - 1; i++){
			int minj = i;
			for(int j = i; j <= n - 1; j++){
				if(a[j] < a[minj]){
					minj = j;
				}
			}
			if(a[i] != a[minj]) count++;
			int temp = a[i];
			a[i] = a[minj];
			a[minj] = temp;
		} int i = 0; int i = 0; i 0 i <= n - 1 i n - 1 n 1 i++ i++ i {
			int minj = i;
			for(int j = i; j <= n - 1; j++){
				if(a[j] < a[minj]){
					minj = j;
				}
			}
			if(a[i] != a[minj]) count++;
			int temp = a[i];
			a[i] = a[minj];
			a[minj] = temp;
		} {
			int minj = i;
			for(int j = i; j <= n - 1; j++){
				if(a[j] < a[minj]){
					minj = j;
				}
			}
			if(a[i] != a[minj]) count++;
			int temp = a[i];
			a[i] = a[minj];
			a[minj] = temp;
		} int minj = i; minj i for(int j = i; j <= n - 1; j++){
				if(a[j] < a[minj]){
					minj = j;
				}
			} int j = i; int j = i; j i j <= n - 1 j n - 1 n 1 j++ j++ j {
				if(a[j] < a[minj]){
					minj = j;
				}
			} {
				if(a[j] < a[minj]){
					minj = j;
				}
			} if(a[j] < a[minj]){
					minj = j;
				} a[j] < a[minj] a[j] a j a[minj] a minj {
					minj = j;
				} minj = j minj j if(a[i] != a[minj]) count++; a[i] != a[minj] a[i] a i a[minj] a minj count++ count int temp = a[i]; temp a[i] a i a[i] = a[minj] a[i] a i a[minj] a minj a[minj] = temp a[minj] a minj temp for(int i = 0; i < n; i++){
			System.out.print(( i == 0 ? "" : " ") + a[i]);
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			System.out.print(( i == 0 ? "" : " ") + a[i]);
		} {
			System.out.print(( i == 0 ? "" : " ") + a[i]);
		} System.out.print(( i == 0 ? "" : " ") + a[i]) System.out.print System.out System System.out ( i == 0 ? "" : " ") + a[i] ( i == 0 ? "" : " ") i == 0 i 0 "" " " a[i] a i System.out.printf("\n%d\n", count) System.out.printf System.out System System.out "\n%d\n" count int n n int a[] a public class Main {
	public static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int i, j, k;
		int n = sc.nextInt();
		int a[] = new int[n];
		
		for(i = 0; i < n; i++){
			a[i] = sc.nextInt();
		}
		
		selectionsort(n, a);
	}
	public static void selectionsort(int n, int a[]){
		int count = 0;
		for (int i = 0; i <= n - 1; i++){
			int minj = i;
			for(int j = i; j <= n - 1; j++){
				if(a[j] < a[minj]){
					minj = j;
				}
			}
			if(a[i] != a[minj]) count++;
			int temp = a[i];
			a[i] = a[minj];
			a[minj] = temp;
		}
		for(int i = 0; i < n; i++){
			System.out.print(( i == 0 ? "" : " ") + a[i]);
		}
		
		System.out.printf("\n%d\n", count);
	}
} public class Main {
	public static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int i, j, k;
		int n = sc.nextInt();
		int a[] = new int[n];
		
		for(i = 0; i < n; i++){
			a[i] = sc.nextInt();
		}
		
		selectionsort(n, a);
	}
	public static void selectionsort(int n, int a[]){
		int count = 0;
		for (int i = 0; i <= n - 1; i++){
			int minj = i;
			for(int j = i; j <= n - 1; j++){
				if(a[j] < a[minj]){
					minj = j;
				}
			}
			if(a[i] != a[minj]) count++;
			int temp = a[i];
			a[i] = a[minj];
			a[minj] = temp;
		}
		for(int i = 0; i < n; i++){
			System.out.print(( i == 0 ? "" : " ") + a[i]);
		}
		
		System.out.printf("\n%d\n", count);
	}
} Main
import java.util.Scanner;
public class Main {
	public static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int i, j, k;
		int n = sc.nextInt();
		int a[] = new int[n];
		
		for(i = 0; i < n; i++){
			a[i] = sc.nextInt();
		}
		
		selectionsort(n, a);
	}
	public static void selectionsort(int n, int a[]){
		int count = 0;
		for (int i = 0; i <= n - 1; i++){
			int minj = i;
			for(int j = i; j <= n - 1; j++){
				if(a[j] < a[minj]){
					minj = j;
				}
			}
			if(a[i] != a[minj]) count++;
			int temp = a[i];
			a[i] = a[minj];
			a[minj] = temp;
		}
		for(int i = 0; i < n; i++){
			System.out.print(( i == 0 ? "" : " ") + a[i]);
		}
		
		System.out.printf("\n%d\n", count);
	}
}
