import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.lang.StringBuilder;

/*Question
/?????????????????????????¨??????????????????§?????????????°????????????????????????????????????´???????????¢?????´???????????§??????
/1 selectionSort(A, N) // N??????????´??????????0-?????????????????????A
/2 for i ??? 0 ?????? N-1 ?????§
/3 minj = i
/4 for j ??? i ?????? N-1 ?????§
/5 if A[j] < A[minj]
/6 minj = j
/7 A[i] ??¨ A[minj] ?????????
/??°???A??????????????????????????????????????¢?????´???????????§?????????????????????????????????????????°????????????????????????????????????
/????????????????????????????????¢?????´????????????????£??????????????????????
/??????????????? 7 ????????§???i ??¨ minj ?????°?????????????????????????????????????????°?????????????????????????????? 
*/

/*Input
/??\??????????????????????????°?????????????????¨?????´??° N ???????????????????????????????????????N ????????´??°????????????????????§????????????????????? 
*/

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));
		//???????????°????¢??????¨
		int k;
		/*??\???
		/??????????´???°?????\???????¬??????°????????\???
		*/
		int n = Integer.parseInt(sc.readLine());
		int[] a = new int[n];
		String[] st = sc.readLine().split(" ");
		for(int i = 0;i < n;i++){
			a[i] = Integer.parseInt(st[i]);
		}
		/*??°??????Selection???????????????
		/????????????????????§?????????????????????
		/??????????????£??????????????§??????
		*/
		k = Selection(a);
		System.out.println(k);
	}

	/*Selection????????????
	/???????????????????????????
	/?????????????????????????????????????????????????????°??¨??????????????????????±?????°????????????°????????????????¨???¶??????
	/??¨???????????´???????????°??¨????????????????¨???¶?????????????????????????????¨??\????????????
	@return int
	*/

	public static int Selection(int[] a) {
		//????????¨
		StringBuilder br = new StringBuilder();
		//?????°???????????????
		int s = 0;
		//????????????????????????????????\????????¨
		int min,t;
		for (int i = 0;i < a.length;i++) {
			min = i;
			for (int j = i + 1;j < a.length;j++) {
				if (a[j] < a[min]) min = j;
			}
			if (min != i){
				t = a[i];
				a[i] = a[min];
				a[min] = t;
				s++;
			}
		}
		//??????
		for (int n:a)
			br.append(n+" ");
		br.deleteCharAt(br.lastIndexOf(" "));
		System.out.println(br);
		return s;
	}
}
/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