import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {
	static BufferedReader br = new BufferedReader(new InputStreamReader(
			System.in));
	static StringBuilder out = new StringBuilder();

	public static void main(String[] args) throws IOException {
		int n = Integer.parseInt(br.readLine());
		int[] A = new int[n];
		String[] in = br.readLine().split(" ");
		for (int i = 0; i < n; i++)
			A[i] = Integer.parseInt(in[i]);
		int   sw = 0;

	        int t, 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(i!=min) {
	                t = A[i];
	                A[i] = A[min];
	                A[min] = t;
	                ++sw;
	            }
	        }
		for (int k = 0; k < n; k++) {
			if (k > 0)
				System.out.print(" ");
			System.out.print(A[k]);
		}
		System.out.print("\n");
		System.out.println(sw);
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io class Main {
	static BufferedReader br = new BufferedReader(new InputStreamReader(
			System.in));
	static StringBuilder out = new StringBuilder();

	public static void main(String[] args) throws IOException {
		int n = Integer.parseInt(br.readLine());
		int[] A = new int[n];
		String[] in = br.readLine().split(" ");
		for (int i = 0; i < n; i++)
			A[i] = Integer.parseInt(in[i]);
		int   sw = 0;

	        int t, 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(i!=min) {
	                t = A[i];
	                A[i] = A[min];
	                A[min] = t;
	                ++sw;
	            }
	        }
		for (int k = 0; k < n; k++) {
			if (k > 0)
				System.out.print(" ");
			System.out.print(A[k]);
		}
		System.out.print("\n");
		System.out.println(sw);
	}
} Main static BufferedReader br = new BufferedReader(new InputStreamReader(
			System.in)); br new BufferedReader(new InputStreamReader(
			System.in)) static StringBuilder out = new StringBuilder(); out new StringBuilder() public static void main(String[] args) throws IOException {
		int n = Integer.parseInt(br.readLine());
		int[] A = new int[n];
		String[] in = br.readLine().split(" ");
		for (int i = 0; i < n; i++)
			A[i] = Integer.parseInt(in[i]);
		int   sw = 0;

	        int t, 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(i!=min) {
	                t = A[i];
	                A[i] = A[min];
	                A[min] = t;
	                ++sw;
	            }
	        }
		for (int k = 0; k < n; k++) {
			if (k > 0)
				System.out.print(" ");
			System.out.print(A[k]);
		}
		System.out.print("\n");
		System.out.println(sw);
	} main {
		int n = Integer.parseInt(br.readLine());
		int[] A = new int[n];
		String[] in = br.readLine().split(" ");
		for (int i = 0; i < n; i++)
			A[i] = Integer.parseInt(in[i]);
		int   sw = 0;

	        int t, 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(i!=min) {
	                t = A[i];
	                A[i] = A[min];
	                A[min] = t;
	                ++sw;
	            }
	        }
		for (int k = 0; k < n; k++) {
			if (k > 0)
				System.out.print(" ");
			System.out.print(A[k]);
		}
		System.out.print("\n");
		System.out.println(sw);
	} int n = Integer.parseInt(br.readLine()); n Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br int[] A = new int[n]; A new int[n] n String[] in = br.readLine().split(" "); in br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " for (int i = 0; i < n; i++)
			A[i] = Integer.parseInt(in[i]); int i = 0; int i = 0; i 0 i < n i n i++ i++ i A[i] = Integer.parseInt(in[i]); A[i] = Integer.parseInt(in[i]) A[i] A i Integer.parseInt(in[i]) Integer.parseInt Integer in[i] in i int   sw = 0; sw 0 int t t 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(i!=min) {
	                t = A[i];
	                A[i] = A[min];
	                A[min] = t;
	                ++sw;
	            }
	        } 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(i!=min) {
	                t = A[i];
	                A[i] = A[min];
	                A[min] = t;
	                ++sw;
	            }
	        } {
	            min=i;
	            for(int j=i; j<n; ++j) {
	                if(A[j]<A[min])  min = j;
	            }
	            if(i!=min) {
	                t = A[i];
	                A[i] = A[min];
	                A[min] = t;
	                ++sw;
	            }
	        } 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 if(i!=min) {
	                t = A[i];
	                A[i] = A[min];
	                A[min] = t;
	                ++sw;
	            } i!=min i min {
	                t = A[i];
	                A[i] = A[min];
	                A[min] = t;
	                ++sw;
	            } t = A[i] t A[i] A i A[i] = A[min] A[i] A i A[min] A min A[min] = t A[min] A min t ++sw sw for (int k = 0; k < n; k++) {
			if (k > 0)
				System.out.print(" ");
			System.out.print(A[k]);
		} int k = 0; int k = 0; k 0 k < n k n k++ k++ k {
			if (k > 0)
				System.out.print(" ");
			System.out.print(A[k]);
		} {
			if (k > 0)
				System.out.print(" ");
			System.out.print(A[k]);
		} if (k > 0)
				System.out.print(" "); k > 0 k 0 System.out.print(" ") System.out.print System.out System System.out " " System.out.print(A[k]) System.out.print System.out System System.out A[k] A k System.out.print("\n") System.out.print System.out System System.out "\n" System.out.println(sw) System.out.println System.out System System.out sw String[] args args
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {
	static BufferedReader br = new BufferedReader(new InputStreamReader(
			System.in));
	static StringBuilder out = new StringBuilder();

	public static void main(String[] args) throws IOException {
		int n = Integer.parseInt(br.readLine());
		int[] A = new int[n];
		String[] in = br.readLine().split(" ");
		for (int i = 0; i < n; i++)
			A[i] = Integer.parseInt(in[i]);
		int   sw = 0;

	        int t, 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(i!=min) {
	                t = A[i];
	                A[i] = A[min];
	                A[min] = t;
	                ++sw;
	            }
	        }
		for (int k = 0; k < n; k++) {
			if (k > 0)
				System.out.print(" ");
			System.out.print(A[k]);
		}
		System.out.print("\n");
		System.out.println(sw);
	}
}