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

class Main {

	public static void main(String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n = Integer.parseInt(br.readLine());

		String[] s = br.readLine().split(" ");

		int[] numbers = new int[n];

		for(int i=0; i<n; i++){
			numbers[i] = Integer.parseInt(s[i]);
		}



		int count = 0;

		count = sellectesort(numbers, n, count);
		StringBuilder sb = new StringBuilder();
		for(int i=0; i<n; i++){
			sb.append(numbers[i]);
			sb.append(" ");
		}

		System.out.println(sb.toString().trim());
		System.out.println(count);
	}

	static int  sellectesort(int[] nums , int n, int count){

		int min;

		int counts = count;

		Boolean judge = false;

		for(int i=0; i<n-1; i++){
			min =i;

			for(int k=i+1; k<n; k++){
				if(nums[k]<nums[min]){
					min =k;
					judge =true;
				}
			}
			if(judge) counts++;

			int num = nums[i];

			nums[i] = nums[min];

			nums[min] = num;

			judge = false;

		}

		return counts;

	}


} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io class Main {

	public static void main(String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n = Integer.parseInt(br.readLine());

		String[] s = br.readLine().split(" ");

		int[] numbers = new int[n];

		for(int i=0; i<n; i++){
			numbers[i] = Integer.parseInt(s[i]);
		}



		int count = 0;

		count = sellectesort(numbers, n, count);
		StringBuilder sb = new StringBuilder();
		for(int i=0; i<n; i++){
			sb.append(numbers[i]);
			sb.append(" ");
		}

		System.out.println(sb.toString().trim());
		System.out.println(count);
	}

	static int  sellectesort(int[] nums , int n, int count){

		int min;

		int counts = count;

		Boolean judge = false;

		for(int i=0; i<n-1; i++){
			min =i;

			for(int k=i+1; k<n; k++){
				if(nums[k]<nums[min]){
					min =k;
					judge =true;
				}
			}
			if(judge) counts++;

			int num = nums[i];

			nums[i] = nums[min];

			nums[min] = num;

			judge = false;

		}

		return counts;

	}


} Main public static void main(String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n = Integer.parseInt(br.readLine());

		String[] s = br.readLine().split(" ");

		int[] numbers = new int[n];

		for(int i=0; i<n; i++){
			numbers[i] = Integer.parseInt(s[i]);
		}



		int count = 0;

		count = sellectesort(numbers, n, count);
		StringBuilder sb = new StringBuilder();
		for(int i=0; i<n; i++){
			sb.append(numbers[i]);
			sb.append(" ");
		}

		System.out.println(sb.toString().trim());
		System.out.println(count);
	} main {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n = Integer.parseInt(br.readLine());

		String[] s = br.readLine().split(" ");

		int[] numbers = new int[n];

		for(int i=0; i<n; i++){
			numbers[i] = Integer.parseInt(s[i]);
		}



		int count = 0;

		count = sellectesort(numbers, n, count);
		StringBuilder sb = new StringBuilder();
		for(int i=0; i<n; i++){
			sb.append(numbers[i]);
			sb.append(" ");
		}

		System.out.println(sb.toString().trim());
		System.out.println(count);
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int n = Integer.parseInt(br.readLine()); n Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br String[] s = br.readLine().split(" "); s br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int[] numbers = new int[n]; numbers new int[n] n for(int i=0; i<n; i++){
			numbers[i] = Integer.parseInt(s[i]);
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			numbers[i] = Integer.parseInt(s[i]);
		} {
			numbers[i] = Integer.parseInt(s[i]);
		} numbers[i] = Integer.parseInt(s[i]) numbers[i] numbers i Integer.parseInt(s[i]) Integer.parseInt Integer s[i] s i int count = 0; count 0 count = sellectesort(numbers, n, count) count sellectesort(numbers, n, count) sellectesort numbers n count StringBuilder sb = new StringBuilder(); sb new StringBuilder() for(int i=0; i<n; i++){
			sb.append(numbers[i]);
			sb.append(" ");
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			sb.append(numbers[i]);
			sb.append(" ");
		} {
			sb.append(numbers[i]);
			sb.append(" ");
		} sb.append(numbers[i]) sb.append sb numbers[i] numbers i sb.append(" ") sb.append sb " " System.out.println(sb.toString().trim()) System.out.println System.out System System.out sb.toString().trim() sb.toString().trim sb.toString() sb.toString sb System.out.println(count) System.out.println System.out System System.out count String[] args args static int  sellectesort(int[] nums , int n, int count){

		int min;

		int counts = count;

		Boolean judge = false;

		for(int i=0; i<n-1; i++){
			min =i;

			for(int k=i+1; k<n; k++){
				if(nums[k]<nums[min]){
					min =k;
					judge =true;
				}
			}
			if(judge) counts++;

			int num = nums[i];

			nums[i] = nums[min];

			nums[min] = num;

			judge = false;

		}

		return counts;

	} sellectesort {

		int min;

		int counts = count;

		Boolean judge = false;

		for(int i=0; i<n-1; i++){
			min =i;

			for(int k=i+1; k<n; k++){
				if(nums[k]<nums[min]){
					min =k;
					judge =true;
				}
			}
			if(judge) counts++;

			int num = nums[i];

			nums[i] = nums[min];

			nums[min] = num;

			judge = false;

		}

		return counts;

	} int min; min int counts = count; counts count Boolean judge = false; judge false for(int i=0; i<n-1; i++){
			min =i;

			for(int k=i+1; k<n; k++){
				if(nums[k]<nums[min]){
					min =k;
					judge =true;
				}
			}
			if(judge) counts++;

			int num = nums[i];

			nums[i] = nums[min];

			nums[min] = num;

			judge = false;

		} int i=0; int i=0; i 0 i<n-1 i n-1 n 1 i++ i++ i {
			min =i;

			for(int k=i+1; k<n; k++){
				if(nums[k]<nums[min]){
					min =k;
					judge =true;
				}
			}
			if(judge) counts++;

			int num = nums[i];

			nums[i] = nums[min];

			nums[min] = num;

			judge = false;

		} {
			min =i;

			for(int k=i+1; k<n; k++){
				if(nums[k]<nums[min]){
					min =k;
					judge =true;
				}
			}
			if(judge) counts++;

			int num = nums[i];

			nums[i] = nums[min];

			nums[min] = num;

			judge = false;

		} min =i min i for(int k=i+1; k<n; k++){
				if(nums[k]<nums[min]){
					min =k;
					judge =true;
				}
			} int k=i+1; int k=i+1; k i+1 i 1 k<n k n k++ k++ k {
				if(nums[k]<nums[min]){
					min =k;
					judge =true;
				}
			} {
				if(nums[k]<nums[min]){
					min =k;
					judge =true;
				}
			} if(nums[k]<nums[min]){
					min =k;
					judge =true;
				} nums[k]<nums[min] nums[k] nums k nums[min] nums min {
					min =k;
					judge =true;
				} min =k min k judge =true judge true if(judge) counts++; judge counts++ counts int num = nums[i]; num nums[i] nums i nums[i] = nums[min] nums[i] nums i nums[min] nums min nums[min] = num nums[min] nums min num judge = false judge false return counts; counts int[] nums nums int n n int count count
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {

	public static void main(String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n = Integer.parseInt(br.readLine());

		String[] s = br.readLine().split(" ");

		int[] numbers = new int[n];

		for(int i=0; i<n; i++){
			numbers[i] = Integer.parseInt(s[i]);
		}



		int count = 0;

		count = sellectesort(numbers, n, count);
		StringBuilder sb = new StringBuilder();
		for(int i=0; i<n; i++){
			sb.append(numbers[i]);
			sb.append(" ");
		}

		System.out.println(sb.toString().trim());
		System.out.println(count);
	}

	static int  sellectesort(int[] nums , int n, int count){

		int min;

		int counts = count;

		Boolean judge = false;

		for(int i=0; i<n-1; i++){
			min =i;

			for(int k=i+1; k<n; k++){
				if(nums[k]<nums[min]){
					min =k;
					judge =true;
				}
			}
			if(judge) counts++;

			int num = nums[i];

			nums[i] = nums[min];

			nums[min] = num;

			judge = false;

		}

		return counts;

	}


}