import java.util.Scanner;

public class Main { //???????????´???-???????????????-(ALDS1_2_B)P65

	public static void main(String[] args) {
		int i,o;  //i?????\?????¨????????°???o???????????¨????????°
		int q,minj,j,taihi;
		int count = 0;
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.nextLine());
		int array[] = new int[n];
		for(i=0;i<n;i++) array[i] = Integer.parseInt(sc.next()); //??\?????????

		//????????????????????????????????¢?????´?????????
			for(q=0;q<n;q++) {
				minj = q;
				for(j=q;j<n;j++) {
					if (array[j] < array[minj]) minj =j;
				}
				if(q != minj){ //???????????????????????¨????????°???????????\????????????????????????
				taihi = array[q];
				array[q] = array[minj];
				array[minj] = taihi;
				count++;
				//System.out.println(count); //???????????????
				}
			}
		for(o=0;o<n-1;o++)
			System.out.print(array[o]+" ");//???????????????
		System.out.println(array[o]);
		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