import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String[] str = (br.readLine()).split(" ");
		int[] a = new int[n];
		int cnt = 0;
		for (int i = 0; i < n; i++)
			a[i] = Integer.parseInt(str[i]);
		for (int i = 0; i < n; i++) {
			int minj = i;
			for (int j = i; j < n; j++) {
				if (a[j] < a[minj]) {
					minj = j;
				}
			}
			if (a[i] != a[minj]) {
				int tmp = a[i];
				a[i] = a[minj];
				a[minj] = tmp;
				cnt++;
			}
		}
		for (int i = 0; i < n; i++){
			if(i!=n-1)System.out.print(a[i] + " ");
			else System.out.println(a[i]);
		}
		System.out.println(cnt);
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.*; util.* java public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String[] str = (br.readLine()).split(" ");
		int[] a = new int[n];
		int cnt = 0;
		for (int i = 0; i < n; i++)
			a[i] = Integer.parseInt(str[i]);
		for (int i = 0; i < n; i++) {
			int minj = i;
			for (int j = i; j < n; j++) {
				if (a[j] < a[minj]) {
					minj = j;
				}
			}
			if (a[i] != a[minj]) {
				int tmp = a[i];
				a[i] = a[minj];
				a[minj] = tmp;
				cnt++;
			}
		}
		for (int i = 0; i < n; i++){
			if(i!=n-1)System.out.print(a[i] + " ");
			else System.out.println(a[i]);
		}
		System.out.println(cnt);
	}
} Main public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String[] str = (br.readLine()).split(" ");
		int[] a = new int[n];
		int cnt = 0;
		for (int i = 0; i < n; i++)
			a[i] = Integer.parseInt(str[i]);
		for (int i = 0; i < n; i++) {
			int minj = i;
			for (int j = i; j < n; j++) {
				if (a[j] < a[minj]) {
					minj = j;
				}
			}
			if (a[i] != a[minj]) {
				int tmp = a[i];
				a[i] = a[minj];
				a[minj] = tmp;
				cnt++;
			}
		}
		for (int i = 0; i < n; i++){
			if(i!=n-1)System.out.print(a[i] + " ");
			else System.out.println(a[i]);
		}
		System.out.println(cnt);
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String[] str = (br.readLine()).split(" ");
		int[] a = new int[n];
		int cnt = 0;
		for (int i = 0; i < n; i++)
			a[i] = Integer.parseInt(str[i]);
		for (int i = 0; i < n; i++) {
			int minj = i;
			for (int j = i; j < n; j++) {
				if (a[j] < a[minj]) {
					minj = j;
				}
			}
			if (a[i] != a[minj]) {
				int tmp = a[i];
				a[i] = a[minj];
				a[minj] = tmp;
				cnt++;
			}
		}
		for (int i = 0; i < n; i++){
			if(i!=n-1)System.out.print(a[i] + " ");
			else System.out.println(a[i]);
		}
		System.out.println(cnt);
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int n = Integer.parseInt(br.readLine()); n Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br String[] str = (br.readLine()).split(" "); str (br.readLine()).split(" ") (br.readLine()).split (br.readLine()) br.readLine br " " int[] a = new int[n]; a new int[n] n int cnt = 0; cnt 0 for (int i = 0; i < n; i++)
			a[i] = Integer.parseInt(str[i]); int i = 0; int i = 0; i 0 i < n i n i++ i++ i a[i] = Integer.parseInt(str[i]); a[i] = Integer.parseInt(str[i]) a[i] a i Integer.parseInt(str[i]) Integer.parseInt Integer str[i] str i for (int i = 0; i < n; i++) {
			int minj = i;
			for (int j = i; j < n; j++) {
				if (a[j] < a[minj]) {
					minj = j;
				}
			}
			if (a[i] != a[minj]) {
				int tmp = a[i];
				a[i] = a[minj];
				a[minj] = tmp;
				cnt++;
			}
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			int minj = i;
			for (int j = i; j < n; j++) {
				if (a[j] < a[minj]) {
					minj = j;
				}
			}
			if (a[i] != a[minj]) {
				int tmp = a[i];
				a[i] = a[minj];
				a[minj] = tmp;
				cnt++;
			}
		} {
			int minj = i;
			for (int j = i; j < n; j++) {
				if (a[j] < a[minj]) {
					minj = j;
				}
			}
			if (a[i] != a[minj]) {
				int tmp = a[i];
				a[i] = a[minj];
				a[minj] = tmp;
				cnt++;
			}
		} int minj = i; minj i for (int j = i; j < n; j++) {
				if (a[j] < a[minj]) {
					minj = j;
				}
			} int j = i; int j = i; j i j < n j n 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]) {
				int tmp = a[i];
				a[i] = a[minj];
				a[minj] = tmp;
				cnt++;
			} a[i] != a[minj] a[i] a i a[minj] a minj {
				int tmp = a[i];
				a[i] = a[minj];
				a[minj] = tmp;
				cnt++;
			} 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 cnt++ cnt for (int i = 0; i < n; i++){
			if(i!=n-1)System.out.print(a[i] + " ");
			else System.out.println(a[i]);
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			if(i!=n-1)System.out.print(a[i] + " ");
			else System.out.println(a[i]);
		} {
			if(i!=n-1)System.out.print(a[i] + " ");
			else System.out.println(a[i]);
		} if(i!=n-1)System.out.print(a[i] + " ");
			else System.out.println(a[i]); i!=n-1 i n-1 n 1 System.out.print(a[i] + " ") System.out.print System.out System System.out a[i] + " " a[i] a i " " System.out.println(a[i]) System.out.println System.out System System.out a[i] a i System.out.println(cnt) System.out.println System.out System System.out cnt String[] args args public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String[] str = (br.readLine()).split(" ");
		int[] a = new int[n];
		int cnt = 0;
		for (int i = 0; i < n; i++)
			a[i] = Integer.parseInt(str[i]);
		for (int i = 0; i < n; i++) {
			int minj = i;
			for (int j = i; j < n; j++) {
				if (a[j] < a[minj]) {
					minj = j;
				}
			}
			if (a[i] != a[minj]) {
				int tmp = a[i];
				a[i] = a[minj];
				a[minj] = tmp;
				cnt++;
			}
		}
		for (int i = 0; i < n; i++){
			if(i!=n-1)System.out.print(a[i] + " ");
			else System.out.println(a[i]);
		}
		System.out.println(cnt);
	}
} public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String[] str = (br.readLine()).split(" ");
		int[] a = new int[n];
		int cnt = 0;
		for (int i = 0; i < n; i++)
			a[i] = Integer.parseInt(str[i]);
		for (int i = 0; i < n; i++) {
			int minj = i;
			for (int j = i; j < n; j++) {
				if (a[j] < a[minj]) {
					minj = j;
				}
			}
			if (a[i] != a[minj]) {
				int tmp = a[i];
				a[i] = a[minj];
				a[minj] = tmp;
				cnt++;
			}
		}
		for (int i = 0; i < n; i++){
			if(i!=n-1)System.out.print(a[i] + " ");
			else System.out.println(a[i]);
		}
		System.out.println(cnt);
	}
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String[] str = (br.readLine()).split(" ");
		int[] a = new int[n];
		int cnt = 0;
		for (int i = 0; i < n; i++)
			a[i] = Integer.parseInt(str[i]);
		for (int i = 0; i < n; i++) {
			int minj = i;
			for (int j = i; j < n; j++) {
				if (a[j] < a[minj]) {
					minj = j;
				}
			}
			if (a[i] != a[minj]) {
				int tmp = a[i];
				a[i] = a[minj];
				a[minj] = tmp;
				cnt++;
			}
		}
		for (int i = 0; i < n; i++){
			if(i!=n-1)System.out.print(a[i] + " ");
			else System.out.println(a[i]);
		}
		System.out.println(cnt);
	}
}