import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int n = scn.nextInt();
		int[] num = new int[n];
		for (int i = 0; i < n; i++) {
			num[i] = scn.nextInt();
		}
		int tmp;
		int count = 0;
		for (int i = 0; i < num.length; i++) {
			int minj = i;
			for (int j = i; j < num.length; j++) {
				if (num[j] < num[minj]) {
					minj = j;
				}
			}
			if (num[minj] != num[i]) {
				int temp = num[i];
				num[i] = num[minj];
				num[minj] = temp;
				count++;
			}
		}
		StringBuilder sb = new StringBuilder();
		for (int a = 0; a < num.length - 1; a++) {
			sb.append(num[a] + " ");
		}
		System.out.println(sb.append(num[num.length - 1]).toString());
		System.out.println(count);
	}
}
 import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int n = scn.nextInt();
		int[] num = new int[n];
		for (int i = 0; i < n; i++) {
			num[i] = scn.nextInt();
		}
		int tmp;
		int count = 0;
		for (int i = 0; i < num.length; i++) {
			int minj = i;
			for (int j = i; j < num.length; j++) {
				if (num[j] < num[minj]) {
					minj = j;
				}
			}
			if (num[minj] != num[i]) {
				int temp = num[i];
				num[i] = num[minj];
				num[minj] = temp;
				count++;
			}
		}
		StringBuilder sb = new StringBuilder();
		for (int a = 0; a < num.length - 1; a++) {
			sb.append(num[a] + " ");
		}
		System.out.println(sb.append(num[num.length - 1]).toString());
		System.out.println(count);
	}
} Main public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int n = scn.nextInt();
		int[] num = new int[n];
		for (int i = 0; i < n; i++) {
			num[i] = scn.nextInt();
		}
		int tmp;
		int count = 0;
		for (int i = 0; i < num.length; i++) {
			int minj = i;
			for (int j = i; j < num.length; j++) {
				if (num[j] < num[minj]) {
					minj = j;
				}
			}
			if (num[minj] != num[i]) {
				int temp = num[i];
				num[i] = num[minj];
				num[minj] = temp;
				count++;
			}
		}
		StringBuilder sb = new StringBuilder();
		for (int a = 0; a < num.length - 1; a++) {
			sb.append(num[a] + " ");
		}
		System.out.println(sb.append(num[num.length - 1]).toString());
		System.out.println(count);
	} main {
		Scanner scn = new Scanner(System.in);
		int n = scn.nextInt();
		int[] num = new int[n];
		for (int i = 0; i < n; i++) {
			num[i] = scn.nextInt();
		}
		int tmp;
		int count = 0;
		for (int i = 0; i < num.length; i++) {
			int minj = i;
			for (int j = i; j < num.length; j++) {
				if (num[j] < num[minj]) {
					minj = j;
				}
			}
			if (num[minj] != num[i]) {
				int temp = num[i];
				num[i] = num[minj];
				num[minj] = temp;
				count++;
			}
		}
		StringBuilder sb = new StringBuilder();
		for (int a = 0; a < num.length - 1; a++) {
			sb.append(num[a] + " ");
		}
		System.out.println(sb.append(num[num.length - 1]).toString());
		System.out.println(count);
	} Scanner scn = new Scanner(System.in); scn new Scanner(System.in) int n = scn.nextInt(); n scn.nextInt() scn.nextInt scn int[] num = new int[n]; num new int[n] n for (int i = 0; i < n; i++) {
			num[i] = scn.nextInt();
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			num[i] = scn.nextInt();
		} {
			num[i] = scn.nextInt();
		} num[i] = scn.nextInt() num[i] num i scn.nextInt() scn.nextInt scn int tmp; tmp int count = 0; count 0 for (int i = 0; i < num.length; i++) {
			int minj = i;
			for (int j = i; j < num.length; j++) {
				if (num[j] < num[minj]) {
					minj = j;
				}
			}
			if (num[minj] != num[i]) {
				int temp = num[i];
				num[i] = num[minj];
				num[minj] = temp;
				count++;
			}
		} int i = 0; int i = 0; i 0 i < num.length i num.length num num.length i++ i++ i {
			int minj = i;
			for (int j = i; j < num.length; j++) {
				if (num[j] < num[minj]) {
					minj = j;
				}
			}
			if (num[minj] != num[i]) {
				int temp = num[i];
				num[i] = num[minj];
				num[minj] = temp;
				count++;
			}
		} {
			int minj = i;
			for (int j = i; j < num.length; j++) {
				if (num[j] < num[minj]) {
					minj = j;
				}
			}
			if (num[minj] != num[i]) {
				int temp = num[i];
				num[i] = num[minj];
				num[minj] = temp;
				count++;
			}
		} int minj = i; minj i for (int j = i; j < num.length; j++) {
				if (num[j] < num[minj]) {
					minj = j;
				}
			} int j = i; int j = i; j i j < num.length j num.length num num.length j++ j++ j {
				if (num[j] < num[minj]) {
					minj = j;
				}
			} {
				if (num[j] < num[minj]) {
					minj = j;
				}
			} if (num[j] < num[minj]) {
					minj = j;
				} num[j] < num[minj] num[j] num j num[minj] num minj {
					minj = j;
				} minj = j minj j if (num[minj] != num[i]) {
				int temp = num[i];
				num[i] = num[minj];
				num[minj] = temp;
				count++;
			} num[minj] != num[i] num[minj] num minj num[i] num i {
				int temp = num[i];
				num[i] = num[minj];
				num[minj] = temp;
				count++;
			} int temp = num[i]; temp num[i] num i num[i] = num[minj] num[i] num i num[minj] num minj num[minj] = temp num[minj] num minj temp count++ count StringBuilder sb = new StringBuilder(); sb new StringBuilder() for (int a = 0; a < num.length - 1; a++) {
			sb.append(num[a] + " ");
		} int a = 0; int a = 0; a 0 a < num.length - 1 a num.length - 1 num.length num num.length 1 a++ a++ a {
			sb.append(num[a] + " ");
		} {
			sb.append(num[a] + " ");
		} sb.append(num[a] + " ") sb.append sb num[a] + " " num[a] num a " " System.out.println(sb.append(num[num.length - 1]).toString()) System.out.println System.out System System.out sb.append(num[num.length - 1]).toString() sb.append(num[num.length - 1]).toString sb.append(num[num.length - 1]) sb.append sb num[num.length - 1] num num.length - 1 num.length num num.length 1 System.out.println(count) System.out.println System.out System System.out count String[] args args public class Main {
	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int n = scn.nextInt();
		int[] num = new int[n];
		for (int i = 0; i < n; i++) {
			num[i] = scn.nextInt();
		}
		int tmp;
		int count = 0;
		for (int i = 0; i < num.length; i++) {
			int minj = i;
			for (int j = i; j < num.length; j++) {
				if (num[j] < num[minj]) {
					minj = j;
				}
			}
			if (num[minj] != num[i]) {
				int temp = num[i];
				num[i] = num[minj];
				num[minj] = temp;
				count++;
			}
		}
		StringBuilder sb = new StringBuilder();
		for (int a = 0; a < num.length - 1; a++) {
			sb.append(num[a] + " ");
		}
		System.out.println(sb.append(num[num.length - 1]).toString());
		System.out.println(count);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int n = scn.nextInt();
		int[] num = new int[n];
		for (int i = 0; i < n; i++) {
			num[i] = scn.nextInt();
		}
		int tmp;
		int count = 0;
		for (int i = 0; i < num.length; i++) {
			int minj = i;
			for (int j = i; j < num.length; j++) {
				if (num[j] < num[minj]) {
					minj = j;
				}
			}
			if (num[minj] != num[i]) {
				int temp = num[i];
				num[i] = num[minj];
				num[minj] = temp;
				count++;
			}
		}
		StringBuilder sb = new StringBuilder();
		for (int a = 0; a < num.length - 1; a++) {
			sb.append(num[a] + " ");
		}
		System.out.println(sb.append(num[num.length - 1]).toString());
		System.out.println(count);
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int n = scn.nextInt();
		int[] num = new int[n];
		for (int i = 0; i < n; i++) {
			num[i] = scn.nextInt();
		}
		int tmp;
		int count = 0;
		for (int i = 0; i < num.length; i++) {
			int minj = i;
			for (int j = i; j < num.length; j++) {
				if (num[j] < num[minj]) {
					minj = j;
				}
			}
			if (num[minj] != num[i]) {
				int temp = num[i];
				num[i] = num[minj];
				num[minj] = temp;
				count++;
			}
		}
		StringBuilder sb = new StringBuilder();
		for (int a = 0; a < num.length - 1; a++) {
			sb.append(num[a] + " ");
		}
		System.out.println(sb.append(num[num.length - 1]).toString());
		System.out.println(count);
	}
}

