import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		Scanner sc = new Scanner(System.in);
		String line1 = sc.nextLine();
		int n = Integer.parseInt(line1);

		String line2 = sc.nextLine();
		String[] kari = line2.split(" ");
		int[] num = new int[n];
		for (int i = 0; i < n; i++) {
			num[i] = Integer.parseInt(kari[i]);
		}

		int change = 0;

		for (int i = 0; i < n - 1; i++) {
			int min = num[i];
			int x = i;
			for (int j = i + 1; j < n; j++) {
				if (min > num[j]) {
					min = num[j];
					x = j;
				}
			}
			
			if (i != x) {
				int v = num[i];
				num[i] = num[x];
				num[x] = v;
				change++;
			}

		}

		StringBuilder str = new StringBuilder();

		for (int i = 0; i < n - 1; i++) {
			str.append(num[i]);
			str.append(" ");
		}
		str.append(num[n - 1]);

		System.out.println(str);
		System.out.println(change);

	}

}
/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