import java.io.*;
import java.util.Arrays;
import java.util.Scanner;

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

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