import java.util.*;
public class Main {
	Scanner sc = new Scanner(System.in);
	int N;
	int[] A;
	int minj,key;
	int count=0;
	
	public void input(){
		N=sc.nextInt();
		A = new int[N];
		for(int i=0; i<N; i++){
			A[i]=sc.nextInt();
		}
	}
	
	public void selectionsort(){
		for(int i=0; i<N-1; i++){
			minj=i;
			for(int j=i; j<=N-1; j++){
				if(A[j] < A[minj]){
					minj = j;
				}
			}
			key = A[i];
			A[i] = A[minj];
			A[minj] = key;
			if(i != minj) count++;
		}
	}
	
	public void output(){
		System.out.print(A[0]);
		for(int i=1; i<N; i++){
			System.out.print(" "+A[i]);
		}
		System.out.println("\n"+count);
	}
	
	public static void main(String[] args){
		Main obj = new Main();
		obj.input();
		obj.selectionsort();
		obj.output();
	}
}
 import java.util.*; util.* java public class Main {
	Scanner sc = new Scanner(System.in);
	int N;
	int[] A;
	int minj,key;
	int count=0;
	
	public void input(){
		N=sc.nextInt();
		A = new int[N];
		for(int i=0; i<N; i++){
			A[i]=sc.nextInt();
		}
	}
	
	public void selectionsort(){
		for(int i=0; i<N-1; i++){
			minj=i;
			for(int j=i; j<=N-1; j++){
				if(A[j] < A[minj]){
					minj = j;
				}
			}
			key = A[i];
			A[i] = A[minj];
			A[minj] = key;
			if(i != minj) count++;
		}
	}
	
	public void output(){
		System.out.print(A[0]);
		for(int i=1; i<N; i++){
			System.out.print(" "+A[i]);
		}
		System.out.println("\n"+count);
	}
	
	public static void main(String[] args){
		Main obj = new Main();
		obj.input();
		obj.selectionsort();
		obj.output();
	}
} Main Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N; N int[] A; A int minj minj key; key int count=0; count 0 public void input(){
		N=sc.nextInt();
		A = new int[N];
		for(int i=0; i<N; i++){
			A[i]=sc.nextInt();
		}
	} input {
		N=sc.nextInt();
		A = new int[N];
		for(int i=0; i<N; i++){
			A[i]=sc.nextInt();
		}
	} N=sc.nextInt() N sc.nextInt() sc.nextInt sc A = new int[N] A new int[N] N for(int i=0; i<N; i++){
			A[i]=sc.nextInt();
		} int i=0; int i=0; i 0 i<N i N i++ i++ i {
			A[i]=sc.nextInt();
		} {
			A[i]=sc.nextInt();
		} A[i]=sc.nextInt() A[i] A i sc.nextInt() sc.nextInt sc public void selectionsort(){
		for(int i=0; i<N-1; i++){
			minj=i;
			for(int j=i; j<=N-1; j++){
				if(A[j] < A[minj]){
					minj = j;
				}
			}
			key = A[i];
			A[i] = A[minj];
			A[minj] = key;
			if(i != minj) count++;
		}
	} selectionsort {
		for(int i=0; i<N-1; i++){
			minj=i;
			for(int j=i; j<=N-1; j++){
				if(A[j] < A[minj]){
					minj = j;
				}
			}
			key = A[i];
			A[i] = A[minj];
			A[minj] = key;
			if(i != minj) count++;
		}
	} for(int i=0; i<N-1; i++){
			minj=i;
			for(int j=i; j<=N-1; j++){
				if(A[j] < A[minj]){
					minj = j;
				}
			}
			key = A[i];
			A[i] = A[minj];
			A[minj] = key;
			if(i != minj) count++;
		} int i=0; int i=0; i 0 i<N-1 i N-1 N 1 i++ i++ i {
			minj=i;
			for(int j=i; j<=N-1; j++){
				if(A[j] < A[minj]){
					minj = j;
				}
			}
			key = A[i];
			A[i] = A[minj];
			A[minj] = key;
			if(i != minj) count++;
		} {
			minj=i;
			for(int j=i; j<=N-1; j++){
				if(A[j] < A[minj]){
					minj = j;
				}
			}
			key = A[i];
			A[i] = A[minj];
			A[minj] = key;
			if(i != minj) count++;
		} minj=i minj i for(int j=i; j<=N-1; j++){
				if(A[j] < A[minj]){
					minj = j;
				}
			} int j=i; int j=i; j i j<=N-1 j N-1 N 1 j++ j++ j {
				if(A[j] < A[minj]){
					minj = j;
				}
			} {
				if(A[j] < A[minj]){
					minj = j;
				}
			} if(A[j] < A[minj]){
					minj = j;
				} A[j] < A[minj] A[j] A j A[minj] A minj {
					minj = j;
				} minj = j minj j key = A[i] key A[i] A i A[i] = A[minj] A[i] A i A[minj] A minj A[minj] = key A[minj] A minj key if(i != minj) count++; i != minj i minj count++ count public void output(){
		System.out.print(A[0]);
		for(int i=1; i<N; i++){
			System.out.print(" "+A[i]);
		}
		System.out.println("\n"+count);
	} output {
		System.out.print(A[0]);
		for(int i=1; i<N; i++){
			System.out.print(" "+A[i]);
		}
		System.out.println("\n"+count);
	} System.out.print(A[0]) System.out.print System.out System System.out A[0] A 0 for(int i=1; i<N; i++){
			System.out.print(" "+A[i]);
		} int i=1; int i=1; i 1 i<N i N i++ i++ i {
			System.out.print(" "+A[i]);
		} {
			System.out.print(" "+A[i]);
		} System.out.print(" "+A[i]) System.out.print System.out System System.out " "+A[i] " " A[i] A i System.out.println("\n"+count) System.out.println System.out System System.out "\n"+count "\n" count public static void main(String[] args){
		Main obj = new Main();
		obj.input();
		obj.selectionsort();
		obj.output();
	} main {
		Main obj = new Main();
		obj.input();
		obj.selectionsort();
		obj.output();
	} Main obj = new Main(); obj new Main() obj.input() obj.input obj obj.selectionsort() obj.selectionsort obj obj.output() obj.output obj String[] args args public class Main {
	Scanner sc = new Scanner(System.in);
	int N;
	int[] A;
	int minj,key;
	int count=0;
	
	public void input(){
		N=sc.nextInt();
		A = new int[N];
		for(int i=0; i<N; i++){
			A[i]=sc.nextInt();
		}
	}
	
	public void selectionsort(){
		for(int i=0; i<N-1; i++){
			minj=i;
			for(int j=i; j<=N-1; j++){
				if(A[j] < A[minj]){
					minj = j;
				}
			}
			key = A[i];
			A[i] = A[minj];
			A[minj] = key;
			if(i != minj) count++;
		}
	}
	
	public void output(){
		System.out.print(A[0]);
		for(int i=1; i<N; i++){
			System.out.print(" "+A[i]);
		}
		System.out.println("\n"+count);
	}
	
	public static void main(String[] args){
		Main obj = new Main();
		obj.input();
		obj.selectionsort();
		obj.output();
	}
} public class Main {
	Scanner sc = new Scanner(System.in);
	int N;
	int[] A;
	int minj,key;
	int count=0;
	
	public void input(){
		N=sc.nextInt();
		A = new int[N];
		for(int i=0; i<N; i++){
			A[i]=sc.nextInt();
		}
	}
	
	public void selectionsort(){
		for(int i=0; i<N-1; i++){
			minj=i;
			for(int j=i; j<=N-1; j++){
				if(A[j] < A[minj]){
					minj = j;
				}
			}
			key = A[i];
			A[i] = A[minj];
			A[minj] = key;
			if(i != minj) count++;
		}
	}
	
	public void output(){
		System.out.print(A[0]);
		for(int i=1; i<N; i++){
			System.out.print(" "+A[i]);
		}
		System.out.println("\n"+count);
	}
	
	public static void main(String[] args){
		Main obj = new Main();
		obj.input();
		obj.selectionsort();
		obj.output();
	}
} Main
import java.util.*;
public class Main {
	Scanner sc = new Scanner(System.in);
	int N;
	int[] A;
	int minj,key;
	int count=0;
	
	public void input(){
		N=sc.nextInt();
		A = new int[N];
		for(int i=0; i<N; i++){
			A[i]=sc.nextInt();
		}
	}
	
	public void selectionsort(){
		for(int i=0; i<N-1; i++){
			minj=i;
			for(int j=i; j<=N-1; j++){
				if(A[j] < A[minj]){
					minj = j;
				}
			}
			key = A[i];
			A[i] = A[minj];
			A[minj] = key;
			if(i != minj) count++;
		}
	}
	
	public void output(){
		System.out.print(A[0]);
		for(int i=1; i<N; i++){
			System.out.print(" "+A[i]);
		}
		System.out.println("\n"+count);
	}
	
	public static void main(String[] args){
		Main obj = new Main();
		obj.input();
		obj.selectionsort();
		obj.output();
	}
}

