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

public class Main {

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

		String AStr[] = br.readLine().split(" ");
		int A[] = new int[n];

		for(int i = 0 ; i < n ; i++) A[i] = Integer.parseInt(AStr[i]);

		selectSort(n,A);

	}

	public static void selectSort(int n,int[] A){
		int count = 0;
		for(int i = 0 ; i < n ; i++){
			int minIndex = i;
			for(int y = i + 1 ; y < n ; y++){
				if(A[minIndex] > A[y]){
					minIndex = y;
				}
			}
			if(minIndex != i){
				int tmp = A[minIndex];
				A[minIndex] = A[i];
				A[i] = tmp;
				count++;
			}
		}

		StringBuilder sb = new StringBuilder();
		for(int i = 0 ; i < n; i++){
			sb.append(A[i]);
			sb.append(" ");
		}
		sb.deleteCharAt(sb.length() - 1);
		System.out.println(sb.toString());
		System.out.println(count);
	}

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

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

		String AStr[] = br.readLine().split(" ");
		int A[] = new int[n];

		for(int i = 0 ; i < n ; i++) A[i] = Integer.parseInt(AStr[i]);

		selectSort(n,A);

	}

	public static void selectSort(int n,int[] A){
		int count = 0;
		for(int i = 0 ; i < n ; i++){
			int minIndex = i;
			for(int y = i + 1 ; y < n ; y++){
				if(A[minIndex] > A[y]){
					minIndex = y;
				}
			}
			if(minIndex != i){
				int tmp = A[minIndex];
				A[minIndex] = A[i];
				A[i] = tmp;
				count++;
			}
		}

		StringBuilder sb = new StringBuilder();
		for(int i = 0 ; i < n; i++){
			sb.append(A[i]);
			sb.append(" ");
		}
		sb.deleteCharAt(sb.length() - 1);
		System.out.println(sb.toString());
		System.out.println(count);
	}

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

		String AStr[] = br.readLine().split(" ");
		int A[] = new int[n];

		for(int i = 0 ; i < n ; i++) A[i] = Integer.parseInt(AStr[i]);

		selectSort(n,A);

	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());

		String AStr[] = br.readLine().split(" ");
		int A[] = new int[n];

		for(int i = 0 ; i < n ; i++) A[i] = Integer.parseInt(AStr[i]);

		selectSort(n,A);

	} 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 AStr[] = br.readLine().split(" "); AStr br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int A[] = new int[n]; A new int[n] n for(int i = 0 ; i < n ; i++) A[i] = Integer.parseInt(AStr[i]); int i = 0 ; int i = 0 ; i 0 i < n i n i++ i++ i A[i] = Integer.parseInt(AStr[i]); A[i] = Integer.parseInt(AStr[i]) A[i] A i Integer.parseInt(AStr[i]) Integer.parseInt Integer AStr[i] AStr i selectSort(n,A) selectSort n A String[] args args public static void selectSort(int n,int[] A){
		int count = 0;
		for(int i = 0 ; i < n ; i++){
			int minIndex = i;
			for(int y = i + 1 ; y < n ; y++){
				if(A[minIndex] > A[y]){
					minIndex = y;
				}
			}
			if(minIndex != i){
				int tmp = A[minIndex];
				A[minIndex] = A[i];
				A[i] = tmp;
				count++;
			}
		}

		StringBuilder sb = new StringBuilder();
		for(int i = 0 ; i < n; i++){
			sb.append(A[i]);
			sb.append(" ");
		}
		sb.deleteCharAt(sb.length() - 1);
		System.out.println(sb.toString());
		System.out.println(count);
	} selectSort {
		int count = 0;
		for(int i = 0 ; i < n ; i++){
			int minIndex = i;
			for(int y = i + 1 ; y < n ; y++){
				if(A[minIndex] > A[y]){
					minIndex = y;
				}
			}
			if(minIndex != i){
				int tmp = A[minIndex];
				A[minIndex] = A[i];
				A[i] = tmp;
				count++;
			}
		}

		StringBuilder sb = new StringBuilder();
		for(int i = 0 ; i < n; i++){
			sb.append(A[i]);
			sb.append(" ");
		}
		sb.deleteCharAt(sb.length() - 1);
		System.out.println(sb.toString());
		System.out.println(count);
	} int count = 0; count 0 for(int i = 0 ; i < n ; i++){
			int minIndex = i;
			for(int y = i + 1 ; y < n ; y++){
				if(A[minIndex] > A[y]){
					minIndex = y;
				}
			}
			if(minIndex != i){
				int tmp = A[minIndex];
				A[minIndex] = A[i];
				A[i] = tmp;
				count++;
			}
		} int i = 0 ; int i = 0 ; i 0 i < n i n i++ i++ i {
			int minIndex = i;
			for(int y = i + 1 ; y < n ; y++){
				if(A[minIndex] > A[y]){
					minIndex = y;
				}
			}
			if(minIndex != i){
				int tmp = A[minIndex];
				A[minIndex] = A[i];
				A[i] = tmp;
				count++;
			}
		} {
			int minIndex = i;
			for(int y = i + 1 ; y < n ; y++){
				if(A[minIndex] > A[y]){
					minIndex = y;
				}
			}
			if(minIndex != i){
				int tmp = A[minIndex];
				A[minIndex] = A[i];
				A[i] = tmp;
				count++;
			}
		} int minIndex = i; minIndex i for(int y = i + 1 ; y < n ; y++){
				if(A[minIndex] > A[y]){
					minIndex = y;
				}
			} int y = i + 1 ; int y = i + 1 ; y i + 1 i 1 y < n y n y++ y++ y {
				if(A[minIndex] > A[y]){
					minIndex = y;
				}
			} {
				if(A[minIndex] > A[y]){
					minIndex = y;
				}
			} if(A[minIndex] > A[y]){
					minIndex = y;
				} A[minIndex] > A[y] A[minIndex] A minIndex A[y] A y {
					minIndex = y;
				} minIndex = y minIndex y if(minIndex != i){
				int tmp = A[minIndex];
				A[minIndex] = A[i];
				A[i] = tmp;
				count++;
			} minIndex != i minIndex i {
				int tmp = A[minIndex];
				A[minIndex] = A[i];
				A[i] = tmp;
				count++;
			} int tmp = A[minIndex]; tmp A[minIndex] A minIndex A[minIndex] = A[i] A[minIndex] A minIndex A[i] A i A[i] = tmp A[i] A i tmp count++ count StringBuilder sb = new StringBuilder(); sb new StringBuilder() for(int i = 0 ; i < n; i++){
			sb.append(A[i]);
			sb.append(" ");
		} int i = 0 ; int i = 0 ; i 0 i < n i n i++ i++ i {
			sb.append(A[i]);
			sb.append(" ");
		} {
			sb.append(A[i]);
			sb.append(" ");
		} sb.append(A[i]) sb.append sb A[i] A i sb.append(" ") sb.append sb " " sb.deleteCharAt(sb.length() - 1) sb.deleteCharAt sb sb.length() - 1 sb.length() sb.length sb 1 System.out.println(sb.toString()) System.out.println System.out System System.out sb.toString() sb.toString sb System.out.println(count) System.out.println System.out System System.out count int n n int[] A A public class Main {

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

		String AStr[] = br.readLine().split(" ");
		int A[] = new int[n];

		for(int i = 0 ; i < n ; i++) A[i] = Integer.parseInt(AStr[i]);

		selectSort(n,A);

	}

	public static void selectSort(int n,int[] A){
		int count = 0;
		for(int i = 0 ; i < n ; i++){
			int minIndex = i;
			for(int y = i + 1 ; y < n ; y++){
				if(A[minIndex] > A[y]){
					minIndex = y;
				}
			}
			if(minIndex != i){
				int tmp = A[minIndex];
				A[minIndex] = A[i];
				A[i] = tmp;
				count++;
			}
		}

		StringBuilder sb = new StringBuilder();
		for(int i = 0 ; i < n; i++){
			sb.append(A[i]);
			sb.append(" ");
		}
		sb.deleteCharAt(sb.length() - 1);
		System.out.println(sb.toString());
		System.out.println(count);
	}

} public class Main {

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

		String AStr[] = br.readLine().split(" ");
		int A[] = new int[n];

		for(int i = 0 ; i < n ; i++) A[i] = Integer.parseInt(AStr[i]);

		selectSort(n,A);

	}

	public static void selectSort(int n,int[] A){
		int count = 0;
		for(int i = 0 ; i < n ; i++){
			int minIndex = i;
			for(int y = i + 1 ; y < n ; y++){
				if(A[minIndex] > A[y]){
					minIndex = y;
				}
			}
			if(minIndex != i){
				int tmp = A[minIndex];
				A[minIndex] = A[i];
				A[i] = tmp;
				count++;
			}
		}

		StringBuilder sb = new StringBuilder();
		for(int i = 0 ; i < n; i++){
			sb.append(A[i]);
			sb.append(" ");
		}
		sb.deleteCharAt(sb.length() - 1);
		System.out.println(sb.toString());
		System.out.println(count);
	}

} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

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

		String AStr[] = br.readLine().split(" ");
		int A[] = new int[n];

		for(int i = 0 ; i < n ; i++) A[i] = Integer.parseInt(AStr[i]);

		selectSort(n,A);

	}

	public static void selectSort(int n,int[] A){
		int count = 0;
		for(int i = 0 ; i < n ; i++){
			int minIndex = i;
			for(int y = i + 1 ; y < n ; y++){
				if(A[minIndex] > A[y]){
					minIndex = y;
				}
			}
			if(minIndex != i){
				int tmp = A[minIndex];
				A[minIndex] = A[i];
				A[i] = tmp;
				count++;
			}
		}

		StringBuilder sb = new StringBuilder();
		for(int i = 0 ; i < n; i++){
			sb.append(A[i]);
			sb.append(" ");
		}
		sb.deleteCharAt(sb.length() - 1);
		System.out.println(sb.toString());
		System.out.println(count);
	}

}