import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n ;
		int countOfExc = 0;
		n = in.nextInt();
		int[] a = new int[n];
		for(int i = 0;i<n;i++){
			a[i] = in.nextInt();
		}
		for(int i = 0;i<n-1;i++){
			int min = i;
			for(int j = i+1;j<n;j++){
				if(a[min]>a[j]){
					min = j;
				}
			}
			int temp = a[i];
			a[i] = a[min];
			a[min] = temp;
			if(min > i) countOfExc++;
		}

		for(int i = 0;i<n;i++){
			if(i>0)System.out.print(" ");
			System.out.print(a[i]);
		}
		System.out.println("");
		System.out.println(countOfExc);
	}
} import java.util.Scanner; Scanner java.util public class Main{
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n ;
		int countOfExc = 0;
		n = in.nextInt();
		int[] a = new int[n];
		for(int i = 0;i<n;i++){
			a[i] = in.nextInt();
		}
		for(int i = 0;i<n-1;i++){
			int min = i;
			for(int j = i+1;j<n;j++){
				if(a[min]>a[j]){
					min = j;
				}
			}
			int temp = a[i];
			a[i] = a[min];
			a[min] = temp;
			if(min > i) countOfExc++;
		}

		for(int i = 0;i<n;i++){
			if(i>0)System.out.print(" ");
			System.out.print(a[i]);
		}
		System.out.println("");
		System.out.println(countOfExc);
	}
} Main public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n ;
		int countOfExc = 0;
		n = in.nextInt();
		int[] a = new int[n];
		for(int i = 0;i<n;i++){
			a[i] = in.nextInt();
		}
		for(int i = 0;i<n-1;i++){
			int min = i;
			for(int j = i+1;j<n;j++){
				if(a[min]>a[j]){
					min = j;
				}
			}
			int temp = a[i];
			a[i] = a[min];
			a[min] = temp;
			if(min > i) countOfExc++;
		}

		for(int i = 0;i<n;i++){
			if(i>0)System.out.print(" ");
			System.out.print(a[i]);
		}
		System.out.println("");
		System.out.println(countOfExc);
	} main {
		Scanner in = new Scanner(System.in);
		int n ;
		int countOfExc = 0;
		n = in.nextInt();
		int[] a = new int[n];
		for(int i = 0;i<n;i++){
			a[i] = in.nextInt();
		}
		for(int i = 0;i<n-1;i++){
			int min = i;
			for(int j = i+1;j<n;j++){
				if(a[min]>a[j]){
					min = j;
				}
			}
			int temp = a[i];
			a[i] = a[min];
			a[min] = temp;
			if(min > i) countOfExc++;
		}

		for(int i = 0;i<n;i++){
			if(i>0)System.out.print(" ");
			System.out.print(a[i]);
		}
		System.out.println("");
		System.out.println(countOfExc);
	} Scanner in = new Scanner(System.in); in new Scanner(System.in) int n ; n int countOfExc = 0; countOfExc 0 n = in.nextInt() n in.nextInt() in.nextInt in int[] a = new int[n]; a new int[n] n for(int i = 0;i<n;i++){
			a[i] = in.nextInt();
		} int i = 0; int i = 0; i 0 i<n i n i++ i++ i {
			a[i] = in.nextInt();
		} {
			a[i] = in.nextInt();
		} a[i] = in.nextInt() a[i] a i in.nextInt() in.nextInt in for(int i = 0;i<n-1;i++){
			int min = i;
			for(int j = i+1;j<n;j++){
				if(a[min]>a[j]){
					min = j;
				}
			}
			int temp = a[i];
			a[i] = a[min];
			a[min] = temp;
			if(min > i) countOfExc++;
		} int i = 0; int i = 0; i 0 i<n-1 i n-1 n 1 i++ i++ i {
			int min = i;
			for(int j = i+1;j<n;j++){
				if(a[min]>a[j]){
					min = j;
				}
			}
			int temp = a[i];
			a[i] = a[min];
			a[min] = temp;
			if(min > i) countOfExc++;
		} {
			int min = i;
			for(int j = i+1;j<n;j++){
				if(a[min]>a[j]){
					min = j;
				}
			}
			int temp = a[i];
			a[i] = a[min];
			a[min] = temp;
			if(min > i) countOfExc++;
		} int min = i; min i for(int j = i+1;j<n;j++){
				if(a[min]>a[j]){
					min = j;
				}
			} int j = i+1; int j = i+1; j i+1 i 1 j<n j n j++ j++ j {
				if(a[min]>a[j]){
					min = j;
				}
			} {
				if(a[min]>a[j]){
					min = j;
				}
			} if(a[min]>a[j]){
					min = j;
				} a[min]>a[j] a[min] a min a[j] a j {
					min = j;
				} min = j min j int temp = a[i]; temp a[i] a i a[i] = a[min] a[i] a i a[min] a min a[min] = temp a[min] a min temp if(min > i) countOfExc++; min > i min i countOfExc++ countOfExc for(int i = 0;i<n;i++){
			if(i>0)System.out.print(" ");
			System.out.print(a[i]);
		} int i = 0; int i = 0; i 0 i<n i n i++ i++ i {
			if(i>0)System.out.print(" ");
			System.out.print(a[i]);
		} {
			if(i>0)System.out.print(" ");
			System.out.print(a[i]);
		} if(i>0)System.out.print(" "); i>0 i 0 System.out.print(" ") System.out.print System.out System System.out " " System.out.print(a[i]) System.out.print System.out System System.out a[i] a i System.out.println("") System.out.println System.out System System.out "" System.out.println(countOfExc) System.out.println System.out System System.out countOfExc String[] args args public class Main{
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n ;
		int countOfExc = 0;
		n = in.nextInt();
		int[] a = new int[n];
		for(int i = 0;i<n;i++){
			a[i] = in.nextInt();
		}
		for(int i = 0;i<n-1;i++){
			int min = i;
			for(int j = i+1;j<n;j++){
				if(a[min]>a[j]){
					min = j;
				}
			}
			int temp = a[i];
			a[i] = a[min];
			a[min] = temp;
			if(min > i) countOfExc++;
		}

		for(int i = 0;i<n;i++){
			if(i>0)System.out.print(" ");
			System.out.print(a[i]);
		}
		System.out.println("");
		System.out.println(countOfExc);
	}
} public class Main{
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n ;
		int countOfExc = 0;
		n = in.nextInt();
		int[] a = new int[n];
		for(int i = 0;i<n;i++){
			a[i] = in.nextInt();
		}
		for(int i = 0;i<n-1;i++){
			int min = i;
			for(int j = i+1;j<n;j++){
				if(a[min]>a[j]){
					min = j;
				}
			}
			int temp = a[i];
			a[i] = a[min];
			a[min] = temp;
			if(min > i) countOfExc++;
		}

		for(int i = 0;i<n;i++){
			if(i>0)System.out.print(" ");
			System.out.print(a[i]);
		}
		System.out.println("");
		System.out.println(countOfExc);
	}
} Main
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n ;
		int countOfExc = 0;
		n = in.nextInt();
		int[] a = new int[n];
		for(int i = 0;i<n;i++){
			a[i] = in.nextInt();
		}
		for(int i = 0;i<n-1;i++){
			int min = i;
			for(int j = i+1;j<n;j++){
				if(a[min]>a[j]){
					min = j;
				}
			}
			int temp = a[i];
			a[i] = a[min];
			a[min] = temp;
			if(min > i) countOfExc++;
		}

		for(int i = 0;i<n;i++){
			if(i>0)System.out.print(" ");
			System.out.print(a[i]);
		}
		System.out.println("");
		System.out.println(countOfExc);
	}
}