import java.util.Scanner;

public class Main {

	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int n = sc.nextInt();
		int[] A = inpNum(n);

		selectionSort(A);
		sc.close();

	}

	private static void selectionSort(int[] A) {
		int cnt = 0;

		for (int i = 0; i < A.length - 1; i++ ) {
			int mini = i;
			for (int j = i + 1; j < A.length; j++ ) {

				if ( A[j] < A[mini] ) {
					mini = j;
				}
			}

				if (mini != i) {
					int tmp = A[i];
					A[i] = A[mini];
					A[mini] = tmp;
					cnt++;
				}
		}

		for (int k = 0; k < A.length; k++ ) {
			System.out.print(A[k]);
			if(k < A.length -1) {
				System.out.print(" ");
			}

		}
		System.out.println();
		System.out.println(cnt);

	}

	private static int[] inpNum(int n) {
		int[] nums = new int[n];

		for (int i = 0; i < n; i++) {
			nums[i] = sc.nextInt();
		}
		return nums;
	}

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

	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int n = sc.nextInt();
		int[] A = inpNum(n);

		selectionSort(A);
		sc.close();

	}

	private static void selectionSort(int[] A) {
		int cnt = 0;

		for (int i = 0; i < A.length - 1; i++ ) {
			int mini = i;
			for (int j = i + 1; j < A.length; j++ ) {

				if ( A[j] < A[mini] ) {
					mini = j;
				}
			}

				if (mini != i) {
					int tmp = A[i];
					A[i] = A[mini];
					A[mini] = tmp;
					cnt++;
				}
		}

		for (int k = 0; k < A.length; k++ ) {
			System.out.print(A[k]);
			if(k < A.length -1) {
				System.out.print(" ");
			}

		}
		System.out.println();
		System.out.println(cnt);

	}

	private static int[] inpNum(int n) {
		int[] nums = new int[n];

		for (int i = 0; i < n; i++) {
			nums[i] = sc.nextInt();
		}
		return nums;
	}

} Main static Scanner sc = new Scanner(System.in); sc new Scanner(System.in) public static void main(String[] args) {
		int n = sc.nextInt();
		int[] A = inpNum(n);

		selectionSort(A);
		sc.close();

	} main {
		int n = sc.nextInt();
		int[] A = inpNum(n);

		selectionSort(A);
		sc.close();

	} int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] A = inpNum(n); A inpNum(n) inpNum n selectionSort(A) selectionSort A sc.close() sc.close sc String[] args args private static void selectionSort(int[] A) {
		int cnt = 0;

		for (int i = 0; i < A.length - 1; i++ ) {
			int mini = i;
			for (int j = i + 1; j < A.length; j++ ) {

				if ( A[j] < A[mini] ) {
					mini = j;
				}
			}

				if (mini != i) {
					int tmp = A[i];
					A[i] = A[mini];
					A[mini] = tmp;
					cnt++;
				}
		}

		for (int k = 0; k < A.length; k++ ) {
			System.out.print(A[k]);
			if(k < A.length -1) {
				System.out.print(" ");
			}

		}
		System.out.println();
		System.out.println(cnt);

	} selectionSort {
		int cnt = 0;

		for (int i = 0; i < A.length - 1; i++ ) {
			int mini = i;
			for (int j = i + 1; j < A.length; j++ ) {

				if ( A[j] < A[mini] ) {
					mini = j;
				}
			}

				if (mini != i) {
					int tmp = A[i];
					A[i] = A[mini];
					A[mini] = tmp;
					cnt++;
				}
		}

		for (int k = 0; k < A.length; k++ ) {
			System.out.print(A[k]);
			if(k < A.length -1) {
				System.out.print(" ");
			}

		}
		System.out.println();
		System.out.println(cnt);

	} int cnt = 0; cnt 0 for (int i = 0; i < A.length - 1; i++ ) {
			int mini = i;
			for (int j = i + 1; j < A.length; j++ ) {

				if ( A[j] < A[mini] ) {
					mini = j;
				}
			}

				if (mini != i) {
					int tmp = A[i];
					A[i] = A[mini];
					A[mini] = tmp;
					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 mini = i;
			for (int j = i + 1; j < A.length; j++ ) {

				if ( A[j] < A[mini] ) {
					mini = j;
				}
			}

				if (mini != i) {
					int tmp = A[i];
					A[i] = A[mini];
					A[mini] = tmp;
					cnt++;
				}
		} {
			int mini = i;
			for (int j = i + 1; j < A.length; j++ ) {

				if ( A[j] < A[mini] ) {
					mini = j;
				}
			}

				if (mini != i) {
					int tmp = A[i];
					A[i] = A[mini];
					A[mini] = tmp;
					cnt++;
				}
		} int mini = i; mini i for (int j = i + 1; j < A.length; j++ ) {

				if ( A[j] < A[mini] ) {
					mini = j;
				}
			} int j = i + 1; int j = i + 1; j i + 1 i 1 j < A.length j A.length A A.length j++ j++ j {

				if ( A[j] < A[mini] ) {
					mini = j;
				}
			} {

				if ( A[j] < A[mini] ) {
					mini = j;
				}
			} if ( A[j] < A[mini] ) {
					mini = j;
				} A[j] < A[mini] A[j] A j A[mini] A mini {
					mini = j;
				} mini = j mini j if (mini != i) {
					int tmp = A[i];
					A[i] = A[mini];
					A[mini] = tmp;
					cnt++;
				} mini != i mini i {
					int tmp = A[i];
					A[i] = A[mini];
					A[mini] = tmp;
					cnt++;
				} int tmp = A[i]; tmp A[i] A i A[i] = A[mini] A[i] A i A[mini] A mini A[mini] = tmp A[mini] A mini tmp cnt++ cnt for (int k = 0; k < A.length; k++ ) {
			System.out.print(A[k]);
			if(k < A.length -1) {
				System.out.print(" ");
			}

		} int k = 0; int k = 0; k 0 k < A.length k A.length A A.length k++ k++ k {
			System.out.print(A[k]);
			if(k < A.length -1) {
				System.out.print(" ");
			}

		} {
			System.out.print(A[k]);
			if(k < A.length -1) {
				System.out.print(" ");
			}

		} System.out.print(A[k]) System.out.print System.out System System.out A[k] A k if(k < A.length -1) {
				System.out.print(" ");
			} k < A.length -1 k A.length -1 A.length A A.length 1 {
				System.out.print(" ");
			} System.out.print(" ") System.out.print System.out System System.out " " System.out.println() System.out.println System.out System System.out System.out.println(cnt) System.out.println System.out System System.out cnt int[] A A private static int[] inpNum(int n) {
		int[] nums = new int[n];

		for (int i = 0; i < n; i++) {
			nums[i] = sc.nextInt();
		}
		return nums;
	} inpNum {
		int[] nums = new int[n];

		for (int i = 0; i < n; i++) {
			nums[i] = sc.nextInt();
		}
		return nums;
	} int[] nums = new int[n]; nums new int[n] n for (int i = 0; i < n; i++) {
			nums[i] = sc.nextInt();
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			nums[i] = sc.nextInt();
		} {
			nums[i] = sc.nextInt();
		} nums[i] = sc.nextInt() nums[i] nums i sc.nextInt() sc.nextInt sc return nums; nums int n n public class Main {

	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int n = sc.nextInt();
		int[] A = inpNum(n);

		selectionSort(A);
		sc.close();

	}

	private static void selectionSort(int[] A) {
		int cnt = 0;

		for (int i = 0; i < A.length - 1; i++ ) {
			int mini = i;
			for (int j = i + 1; j < A.length; j++ ) {

				if ( A[j] < A[mini] ) {
					mini = j;
				}
			}

				if (mini != i) {
					int tmp = A[i];
					A[i] = A[mini];
					A[mini] = tmp;
					cnt++;
				}
		}

		for (int k = 0; k < A.length; k++ ) {
			System.out.print(A[k]);
			if(k < A.length -1) {
				System.out.print(" ");
			}

		}
		System.out.println();
		System.out.println(cnt);

	}

	private static int[] inpNum(int n) {
		int[] nums = new int[n];

		for (int i = 0; i < n; i++) {
			nums[i] = sc.nextInt();
		}
		return nums;
	}

} public class Main {

	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int n = sc.nextInt();
		int[] A = inpNum(n);

		selectionSort(A);
		sc.close();

	}

	private static void selectionSort(int[] A) {
		int cnt = 0;

		for (int i = 0; i < A.length - 1; i++ ) {
			int mini = i;
			for (int j = i + 1; j < A.length; j++ ) {

				if ( A[j] < A[mini] ) {
					mini = j;
				}
			}

				if (mini != i) {
					int tmp = A[i];
					A[i] = A[mini];
					A[mini] = tmp;
					cnt++;
				}
		}

		for (int k = 0; k < A.length; k++ ) {
			System.out.print(A[k]);
			if(k < A.length -1) {
				System.out.print(" ");
			}

		}
		System.out.println();
		System.out.println(cnt);

	}

	private static int[] inpNum(int n) {
		int[] nums = new int[n];

		for (int i = 0; i < n; i++) {
			nums[i] = sc.nextInt();
		}
		return nums;
	}

} Main
import java.util.Scanner;

public class Main {

	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int n = sc.nextInt();
		int[] A = inpNum(n);

		selectionSort(A);
		sc.close();

	}

	private static void selectionSort(int[] A) {
		int cnt = 0;

		for (int i = 0; i < A.length - 1; i++ ) {
			int mini = i;
			for (int j = i + 1; j < A.length; j++ ) {

				if ( A[j] < A[mini] ) {
					mini = j;
				}
			}

				if (mini != i) {
					int tmp = A[i];
					A[i] = A[mini];
					A[mini] = tmp;
					cnt++;
				}
		}

		for (int k = 0; k < A.length; k++ ) {
			System.out.print(A[k]);
			if(k < A.length -1) {
				System.out.print(" ");
			}

		}
		System.out.println();
		System.out.println(cnt);

	}

	private static int[] inpNum(int n) {
		int[] nums = new int[n];

		for (int i = 0; i < n; i++) {
			nums[i] = sc.nextInt();
		}
		return nums;
	}

}
