import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] array = new int[n];

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

        selectionSort(array);

	}

	static void selectionSort(int[] array) {

        int count = 0;
		for(int i = 0; i < array.length; i++) {

			int minj = i;
			for(int j = i; j < array.length; j++) {

				if(array[j] < array[minj]) {
					minj = j;
				}
			}

			if(i != minj) {
				int temp = array[i];
				array[i] = array[minj];
				array[minj] = temp;
				count++;
			}
		}

		printArray(array);
		System.out.println(count);
	}

	static void printArray(int[] array) {

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

		System.out.println(array[array.length - 1]);
	}
}
 import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] array = new int[n];

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

        selectionSort(array);

	}

	static void selectionSort(int[] array) {

        int count = 0;
		for(int i = 0; i < array.length; i++) {

			int minj = i;
			for(int j = i; j < array.length; j++) {

				if(array[j] < array[minj]) {
					minj = j;
				}
			}

			if(i != minj) {
				int temp = array[i];
				array[i] = array[minj];
				array[minj] = temp;
				count++;
			}
		}

		printArray(array);
		System.out.println(count);
	}

	static void printArray(int[] array) {

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

		System.out.println(array[array.length - 1]);
	}
} Main public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] array = new int[n];

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

        selectionSort(array);

	} main {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] array = new int[n];

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

        selectionSort(array);

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] array = new int[n]; array new int[n] n for(int i = 0; i < n; i++) {
        	array[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
        	array[i] = sc.nextInt();
        } {
        	array[i] = sc.nextInt();
        } array[i] = sc.nextInt() array[i] array i sc.nextInt() sc.nextInt sc selectionSort(array) selectionSort array String[] args args static void selectionSort(int[] array) {

        int count = 0;
		for(int i = 0; i < array.length; i++) {

			int minj = i;
			for(int j = i; j < array.length; j++) {

				if(array[j] < array[minj]) {
					minj = j;
				}
			}

			if(i != minj) {
				int temp = array[i];
				array[i] = array[minj];
				array[minj] = temp;
				count++;
			}
		}

		printArray(array);
		System.out.println(count);
	} selectionSort {

        int count = 0;
		for(int i = 0; i < array.length; i++) {

			int minj = i;
			for(int j = i; j < array.length; j++) {

				if(array[j] < array[minj]) {
					minj = j;
				}
			}

			if(i != minj) {
				int temp = array[i];
				array[i] = array[minj];
				array[minj] = temp;
				count++;
			}
		}

		printArray(array);
		System.out.println(count);
	} int count = 0; count 0 for(int i = 0; i < array.length; i++) {

			int minj = i;
			for(int j = i; j < array.length; j++) {

				if(array[j] < array[minj]) {
					minj = j;
				}
			}

			if(i != minj) {
				int temp = array[i];
				array[i] = array[minj];
				array[minj] = temp;
				count++;
			}
		} int i = 0; int i = 0; i 0 i < array.length i array.length array array.length i++ i++ i {

			int minj = i;
			for(int j = i; j < array.length; j++) {

				if(array[j] < array[minj]) {
					minj = j;
				}
			}

			if(i != minj) {
				int temp = array[i];
				array[i] = array[minj];
				array[minj] = temp;
				count++;
			}
		} {

			int minj = i;
			for(int j = i; j < array.length; j++) {

				if(array[j] < array[minj]) {
					minj = j;
				}
			}

			if(i != minj) {
				int temp = array[i];
				array[i] = array[minj];
				array[minj] = temp;
				count++;
			}
		} int minj = i; minj i for(int j = i; j < array.length; j++) {

				if(array[j] < array[minj]) {
					minj = j;
				}
			} int j = i; int j = i; j i j < array.length j array.length array array.length j++ j++ j {

				if(array[j] < array[minj]) {
					minj = j;
				}
			} {

				if(array[j] < array[minj]) {
					minj = j;
				}
			} if(array[j] < array[minj]) {
					minj = j;
				} array[j] < array[minj] array[j] array j array[minj] array minj {
					minj = j;
				} minj = j minj j if(i != minj) {
				int temp = array[i];
				array[i] = array[minj];
				array[minj] = temp;
				count++;
			} i != minj i minj {
				int temp = array[i];
				array[i] = array[minj];
				array[minj] = temp;
				count++;
			} int temp = array[i]; temp array[i] array i array[i] = array[minj] array[i] array i array[minj] array minj array[minj] = temp array[minj] array minj temp count++ count printArray(array) printArray array System.out.println(count) System.out.println System.out System System.out count int[] array array static void printArray(int[] array) {

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

		System.out.println(array[array.length - 1]);
	} printArray {

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

		System.out.println(array[array.length - 1]);
	} for(int i = 0; i < array.length - 1; i++) {
			System.out.print(array[i] + " ");
		} int i = 0; int i = 0; i 0 i < array.length - 1 i array.length - 1 array.length array array.length 1 i++ i++ i {
			System.out.print(array[i] + " ");
		} {
			System.out.print(array[i] + " ");
		} System.out.print(array[i] + " ") System.out.print System.out System System.out array[i] + " " array[i] array i " " System.out.println(array[array.length - 1]) System.out.println System.out System System.out array[array.length - 1] array array.length - 1 array.length array array.length 1 int[] array array public class Main {

	public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] array = new int[n];

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

        selectionSort(array);

	}

	static void selectionSort(int[] array) {

        int count = 0;
		for(int i = 0; i < array.length; i++) {

			int minj = i;
			for(int j = i; j < array.length; j++) {

				if(array[j] < array[minj]) {
					minj = j;
				}
			}

			if(i != minj) {
				int temp = array[i];
				array[i] = array[minj];
				array[minj] = temp;
				count++;
			}
		}

		printArray(array);
		System.out.println(count);
	}

	static void printArray(int[] array) {

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

		System.out.println(array[array.length - 1]);
	}
} public class Main {

	public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] array = new int[n];

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

        selectionSort(array);

	}

	static void selectionSort(int[] array) {

        int count = 0;
		for(int i = 0; i < array.length; i++) {

			int minj = i;
			for(int j = i; j < array.length; j++) {

				if(array[j] < array[minj]) {
					minj = j;
				}
			}

			if(i != minj) {
				int temp = array[i];
				array[i] = array[minj];
				array[minj] = temp;
				count++;
			}
		}

		printArray(array);
		System.out.println(count);
	}

	static void printArray(int[] array) {

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

		System.out.println(array[array.length - 1]);
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] array = new int[n];

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

        selectionSort(array);

	}

	static void selectionSort(int[] array) {

        int count = 0;
		for(int i = 0; i < array.length; i++) {

			int minj = i;
			for(int j = i; j < array.length; j++) {

				if(array[j] < array[minj]) {
					minj = j;
				}
			}

			if(i != minj) {
				int temp = array[i];
				array[i] = array[minj];
				array[minj] = temp;
				count++;
			}
		}

		printArray(array);
		System.out.println(count);
	}

	static void printArray(int[] array) {

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

		System.out.println(array[array.length - 1]);
	}
}

