import java.util.*;
import java.io.*;

class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		
		int n = sc.nextInt();
		ArrayList<Integer> list = new ArrayList<>();
		for (int i=0; i<n; i++) list.add(sc.nextInt());
		int ans = 0;
		
		for (int i=0; i<n; i++) {
			int min = i;
			boolean b = false;
			for (int j=i; j<n; j++) {
				if (list.get(j) < list.get(min)) {
					min = j;
					b = true;
				}
			}
			
			if (b == true) ans++;
			
			Collections.swap(list, i, min);
			
		}
		
		for (int i=0; i<n; i++) {
			System.out.print((i==0?"":" ")+list.get(i));
		}
		System.out.println();
		System.out.println(ans);
		
	}
}
 import java.util.*; util.* java import java.io.*; io.* java class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		
		int n = sc.nextInt();
		ArrayList<Integer> list = new ArrayList<>();
		for (int i=0; i<n; i++) list.add(sc.nextInt());
		int ans = 0;
		
		for (int i=0; i<n; i++) {
			int min = i;
			boolean b = false;
			for (int j=i; j<n; j++) {
				if (list.get(j) < list.get(min)) {
					min = j;
					b = true;
				}
			}
			
			if (b == true) ans++;
			
			Collections.swap(list, i, min);
			
		}
		
		for (int i=0; i<n; i++) {
			System.out.print((i==0?"":" ")+list.get(i));
		}
		System.out.println();
		System.out.println(ans);
		
	}
} Main static Scanner sc = new Scanner(System.in); sc new Scanner(System.in) public static void main(String[] args) {
		
		int n = sc.nextInt();
		ArrayList<Integer> list = new ArrayList<>();
		for (int i=0; i<n; i++) list.add(sc.nextInt());
		int ans = 0;
		
		for (int i=0; i<n; i++) {
			int min = i;
			boolean b = false;
			for (int j=i; j<n; j++) {
				if (list.get(j) < list.get(min)) {
					min = j;
					b = true;
				}
			}
			
			if (b == true) ans++;
			
			Collections.swap(list, i, min);
			
		}
		
		for (int i=0; i<n; i++) {
			System.out.print((i==0?"":" ")+list.get(i));
		}
		System.out.println();
		System.out.println(ans);
		
	} main {
		
		int n = sc.nextInt();
		ArrayList<Integer> list = new ArrayList<>();
		for (int i=0; i<n; i++) list.add(sc.nextInt());
		int ans = 0;
		
		for (int i=0; i<n; i++) {
			int min = i;
			boolean b = false;
			for (int j=i; j<n; j++) {
				if (list.get(j) < list.get(min)) {
					min = j;
					b = true;
				}
			}
			
			if (b == true) ans++;
			
			Collections.swap(list, i, min);
			
		}
		
		for (int i=0; i<n; i++) {
			System.out.print((i==0?"":" ")+list.get(i));
		}
		System.out.println();
		System.out.println(ans);
		
	} int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc ArrayList<Integer> list = new ArrayList<>(); list new ArrayList<>() for (int i=0; i<n; i++) list.add(sc.nextInt()); int i=0; int i=0; i 0 i<n i n i++ i++ i list.add(sc.nextInt()); list.add(sc.nextInt()) list.add list sc.nextInt() sc.nextInt sc int ans = 0; ans 0 for (int i=0; i<n; i++) {
			int min = i;
			boolean b = false;
			for (int j=i; j<n; j++) {
				if (list.get(j) < list.get(min)) {
					min = j;
					b = true;
				}
			}
			
			if (b == true) ans++;
			
			Collections.swap(list, i, min);
			
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			int min = i;
			boolean b = false;
			for (int j=i; j<n; j++) {
				if (list.get(j) < list.get(min)) {
					min = j;
					b = true;
				}
			}
			
			if (b == true) ans++;
			
			Collections.swap(list, i, min);
			
		} {
			int min = i;
			boolean b = false;
			for (int j=i; j<n; j++) {
				if (list.get(j) < list.get(min)) {
					min = j;
					b = true;
				}
			}
			
			if (b == true) ans++;
			
			Collections.swap(list, i, min);
			
		} int min = i; min i boolean b = false; b false for (int j=i; j<n; j++) {
				if (list.get(j) < list.get(min)) {
					min = j;
					b = true;
				}
			} int j=i; int j=i; j i j<n j n j++ j++ j {
				if (list.get(j) < list.get(min)) {
					min = j;
					b = true;
				}
			} {
				if (list.get(j) < list.get(min)) {
					min = j;
					b = true;
				}
			} if (list.get(j) < list.get(min)) {
					min = j;
					b = true;
				} list.get(j) < list.get(min) list.get(j) list.get list j list.get(min) list.get list min {
					min = j;
					b = true;
				} min = j min j b = true b true if (b == true) ans++; b == true b true ans++ ans Collections.swap(list, i, min) Collections.swap Collections list i min for (int i=0; i<n; i++) {
			System.out.print((i==0?"":" ")+list.get(i));
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			System.out.print((i==0?"":" ")+list.get(i));
		} {
			System.out.print((i==0?"":" ")+list.get(i));
		} System.out.print((i==0?"":" ")+list.get(i)) System.out.print System.out System System.out (i==0?"":" ")+list.get(i) (i==0?"":" ") i==0 i 0 "" " " list.get(i) list.get list i System.out.println() System.out.println System.out System System.out System.out.println(ans) System.out.println System.out System System.out ans String[] args args
import java.util.*;
import java.io.*;

class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		
		int n = sc.nextInt();
		ArrayList<Integer> list = new ArrayList<>();
		for (int i=0; i<n; i++) list.add(sc.nextInt());
		int ans = 0;
		
		for (int i=0; i<n; i++) {
			int min = i;
			boolean b = false;
			for (int j=i; j<n; j++) {
				if (list.get(j) < list.get(min)) {
					min = j;
					b = true;
				}
			}
			
			if (b == true) ans++;
			
			Collections.swap(list, i, min);
			
		}
		
		for (int i=0; i<n; i++) {
			System.out.print((i==0?"":" ")+list.get(i));
		}
		System.out.println();
		System.out.println(ans);
		
	}
}

