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

public class Main {
	public static void main(String[] args) {
		int[] seq = null;
		
		try {
			seq = getSequence();
		} catch (IOException e) {
			e.printStackTrace();
		}
		
		selectionSort(seq);
	}
	
	public static int[] selectionSort(final int[] seq) {
		int count = 0;
		
		for (int i = 0; i < seq.length-1; i++) {
			int min = i;
			for (int j = i+1; j < seq.length; j++) {
				if (seq[j] < seq[min]) min = j;
			}
			if (min != i) {
				final int tmp = seq[i];
				seq[i] = seq[min];
				seq[min] = tmp;
				count++;
			}
		}
		
		printSequence(seq);
		System.out.println(count);

		return seq;
	}
	
	public static void printSequence(final int[] seq) {
		final StringBuilder p = new StringBuilder();
		
		for (int i = 0; i < seq.length; i++) {
			p.append(seq[i]).append(i < seq.length-1 ? " " : "");
		}
		System.out.println(p);
	}
	
	public static int[] getSequence() throws IOException {
		final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		final int n = Integer.parseInt(reader.readLine());
		final String[] line = reader.readLine().split(" ");
		reader.close();
		
		final int[] seq = new int[n];
		for (int i = 0; i < seq.length; i++) {
			seq[i] = Integer.parseInt(line[i]);
		}
		
		return seq;
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
	public static void main(String[] args) {
		int[] seq = null;
		
		try {
			seq = getSequence();
		} catch (IOException e) {
			e.printStackTrace();
		}
		
		selectionSort(seq);
	}
	
	public static int[] selectionSort(final int[] seq) {
		int count = 0;
		
		for (int i = 0; i < seq.length-1; i++) {
			int min = i;
			for (int j = i+1; j < seq.length; j++) {
				if (seq[j] < seq[min]) min = j;
			}
			if (min != i) {
				final int tmp = seq[i];
				seq[i] = seq[min];
				seq[min] = tmp;
				count++;
			}
		}
		
		printSequence(seq);
		System.out.println(count);

		return seq;
	}
	
	public static void printSequence(final int[] seq) {
		final StringBuilder p = new StringBuilder();
		
		for (int i = 0; i < seq.length; i++) {
			p.append(seq[i]).append(i < seq.length-1 ? " " : "");
		}
		System.out.println(p);
	}
	
	public static int[] getSequence() throws IOException {
		final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		final int n = Integer.parseInt(reader.readLine());
		final String[] line = reader.readLine().split(" ");
		reader.close();
		
		final int[] seq = new int[n];
		for (int i = 0; i < seq.length; i++) {
			seq[i] = Integer.parseInt(line[i]);
		}
		
		return seq;
	}
} Main public static void main(String[] args) {
		int[] seq = null;
		
		try {
			seq = getSequence();
		} catch (IOException e) {
			e.printStackTrace();
		}
		
		selectionSort(seq);
	} main {
		int[] seq = null;
		
		try {
			seq = getSequence();
		} catch (IOException e) {
			e.printStackTrace();
		}
		
		selectionSort(seq);
	} int[] seq = null; seq null try {
			seq = getSequence();
		} catch (IOException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} IOException e {
			e.printStackTrace();
		} e.printStackTrace() e.printStackTrace e {
			seq = getSequence();
		} seq = getSequence() seq getSequence() getSequence selectionSort(seq) selectionSort seq String[] args args public static int[] selectionSort(final int[] seq) {
		int count = 0;
		
		for (int i = 0; i < seq.length-1; i++) {
			int min = i;
			for (int j = i+1; j < seq.length; j++) {
				if (seq[j] < seq[min]) min = j;
			}
			if (min != i) {
				final int tmp = seq[i];
				seq[i] = seq[min];
				seq[min] = tmp;
				count++;
			}
		}
		
		printSequence(seq);
		System.out.println(count);

		return seq;
	} selectionSort {
		int count = 0;
		
		for (int i = 0; i < seq.length-1; i++) {
			int min = i;
			for (int j = i+1; j < seq.length; j++) {
				if (seq[j] < seq[min]) min = j;
			}
			if (min != i) {
				final int tmp = seq[i];
				seq[i] = seq[min];
				seq[min] = tmp;
				count++;
			}
		}
		
		printSequence(seq);
		System.out.println(count);

		return seq;
	} int count = 0; count 0 for (int i = 0; i < seq.length-1; i++) {
			int min = i;
			for (int j = i+1; j < seq.length; j++) {
				if (seq[j] < seq[min]) min = j;
			}
			if (min != i) {
				final int tmp = seq[i];
				seq[i] = seq[min];
				seq[min] = tmp;
				count++;
			}
		} int i = 0; int i = 0; i 0 i < seq.length-1 i seq.length-1 seq.length seq seq.length 1 i++ i++ i {
			int min = i;
			for (int j = i+1; j < seq.length; j++) {
				if (seq[j] < seq[min]) min = j;
			}
			if (min != i) {
				final int tmp = seq[i];
				seq[i] = seq[min];
				seq[min] = tmp;
				count++;
			}
		} {
			int min = i;
			for (int j = i+1; j < seq.length; j++) {
				if (seq[j] < seq[min]) min = j;
			}
			if (min != i) {
				final int tmp = seq[i];
				seq[i] = seq[min];
				seq[min] = tmp;
				count++;
			}
		} int min = i; min i for (int j = i+1; j < seq.length; j++) {
				if (seq[j] < seq[min]) min = j;
			} int j = i+1; int j = i+1; j i+1 i 1 j < seq.length j seq.length seq seq.length j++ j++ j {
				if (seq[j] < seq[min]) min = j;
			} {
				if (seq[j] < seq[min]) min = j;
			} if (seq[j] < seq[min]) min = j; seq[j] < seq[min] seq[j] seq j seq[min] seq min min = j min j if (min != i) {
				final int tmp = seq[i];
				seq[i] = seq[min];
				seq[min] = tmp;
				count++;
			} min != i min i {
				final int tmp = seq[i];
				seq[i] = seq[min];
				seq[min] = tmp;
				count++;
			} final int tmp = seq[i]; tmp seq[i] seq i seq[i] = seq[min] seq[i] seq i seq[min] seq min seq[min] = tmp seq[min] seq min tmp count++ count printSequence(seq) printSequence seq System.out.println(count) System.out.println System.out System System.out count return seq; seq final int[] seq seq public static void printSequence(final int[] seq) {
		final StringBuilder p = new StringBuilder();
		
		for (int i = 0; i < seq.length; i++) {
			p.append(seq[i]).append(i < seq.length-1 ? " " : "");
		}
		System.out.println(p);
	} printSequence {
		final StringBuilder p = new StringBuilder();
		
		for (int i = 0; i < seq.length; i++) {
			p.append(seq[i]).append(i < seq.length-1 ? " " : "");
		}
		System.out.println(p);
	} final StringBuilder p = new StringBuilder(); p new StringBuilder() for (int i = 0; i < seq.length; i++) {
			p.append(seq[i]).append(i < seq.length-1 ? " " : "");
		} int i = 0; int i = 0; i 0 i < seq.length i seq.length seq seq.length i++ i++ i {
			p.append(seq[i]).append(i < seq.length-1 ? " " : "");
		} {
			p.append(seq[i]).append(i < seq.length-1 ? " " : "");
		} p.append(seq[i]).append(i < seq.length-1 ? " " : "") p.append(seq[i]).append p.append(seq[i]) p.append p seq[i] seq i i < seq.length-1 ? " " : "" i < seq.length-1 i seq.length-1 seq.length seq seq.length 1 " " "" System.out.println(p) System.out.println System.out System System.out p final int[] seq seq public static int[] getSequence() throws IOException {
		final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		final int n = Integer.parseInt(reader.readLine());
		final String[] line = reader.readLine().split(" ");
		reader.close();
		
		final int[] seq = new int[n];
		for (int i = 0; i < seq.length; i++) {
			seq[i] = Integer.parseInt(line[i]);
		}
		
		return seq;
	} getSequence {
		final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		final int n = Integer.parseInt(reader.readLine());
		final String[] line = reader.readLine().split(" ");
		reader.close();
		
		final int[] seq = new int[n];
		for (int i = 0; i < seq.length; i++) {
			seq[i] = Integer.parseInt(line[i]);
		}
		
		return seq;
	} final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); reader new BufferedReader(new InputStreamReader(System.in)) final int n = Integer.parseInt(reader.readLine()); n Integer.parseInt(reader.readLine()) Integer.parseInt Integer reader.readLine() reader.readLine reader final String[] line = reader.readLine().split(" "); line reader.readLine().split(" ") reader.readLine().split reader.readLine() reader.readLine reader " " reader.close() reader.close reader final int[] seq = new int[n]; seq new int[n] n for (int i = 0; i < seq.length; i++) {
			seq[i] = Integer.parseInt(line[i]);
		} int i = 0; int i = 0; i 0 i < seq.length i seq.length seq seq.length i++ i++ i {
			seq[i] = Integer.parseInt(line[i]);
		} {
			seq[i] = Integer.parseInt(line[i]);
		} seq[i] = Integer.parseInt(line[i]) seq[i] seq i Integer.parseInt(line[i]) Integer.parseInt Integer line[i] line i return seq; seq public class Main {
	public static void main(String[] args) {
		int[] seq = null;
		
		try {
			seq = getSequence();
		} catch (IOException e) {
			e.printStackTrace();
		}
		
		selectionSort(seq);
	}
	
	public static int[] selectionSort(final int[] seq) {
		int count = 0;
		
		for (int i = 0; i < seq.length-1; i++) {
			int min = i;
			for (int j = i+1; j < seq.length; j++) {
				if (seq[j] < seq[min]) min = j;
			}
			if (min != i) {
				final int tmp = seq[i];
				seq[i] = seq[min];
				seq[min] = tmp;
				count++;
			}
		}
		
		printSequence(seq);
		System.out.println(count);

		return seq;
	}
	
	public static void printSequence(final int[] seq) {
		final StringBuilder p = new StringBuilder();
		
		for (int i = 0; i < seq.length; i++) {
			p.append(seq[i]).append(i < seq.length-1 ? " " : "");
		}
		System.out.println(p);
	}
	
	public static int[] getSequence() throws IOException {
		final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		final int n = Integer.parseInt(reader.readLine());
		final String[] line = reader.readLine().split(" ");
		reader.close();
		
		final int[] seq = new int[n];
		for (int i = 0; i < seq.length; i++) {
			seq[i] = Integer.parseInt(line[i]);
		}
		
		return seq;
	}
} public class Main {
	public static void main(String[] args) {
		int[] seq = null;
		
		try {
			seq = getSequence();
		} catch (IOException e) {
			e.printStackTrace();
		}
		
		selectionSort(seq);
	}
	
	public static int[] selectionSort(final int[] seq) {
		int count = 0;
		
		for (int i = 0; i < seq.length-1; i++) {
			int min = i;
			for (int j = i+1; j < seq.length; j++) {
				if (seq[j] < seq[min]) min = j;
			}
			if (min != i) {
				final int tmp = seq[i];
				seq[i] = seq[min];
				seq[min] = tmp;
				count++;
			}
		}
		
		printSequence(seq);
		System.out.println(count);

		return seq;
	}
	
	public static void printSequence(final int[] seq) {
		final StringBuilder p = new StringBuilder();
		
		for (int i = 0; i < seq.length; i++) {
			p.append(seq[i]).append(i < seq.length-1 ? " " : "");
		}
		System.out.println(p);
	}
	
	public static int[] getSequence() throws IOException {
		final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		final int n = Integer.parseInt(reader.readLine());
		final String[] line = reader.readLine().split(" ");
		reader.close();
		
		final int[] seq = new int[n];
		for (int i = 0; i < seq.length; i++) {
			seq[i] = Integer.parseInt(line[i]);
		}
		
		return seq;
	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) {
		int[] seq = null;
		
		try {
			seq = getSequence();
		} catch (IOException e) {
			e.printStackTrace();
		}
		
		selectionSort(seq);
	}
	
	public static int[] selectionSort(final int[] seq) {
		int count = 0;
		
		for (int i = 0; i < seq.length-1; i++) {
			int min = i;
			for (int j = i+1; j < seq.length; j++) {
				if (seq[j] < seq[min]) min = j;
			}
			if (min != i) {
				final int tmp = seq[i];
				seq[i] = seq[min];
				seq[min] = tmp;
				count++;
			}
		}
		
		printSequence(seq);
		System.out.println(count);

		return seq;
	}
	
	public static void printSequence(final int[] seq) {
		final StringBuilder p = new StringBuilder();
		
		for (int i = 0; i < seq.length; i++) {
			p.append(seq[i]).append(i < seq.length-1 ? " " : "");
		}
		System.out.println(p);
	}
	
	public static int[] getSequence() throws IOException {
		final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		final int n = Integer.parseInt(reader.readLine());
		final String[] line = reader.readLine().split(" ");
		reader.close();
		
		final int[] seq = new int[n];
		for (int i = 0; i < seq.length; i++) {
			seq[i] = Integer.parseInt(line[i]);
		}
		
		return seq;
	}
}