import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		sc.useDelimiter(System.getProperty("line.separator"));
        int n = sc.nextInt();
        String data = sc.next();

        //String???Int????????????
        String[] datas = data.split(" ");
        int[] A = new int[n];
        for (int i = 0; i < A.length; i++) {
			A[i] = Integer.parseInt(datas[i]);
		}

    	selectionSort(A);
	}



	private static void selectionSort(int[] A) {
		int cnt =0;
		for (int i = 0; i < A.length-1; i++) {
			//????°???????????´?????????????
			int minj =i;
			for(int j=i; j<A.length; j++){
				if(A[j] <  A[minj]){
					//????°?????´????????´?????????´??°
					minj = j;
				}
			}
			int tmp = A[i];
			A[i] = A[minj];
			A[minj] = tmp;
			if(i!=minj)cnt++;
		}
		disp(A);
		System.out.println(cnt);
	}



	private static void disp(int[] a) {
		for (int i = 0; i < a.length; i++) {
			System.out.print(a[i]);
			if(i!=a.length-1)System.out.print(" ");
		}
		System.out.println();
	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		sc.useDelimiter(System.getProperty("line.separator"));
        int n = sc.nextInt();
        String data = sc.next();

        //String???Int????????????
        String[] datas = data.split(" ");
        int[] A = new int[n];
        for (int i = 0; i < A.length; i++) {
			A[i] = Integer.parseInt(datas[i]);
		}

    	selectionSort(A);
	}



	private static void selectionSort(int[] A) {
		int cnt =0;
		for (int i = 0; i < A.length-1; i++) {
			//????°???????????´?????????????
			int minj =i;
			for(int j=i; j<A.length; j++){
				if(A[j] <  A[minj]){
					//????°?????´????????´?????????´??°
					minj = j;
				}
			}
			int tmp = A[i];
			A[i] = A[minj];
			A[minj] = tmp;
			if(i!=minj)cnt++;
		}
		disp(A);
		System.out.println(cnt);
	}



	private static void disp(int[] a) {
		for (int i = 0; i < a.length; i++) {
			System.out.print(a[i]);
			if(i!=a.length-1)System.out.print(" ");
		}
		System.out.println();
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		sc.useDelimiter(System.getProperty("line.separator"));
        int n = sc.nextInt();
        String data = sc.next();

        //String???Int????????????
        String[] datas = data.split(" ");
        int[] A = new int[n];
        for (int i = 0; i < A.length; i++) {
			A[i] = Integer.parseInt(datas[i]);
		}

    	selectionSort(A);
	} main {
		Scanner sc = new Scanner(System.in);
		sc.useDelimiter(System.getProperty("line.separator"));
        int n = sc.nextInt();
        String data = sc.next();

        //String???Int????????????
        String[] datas = data.split(" ");
        int[] A = new int[n];
        for (int i = 0; i < A.length; i++) {
			A[i] = Integer.parseInt(datas[i]);
		}

    	selectionSort(A);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) sc.useDelimiter(System.getProperty("line.separator")) sc.useDelimiter sc System.getProperty("line.separator") System.getProperty System "line.separator" int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc String data = sc.next(); data sc.next() sc.next sc String[] datas = data.split(" "); datas data.split(" ") data.split data " " int[] A = new int[n]; A new int[n] n for (int i = 0; i < A.length; i++) {
			A[i] = Integer.parseInt(datas[i]);
		} int i = 0; int i = 0; i 0 i < A.length i A.length A A.length i++ i++ i {
			A[i] = Integer.parseInt(datas[i]);
		} {
			A[i] = Integer.parseInt(datas[i]);
		} A[i] = Integer.parseInt(datas[i]) A[i] A i Integer.parseInt(datas[i]) Integer.parseInt Integer datas[i] datas i selectionSort(A) selectionSort A String[] args args private static void selectionSort(int[] A) {
		int cnt =0;
		for (int i = 0; i < A.length-1; i++) {
			//????°???????????´?????????????
			int minj =i;
			for(int j=i; j<A.length; j++){
				if(A[j] <  A[minj]){
					//????°?????´????????´?????????´??°
					minj = j;
				}
			}
			int tmp = A[i];
			A[i] = A[minj];
			A[minj] = tmp;
			if(i!=minj)cnt++;
		}
		disp(A);
		System.out.println(cnt);
	} selectionSort {
		int cnt =0;
		for (int i = 0; i < A.length-1; i++) {
			//????°???????????´?????????????
			int minj =i;
			for(int j=i; j<A.length; j++){
				if(A[j] <  A[minj]){
					//????°?????´????????´?????????´??°
					minj = j;
				}
			}
			int tmp = A[i];
			A[i] = A[minj];
			A[minj] = tmp;
			if(i!=minj)cnt++;
		}
		disp(A);
		System.out.println(cnt);
	} int cnt =0; cnt 0 for (int i = 0; i < A.length-1; i++) {
			//????°???????????´?????????????
			int minj =i;
			for(int j=i; j<A.length; j++){
				if(A[j] <  A[minj]){
					//????°?????´????????´?????????´??°
					minj = j;
				}
			}
			int tmp = A[i];
			A[i] = A[minj];
			A[minj] = tmp;
			if(i!=minj)cnt++;
		} int i = 0; int i = 0; i 0 i < A.length-1 i A.length-1 A.length A A.length 1 i++ i++ i {
			//????°???????????´?????????????
			int minj =i;
			for(int j=i; j<A.length; j++){
				if(A[j] <  A[minj]){
					//????°?????´????????´?????????´??°
					minj = j;
				}
			}
			int tmp = A[i];
			A[i] = A[minj];
			A[minj] = tmp;
			if(i!=minj)cnt++;
		} {
			//????°???????????´?????????????
			int minj =i;
			for(int j=i; j<A.length; j++){
				if(A[j] <  A[minj]){
					//????°?????´????????´?????????´??°
					minj = j;
				}
			}
			int tmp = A[i];
			A[i] = A[minj];
			A[minj] = tmp;
			if(i!=minj)cnt++;
		} int minj =i; minj i for(int j=i; j<A.length; j++){
				if(A[j] <  A[minj]){
					//????°?????´????????´?????????´??°
					minj = j;
				}
			} int j=i; int j=i; j i j<A.length j A.length A A.length 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 int tmp = A[i]; tmp A[i] A i A[i] = A[minj] A[i] A i A[minj] A minj A[minj] = tmp A[minj] A minj tmp if(i!=minj)cnt++; i!=minj i minj cnt++ cnt disp(A) disp A System.out.println(cnt) System.out.println System.out System System.out cnt int[] A A private static void disp(int[] a) {
		for (int i = 0; i < a.length; i++) {
			System.out.print(a[i]);
			if(i!=a.length-1)System.out.print(" ");
		}
		System.out.println();
	} disp {
		for (int i = 0; i < a.length; i++) {
			System.out.print(a[i]);
			if(i!=a.length-1)System.out.print(" ");
		}
		System.out.println();
	} for (int i = 0; i < a.length; i++) {
			System.out.print(a[i]);
			if(i!=a.length-1)System.out.print(" ");
		} int i = 0; int i = 0; i 0 i < a.length i a.length a a.length i++ i++ i {
			System.out.print(a[i]);
			if(i!=a.length-1)System.out.print(" ");
		} {
			System.out.print(a[i]);
			if(i!=a.length-1)System.out.print(" ");
		} System.out.print(a[i]) System.out.print System.out System System.out a[i] a i if(i!=a.length-1)System.out.print(" "); i!=a.length-1 i a.length-1 a.length a a.length 1 System.out.print(" ") System.out.print System.out System System.out " " System.out.println() System.out.println System.out System System.out int[] a a public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		sc.useDelimiter(System.getProperty("line.separator"));
        int n = sc.nextInt();
        String data = sc.next();

        //String???Int????????????
        String[] datas = data.split(" ");
        int[] A = new int[n];
        for (int i = 0; i < A.length; i++) {
			A[i] = Integer.parseInt(datas[i]);
		}

    	selectionSort(A);
	}



	private static void selectionSort(int[] A) {
		int cnt =0;
		for (int i = 0; i < A.length-1; i++) {
			//????°???????????´?????????????
			int minj =i;
			for(int j=i; j<A.length; j++){
				if(A[j] <  A[minj]){
					//????°?????´????????´?????????´??°
					minj = j;
				}
			}
			int tmp = A[i];
			A[i] = A[minj];
			A[minj] = tmp;
			if(i!=minj)cnt++;
		}
		disp(A);
		System.out.println(cnt);
	}



	private static void disp(int[] a) {
		for (int i = 0; i < a.length; i++) {
			System.out.print(a[i]);
			if(i!=a.length-1)System.out.print(" ");
		}
		System.out.println();
	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		sc.useDelimiter(System.getProperty("line.separator"));
        int n = sc.nextInt();
        String data = sc.next();

        //String???Int????????????
        String[] datas = data.split(" ");
        int[] A = new int[n];
        for (int i = 0; i < A.length; i++) {
			A[i] = Integer.parseInt(datas[i]);
		}

    	selectionSort(A);
	}



	private static void selectionSort(int[] A) {
		int cnt =0;
		for (int i = 0; i < A.length-1; i++) {
			//????°???????????´?????????????
			int minj =i;
			for(int j=i; j<A.length; j++){
				if(A[j] <  A[minj]){
					//????°?????´????????´?????????´??°
					minj = j;
				}
			}
			int tmp = A[i];
			A[i] = A[minj];
			A[minj] = tmp;
			if(i!=minj)cnt++;
		}
		disp(A);
		System.out.println(cnt);
	}



	private static void disp(int[] a) {
		for (int i = 0; i < a.length; i++) {
			System.out.print(a[i]);
			if(i!=a.length-1)System.out.print(" ");
		}
		System.out.println();
	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		sc.useDelimiter(System.getProperty("line.separator"));
        int n = sc.nextInt();
        String data = sc.next();

        //String???Int????????????
        String[] datas = data.split(" ");
        int[] A = new int[n];
        for (int i = 0; i < A.length; i++) {
			A[i] = Integer.parseInt(datas[i]);
		}

    	selectionSort(A);
	}



	private static void selectionSort(int[] A) {
		int cnt =0;
		for (int i = 0; i < A.length-1; i++) {
			//????°???????????´?????????????
			int minj =i;
			for(int j=i; j<A.length; j++){
				if(A[j] <  A[minj]){
					//????°?????´????????´?????????´??°
					minj = j;
				}
			}
			int tmp = A[i];
			A[i] = A[minj];
			A[minj] = tmp;
			if(i!=minj)cnt++;
		}
		disp(A);
		System.out.println(cnt);
	}



	private static void disp(int[] a) {
		for (int i = 0; i < a.length; i++) {
			System.out.print(a[i]);
			if(i!=a.length-1)System.out.print(" ");
		}
		System.out.println();
	}

}