import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();
		int[] ary = new int[n];

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

		int count = 0;
		for (int i=0; i<ary.length; i++) {
			int mini = i;
			for (int j=i; j<ary.length; j++) {
				if (ary[j] < ary[mini]) {
					mini = j;
				}
			}
			swap(ary,i,mini);
			if(i != mini)
				count++;
		}

		for (int i=0; i<n-1; i++) {
			System.out.print(ary[i]+" ");
		}
		System.out.println(ary[n-1]);
		System.out.println(count);
	}

	static void swap(int[] ary,int x,int y){
		int temp = ary[x];
		ary[x] = ary[y];
		ary[y] = temp;
	}
} import java.util.*; util.* java class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();
		int[] ary = new int[n];

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

		int count = 0;
		for (int i=0; i<ary.length; i++) {
			int mini = i;
			for (int j=i; j<ary.length; j++) {
				if (ary[j] < ary[mini]) {
					mini = j;
				}
			}
			swap(ary,i,mini);
			if(i != mini)
				count++;
		}

		for (int i=0; i<n-1; i++) {
			System.out.print(ary[i]+" ");
		}
		System.out.println(ary[n-1]);
		System.out.println(count);
	}

	static void swap(int[] ary,int x,int y){
		int temp = ary[x];
		ary[x] = ary[y];
		ary[y] = temp;
	}
} Main public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();
		int[] ary = new int[n];

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

		int count = 0;
		for (int i=0; i<ary.length; i++) {
			int mini = i;
			for (int j=i; j<ary.length; j++) {
				if (ary[j] < ary[mini]) {
					mini = j;
				}
			}
			swap(ary,i,mini);
			if(i != mini)
				count++;
		}

		for (int i=0; i<n-1; i++) {
			System.out.print(ary[i]+" ");
		}
		System.out.println(ary[n-1]);
		System.out.println(count);
	} main {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();
		int[] ary = new int[n];

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

		int count = 0;
		for (int i=0; i<ary.length; i++) {
			int mini = i;
			for (int j=i; j<ary.length; j++) {
				if (ary[j] < ary[mini]) {
					mini = j;
				}
			}
			swap(ary,i,mini);
			if(i != mini)
				count++;
		}

		for (int i=0; i<n-1; i++) {
			System.out.print(ary[i]+" ");
		}
		System.out.println(ary[n-1]);
		System.out.println(count);
	} Scanner stdIn = new Scanner(System.in); stdIn new Scanner(System.in) int n = stdIn.nextInt(); n stdIn.nextInt() stdIn.nextInt stdIn int[] ary = new int[n]; ary new int[n] n for (int i=0; i<n; i++) {
			ary[i] = stdIn.nextInt();
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			ary[i] = stdIn.nextInt();
		} {
			ary[i] = stdIn.nextInt();
		} ary[i] = stdIn.nextInt() ary[i] ary i stdIn.nextInt() stdIn.nextInt stdIn int count = 0; count 0 for (int i=0; i<ary.length; i++) {
			int mini = i;
			for (int j=i; j<ary.length; j++) {
				if (ary[j] < ary[mini]) {
					mini = j;
				}
			}
			swap(ary,i,mini);
			if(i != mini)
				count++;
		} int i=0; int i=0; i 0 i<ary.length i ary.length ary ary.length i++ i++ i {
			int mini = i;
			for (int j=i; j<ary.length; j++) {
				if (ary[j] < ary[mini]) {
					mini = j;
				}
			}
			swap(ary,i,mini);
			if(i != mini)
				count++;
		} {
			int mini = i;
			for (int j=i; j<ary.length; j++) {
				if (ary[j] < ary[mini]) {
					mini = j;
				}
			}
			swap(ary,i,mini);
			if(i != mini)
				count++;
		} int mini = i; mini i for (int j=i; j<ary.length; j++) {
				if (ary[j] < ary[mini]) {
					mini = j;
				}
			} int j=i; int j=i; j i j<ary.length j ary.length ary ary.length j++ j++ j {
				if (ary[j] < ary[mini]) {
					mini = j;
				}
			} {
				if (ary[j] < ary[mini]) {
					mini = j;
				}
			} if (ary[j] < ary[mini]) {
					mini = j;
				} ary[j] < ary[mini] ary[j] ary j ary[mini] ary mini {
					mini = j;
				} mini = j mini j swap(ary,i,mini) swap ary i mini if(i != mini)
				count++; i != mini i mini count++ count for (int i=0; i<n-1; i++) {
			System.out.print(ary[i]+" ");
		} int i=0; int i=0; i 0 i<n-1 i n-1 n 1 i++ i++ i {
			System.out.print(ary[i]+" ");
		} {
			System.out.print(ary[i]+" ");
		} System.out.print(ary[i]+" ") System.out.print System.out System System.out ary[i]+" " ary[i] ary i " " System.out.println(ary[n-1]) System.out.println System.out System System.out ary[n-1] ary n-1 n 1 System.out.println(count) System.out.println System.out System System.out count String[] args args static void swap(int[] ary,int x,int y){
		int temp = ary[x];
		ary[x] = ary[y];
		ary[y] = temp;
	} swap {
		int temp = ary[x];
		ary[x] = ary[y];
		ary[y] = temp;
	} int temp = ary[x]; temp ary[x] ary x ary[x] = ary[y] ary[x] ary x ary[y] ary y ary[y] = temp ary[y] ary y temp int[] ary ary int x x int y y
import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();
		int[] ary = new int[n];

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

		int count = 0;
		for (int i=0; i<ary.length; i++) {
			int mini = i;
			for (int j=i; j<ary.length; j++) {
				if (ary[j] < ary[mini]) {
					mini = j;
				}
			}
			swap(ary,i,mini);
			if(i != mini)
				count++;
		}

		for (int i=0; i<n-1; i++) {
			System.out.print(ary[i]+" ");
		}
		System.out.println(ary[n-1]);
		System.out.println(count);
	}

	static void swap(int[] ary,int x,int y){
		int temp = ary[x];
		ary[x] = ary[y];
		ary[y] = temp;
	}
}