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

class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int count = Integer.parseInt(br.readLine());

		String[] str = br.readLine().split(" ");
		int[] numList = new int[count];
		for (int i = 0; i < count; i++) {
			numList[i] = Integer.parseInt(str[i]);
		}
		Tool.selectionSort(numList, count);
	}
}

class Tool {
	static void selectionSort(int[] numList, int count) {
		StringBuffer sb = new StringBuffer();
		int flag = 0;
//????????¨????¨???°
		for(int i = 0; i < count - 1; i++){
			int minj = i;
			for(int j = i + 1; j < count; j++){
				if(numList[j] < numList[minj]){//?????§??????????´¢??????
					minj = j;
				}
			}
				if(minj != i){//???????????????
					int temp = numList[i];
					numList[i] = numList[minj];
					numList[minj] = temp;
					flag++;
				}
			}
		sb.append(numList[0]);
		for (int i = 1; i < count; i++) {
			sb.append(" " + numList[i]);
		}
		System.out.println(sb.toString() + "\n" + flag);
	}
}
/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