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

public class Main {
	public static void main(String[] args) throws NumberFormatException,
			IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		byte min, count = 0, arrayLength = Byte.parseByte(in.readLine());
		byte[] array = new byte[arrayLength];
		String[] strData = in.readLine().split(" ");
		for (int i = 0; i < arrayLength; i++) {
			array[i] = Byte.parseByte(strData[i]);
		}
		for (byte x = 0; x < arrayLength; x++) {
			min = x;
			for (byte y = (byte) (x + 1); y < arrayLength; y++) {
				if (array[min] > array[y]) {
					min = y;
				}
			}
			if (array[x] > array[min]) {
				byte temp = array[x];
				array[x] = array[min];
				array[min] = temp;
				count++;
			}
		}
		for (int j = 0; j < arrayLength; j++) {
			if (j == arrayLength - 1) {
				System.out.println(array[j]);
			} else {
				System.out.print(array[j] + " ");
			}
		}
		System.out.println(count);
	}
}
/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz