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

class Main{

	static int COUNT = 0;

	public static void main(String[] args) throws IOException{

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		int[] a = new int[n];
		String[] input = br.readLine().split(" ");

		for(int i = 0; i < n; i++){
			a[i] = Integer.parseInt(input[i]);
		}

		a = selectionSort(a, n);

		for(int i = 0; i < n; i++){
			
			System.out.print(a[i]);

			if(i != (n - 1)){
				System.out.print(" ");
			}else{
				System.out.print("\n");
			}

		}

		System.out.println(COUNT);

	}

	static int[] selectionSort(int[] a, int n){

		for(int i = 0; i < (n - 1); i++){

			int min = i;

			for(int j = (i + 1); j < n; j++){

				if(a[j] < a[min]){
					min = j;
				}

			}

			if(min != i){
				COUNT++;
			}

			int temp = a[min];
			a[min] = a[i];
			a[i] = temp;

		}

		return a;

	}

} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.IOException; IOException java.io class Main{

	static int COUNT = 0;

	public static void main(String[] args) throws IOException{

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		int[] a = new int[n];
		String[] input = br.readLine().split(" ");

		for(int i = 0; i < n; i++){
			a[i] = Integer.parseInt(input[i]);
		}

		a = selectionSort(a, n);

		for(int i = 0; i < n; i++){
			
			System.out.print(a[i]);

			if(i != (n - 1)){
				System.out.print(" ");
			}else{
				System.out.print("\n");
			}

		}

		System.out.println(COUNT);

	}

	static int[] selectionSort(int[] a, int n){

		for(int i = 0; i < (n - 1); i++){

			int min = i;

			for(int j = (i + 1); j < n; j++){

				if(a[j] < a[min]){
					min = j;
				}

			}

			if(min != i){
				COUNT++;
			}

			int temp = a[min];
			a[min] = a[i];
			a[i] = temp;

		}

		return a;

	}

} Main static int COUNT = 0; COUNT 0 public static void main(String[] args) throws IOException{

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		int[] a = new int[n];
		String[] input = br.readLine().split(" ");

		for(int i = 0; i < n; i++){
			a[i] = Integer.parseInt(input[i]);
		}

		a = selectionSort(a, n);

		for(int i = 0; i < n; i++){
			
			System.out.print(a[i]);

			if(i != (n - 1)){
				System.out.print(" ");
			}else{
				System.out.print("\n");
			}

		}

		System.out.println(COUNT);

	} main {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		int[] a = new int[n];
		String[] input = br.readLine().split(" ");

		for(int i = 0; i < n; i++){
			a[i] = Integer.parseInt(input[i]);
		}

		a = selectionSort(a, n);

		for(int i = 0; i < n; i++){
			
			System.out.print(a[i]);

			if(i != (n - 1)){
				System.out.print(" ");
			}else{
				System.out.print("\n");
			}

		}

		System.out.println(COUNT);

	} 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 int[] a = new int[n]; a new int[n] n String[] input = br.readLine().split(" "); input br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " for(int i = 0; i < n; i++){
			a[i] = Integer.parseInt(input[i]);
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			a[i] = Integer.parseInt(input[i]);
		} {
			a[i] = Integer.parseInt(input[i]);
		} a[i] = Integer.parseInt(input[i]) a[i] a i Integer.parseInt(input[i]) Integer.parseInt Integer input[i] input i a = selectionSort(a, n) a selectionSort(a, n) selectionSort a n for(int i = 0; i < n; i++){
			
			System.out.print(a[i]);

			if(i != (n - 1)){
				System.out.print(" ");
			}else{
				System.out.print("\n");
			}

		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			
			System.out.print(a[i]);

			if(i != (n - 1)){
				System.out.print(" ");
			}else{
				System.out.print("\n");
			}

		} {
			
			System.out.print(a[i]);

			if(i != (n - 1)){
				System.out.print(" ");
			}else{
				System.out.print("\n");
			}

		} System.out.print(a[i]) System.out.print System.out System System.out a[i] a i if(i != (n - 1)){
				System.out.print(" ");
			}else{
				System.out.print("\n");
			} i != (n - 1) i (n - 1) n 1 {
				System.out.print(" ");
			} System.out.print(" ") System.out.print System.out System System.out " " {
				System.out.print("\n");
			} System.out.print("\n") System.out.print System.out System System.out "\n" System.out.println(COUNT) System.out.println System.out System System.out COUNT String[] args args static int[] selectionSort(int[] a, int n){

		for(int i = 0; i < (n - 1); i++){

			int min = i;

			for(int j = (i + 1); j < n; j++){

				if(a[j] < a[min]){
					min = j;
				}

			}

			if(min != i){
				COUNT++;
			}

			int temp = a[min];
			a[min] = a[i];
			a[i] = temp;

		}

		return a;

	} selectionSort {

		for(int i = 0; i < (n - 1); i++){

			int min = i;

			for(int j = (i + 1); j < n; j++){

				if(a[j] < a[min]){
					min = j;
				}

			}

			if(min != i){
				COUNT++;
			}

			int temp = a[min];
			a[min] = a[i];
			a[i] = temp;

		}

		return a;

	} for(int i = 0; i < (n - 1); i++){

			int min = i;

			for(int j = (i + 1); j < n; j++){

				if(a[j] < a[min]){
					min = j;
				}

			}

			if(min != i){
				COUNT++;
			}

			int temp = a[min];
			a[min] = a[i];
			a[i] = temp;

		} int i = 0; int i = 0; i 0 i < (n - 1) i (n - 1) n 1 i++ i++ i {

			int min = i;

			for(int j = (i + 1); j < n; j++){

				if(a[j] < a[min]){
					min = j;
				}

			}

			if(min != i){
				COUNT++;
			}

			int temp = a[min];
			a[min] = a[i];
			a[i] = temp;

		} {

			int min = i;

			for(int j = (i + 1); j < n; j++){

				if(a[j] < a[min]){
					min = j;
				}

			}

			if(min != i){
				COUNT++;
			}

			int temp = a[min];
			a[min] = a[i];
			a[i] = temp;

		} int min = i; min i for(int j = (i + 1); j < n; j++){

				if(a[j] < a[min]){
					min = j;
				}

			} int j = (i + 1); int j = (i + 1); j (i + 1) i 1 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 min j if(min != i){
				COUNT++;
			} min != i min i {
				COUNT++;
			} COUNT++ COUNT int temp = a[min]; temp a[min] a min a[min] = a[i] a[min] a min a[i] a i a[i] = temp a[i] a i temp return a; a int[] a a int n n
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

class Main{

	static int COUNT = 0;

	public static void main(String[] args) throws IOException{

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		int[] a = new int[n];
		String[] input = br.readLine().split(" ");

		for(int i = 0; i < n; i++){
			a[i] = Integer.parseInt(input[i]);
		}

		a = selectionSort(a, n);

		for(int i = 0; i < n; i++){
			
			System.out.print(a[i]);

			if(i != (n - 1)){
				System.out.print(" ");
			}else{
				System.out.print("\n");
			}

		}

		System.out.println(COUNT);

	}

	static int[] selectionSort(int[] a, int n){

		for(int i = 0; i < (n - 1); i++){

			int min = i;

			for(int j = (i + 1); j < n; j++){

				if(a[j] < a[min]){
					min = j;
				}

			}

			if(min != i){
				COUNT++;
			}

			int temp = a[min];
			a[min] = a[i];
			a[i] = temp;

		}

		return a;

	}

}