import java.util.Arrays;

public class Main {
    // field

    // method
    public static void main(String[] args) {
	//System.out.print("> ");
	java.util.Scanner scan = new java.util.Scanner(System.in);
	int arraySize = scan.nextInt();
	String[] input = new String[arraySize];
	int[] array = new int[arraySize];
	//System.out.print("> ");
	for (int i = 0; i < arraySize; i++){
	    array[i] = scan.nextInt();
	}
	
	SelectionSort ss = new SelectionSort(array.clone()); // セレクションソート
	ss.selectionSort(); // ソート
	ss.display();       // 表示
	System.out.println(ss.getCount());
	
    }
}
class SelectionSort {
    // -- Field
    private int[] sort_array;
    protected int count;
    // -- Constructor
    private SelectionSort() {}
    public SelectionSort(int[] sort_array) {
	this.sort_array = sort_array;
    }
    
    // -- Method
    public void display() {
	for (int i = 0; i < this.sort_array.length; i++) {
	    System.out.print(this.sort_array[i]);
	    if(i == this.sort_array.length-1) {
		break;
	    }
	    System.out.print(" ");
	}
	System.out.println();
    }


    public void swap(int x, int y) {
	int temp = this.sort_array[x];
	this.sort_array[x] = this.sort_array[y];
	this.sort_array[y] = temp;
    }

    public void selectionSort() {
	int out, in, min;
	for (out = 0; out < this.sort_array.length - 1; out++) {
	    min = out;
	    for (in = out + 1; in < this.sort_array.length; in++) {
		if (this.sort_array[in] < this.sort_array[min]) {
		    min = in;
		}
	    }
	    if (out != min) this.count++;
	    this.swap(out, min);
	}
    }
    public int getCount() {
	return this.count;
    }
}
 import java.util.Arrays; Arrays java.util public class Main {
    // field

    // method
    public static void main(String[] args) {
	//System.out.print("> ");
	java.util.Scanner scan = new java.util.Scanner(System.in);
	int arraySize = scan.nextInt();
	String[] input = new String[arraySize];
	int[] array = new int[arraySize];
	//System.out.print("> ");
	for (int i = 0; i < arraySize; i++){
	    array[i] = scan.nextInt();
	}
	
	SelectionSort ss = new SelectionSort(array.clone()); // セレクションソート
	ss.selectionSort(); // ソート
	ss.display();       // 表示
	System.out.println(ss.getCount());
	
    }
} Main // method
    public static void main(String[] args) {
	//System.out.print("> ");
	java.util.Scanner scan = new java.util.Scanner(System.in);
	int arraySize = scan.nextInt();
	String[] input = new String[arraySize];
	int[] array = new int[arraySize];
	//System.out.print("> ");
	for (int i = 0; i < arraySize; i++){
	    array[i] = scan.nextInt();
	}
	
	SelectionSort ss = new SelectionSort(array.clone()); // セレクションソート
	ss.selectionSort(); // ソート
	ss.display();       // 表示
	System.out.println(ss.getCount());
	
    } main {
	//System.out.print("> ");
	java.util.Scanner scan = new java.util.Scanner(System.in);
	int arraySize = scan.nextInt();
	String[] input = new String[arraySize];
	int[] array = new int[arraySize];
	//System.out.print("> ");
	for (int i = 0; i < arraySize; i++){
	    array[i] = scan.nextInt();
	}
	
	SelectionSort ss = new SelectionSort(array.clone()); // セレクションソート
	ss.selectionSort(); // ソート
	ss.display();       // 表示
	System.out.println(ss.getCount());
	
    } java.util.Scanner scan = new java.util.Scanner(System.in); scan new java.util.Scanner(System.in) int arraySize = scan.nextInt(); arraySize scan.nextInt() scan.nextInt scan String[] input = new String[arraySize]; input new String[arraySize] arraySize int[] array = new int[arraySize]; array new int[arraySize] arraySize for (int i = 0; i < arraySize; i++){
	    array[i] = scan.nextInt();
	} int i = 0; int i = 0; i 0 i < arraySize i arraySize i++ i++ i {
	    array[i] = scan.nextInt();
	} {
	    array[i] = scan.nextInt();
	} array[i] = scan.nextInt() array[i] array i scan.nextInt() scan.nextInt scan SelectionSort ss = new SelectionSort(array.clone()); ss new SelectionSort(array.clone()) ss.selectionSort() ss.selectionSort ss ss.display() ss.display ss System.out.println(ss.getCount()) System.out.println System.out System System.out ss.getCount() ss.getCount ss String[] args args class SelectionSort {
    // -- Field
    private int[] sort_array;
    protected int count;
    // -- Constructor
    private SelectionSort() {}
    public SelectionSort(int[] sort_array) {
	this.sort_array = sort_array;
    }
    
    // -- Method
    public void display() {
	for (int i = 0; i < this.sort_array.length; i++) {
	    System.out.print(this.sort_array[i]);
	    if(i == this.sort_array.length-1) {
		break;
	    }
	    System.out.print(" ");
	}
	System.out.println();
    }


    public void swap(int x, int y) {
	int temp = this.sort_array[x];
	this.sort_array[x] = this.sort_array[y];
	this.sort_array[y] = temp;
    }

    public void selectionSort() {
	int out, in, min;
	for (out = 0; out < this.sort_array.length - 1; out++) {
	    min = out;
	    for (in = out + 1; in < this.sort_array.length; in++) {
		if (this.sort_array[in] < this.sort_array[min]) {
		    min = in;
		}
	    }
	    if (out != min) this.count++;
	    this.swap(out, min);
	}
    }
    public int getCount() {
	return this.count;
    }
} SelectionSort // -- Field
    private int[] sort_array; sort_array protected int count; count // -- Constructor
    private SelectionSort() {} SelectionSort {} public SelectionSort(int[] sort_array) {
	this.sort_array = sort_array;
    } SelectionSort {
	this.sort_array = sort_array;
    } this.sort_array = sort_array this.sort_array this this.sort_array sort_array int[] sort_array sort_array // -- Method
    public void display() {
	for (int i = 0; i < this.sort_array.length; i++) {
	    System.out.print(this.sort_array[i]);
	    if(i == this.sort_array.length-1) {
		break;
	    }
	    System.out.print(" ");
	}
	System.out.println();
    } display {
	for (int i = 0; i < this.sort_array.length; i++) {
	    System.out.print(this.sort_array[i]);
	    if(i == this.sort_array.length-1) {
		break;
	    }
	    System.out.print(" ");
	}
	System.out.println();
    } for (int i = 0; i < this.sort_array.length; i++) {
	    System.out.print(this.sort_array[i]);
	    if(i == this.sort_array.length-1) {
		break;
	    }
	    System.out.print(" ");
	} int i = 0; int i = 0; i 0 i < this.sort_array.length i this.sort_array.length this.sort_array this this.sort_array this.sort_array.length i++ i++ i {
	    System.out.print(this.sort_array[i]);
	    if(i == this.sort_array.length-1) {
		break;
	    }
	    System.out.print(" ");
	} {
	    System.out.print(this.sort_array[i]);
	    if(i == this.sort_array.length-1) {
		break;
	    }
	    System.out.print(" ");
	} System.out.print(this.sort_array[i]) System.out.print System.out System System.out this.sort_array[i] this.sort_array this this.sort_array i if(i == this.sort_array.length-1) {
		break;
	    } i == this.sort_array.length-1 i this.sort_array.length-1 this.sort_array.length this.sort_array this this.sort_array this.sort_array.length 1 {
		break;
	    } break; System.out.print(" ") System.out.print System.out System System.out " " System.out.println() System.out.println System.out System System.out public void swap(int x, int y) {
	int temp = this.sort_array[x];
	this.sort_array[x] = this.sort_array[y];
	this.sort_array[y] = temp;
    } swap {
	int temp = this.sort_array[x];
	this.sort_array[x] = this.sort_array[y];
	this.sort_array[y] = temp;
    } int temp = this.sort_array[x]; temp this.sort_array[x] this.sort_array this this.sort_array x this.sort_array[x] = this.sort_array[y] this.sort_array[x] this.sort_array this this.sort_array x this.sort_array[y] this.sort_array this this.sort_array y this.sort_array[y] = temp this.sort_array[y] this.sort_array this this.sort_array y temp int x x int y y public void selectionSort() {
	int out, in, min;
	for (out = 0; out < this.sort_array.length - 1; out++) {
	    min = out;
	    for (in = out + 1; in < this.sort_array.length; in++) {
		if (this.sort_array[in] < this.sort_array[min]) {
		    min = in;
		}
	    }
	    if (out != min) this.count++;
	    this.swap(out, min);
	}
    } selectionSort {
	int out, in, min;
	for (out = 0; out < this.sort_array.length - 1; out++) {
	    min = out;
	    for (in = out + 1; in < this.sort_array.length; in++) {
		if (this.sort_array[in] < this.sort_array[min]) {
		    min = in;
		}
	    }
	    if (out != min) this.count++;
	    this.swap(out, min);
	}
    } int out out in in min; min for (out = 0; out < this.sort_array.length - 1; out++) {
	    min = out;
	    for (in = out + 1; in < this.sort_array.length; in++) {
		if (this.sort_array[in] < this.sort_array[min]) {
		    min = in;
		}
	    }
	    if (out != min) this.count++;
	    this.swap(out, min);
	} out = 0; out = 0 out 0 out < this.sort_array.length - 1 out this.sort_array.length - 1 this.sort_array.length this.sort_array this this.sort_array this.sort_array.length 1 out++ out++ out {
	    min = out;
	    for (in = out + 1; in < this.sort_array.length; in++) {
		if (this.sort_array[in] < this.sort_array[min]) {
		    min = in;
		}
	    }
	    if (out != min) this.count++;
	    this.swap(out, min);
	} {
	    min = out;
	    for (in = out + 1; in < this.sort_array.length; in++) {
		if (this.sort_array[in] < this.sort_array[min]) {
		    min = in;
		}
	    }
	    if (out != min) this.count++;
	    this.swap(out, min);
	} min = out min out for (in = out + 1; in < this.sort_array.length; in++) {
		if (this.sort_array[in] < this.sort_array[min]) {
		    min = in;
		}
	    } in = out + 1; in = out + 1 in out + 1 out 1 in < this.sort_array.length in this.sort_array.length this.sort_array this this.sort_array this.sort_array.length in++ in++ in {
		if (this.sort_array[in] < this.sort_array[min]) {
		    min = in;
		}
	    } {
		if (this.sort_array[in] < this.sort_array[min]) {
		    min = in;
		}
	    } if (this.sort_array[in] < this.sort_array[min]) {
		    min = in;
		} this.sort_array[in] < this.sort_array[min] this.sort_array[in] this.sort_array this this.sort_array in this.sort_array[min] this.sort_array this this.sort_array min {
		    min = in;
		} min = in min in if (out != min) this.count++; out != min out min this.count++ this.count this this.count this.swap(out, min) this.swap this out min public int getCount() {
	return this.count;
    } getCount {
	return this.count;
    } return this.count; this.count this this.count public class Main {
    // field

    // method
    public static void main(String[] args) {
	//System.out.print("> ");
	java.util.Scanner scan = new java.util.Scanner(System.in);
	int arraySize = scan.nextInt();
	String[] input = new String[arraySize];
	int[] array = new int[arraySize];
	//System.out.print("> ");
	for (int i = 0; i < arraySize; i++){
	    array[i] = scan.nextInt();
	}
	
	SelectionSort ss = new SelectionSort(array.clone()); // セレクションソート
	ss.selectionSort(); // ソート
	ss.display();       // 表示
	System.out.println(ss.getCount());
	
    }
} public class Main {
    // field

    // method
    public static void main(String[] args) {
	//System.out.print("> ");
	java.util.Scanner scan = new java.util.Scanner(System.in);
	int arraySize = scan.nextInt();
	String[] input = new String[arraySize];
	int[] array = new int[arraySize];
	//System.out.print("> ");
	for (int i = 0; i < arraySize; i++){
	    array[i] = scan.nextInt();
	}
	
	SelectionSort ss = new SelectionSort(array.clone()); // セレクションソート
	ss.selectionSort(); // ソート
	ss.display();       // 表示
	System.out.println(ss.getCount());
	
    }
} Main
import java.util.Arrays;

public class Main {
    // field

    // method
    public static void main(String[] args) {
	//System.out.print("> ");
	java.util.Scanner scan = new java.util.Scanner(System.in);
	int arraySize = scan.nextInt();
	String[] input = new String[arraySize];
	int[] array = new int[arraySize];
	//System.out.print("> ");
	for (int i = 0; i < arraySize; i++){
	    array[i] = scan.nextInt();
	}
	
	SelectionSort ss = new SelectionSort(array.clone()); // セレクションソート
	ss.selectionSort(); // ソート
	ss.display();       // 表示
	System.out.println(ss.getCount());
	
    }
}
class SelectionSort {
    // -- Field
    private int[] sort_array;
    protected int count;
    // -- Constructor
    private SelectionSort() {}
    public SelectionSort(int[] sort_array) {
	this.sort_array = sort_array;
    }
    
    // -- Method
    public void display() {
	for (int i = 0; i < this.sort_array.length; i++) {
	    System.out.print(this.sort_array[i]);
	    if(i == this.sort_array.length-1) {
		break;
	    }
	    System.out.print(" ");
	}
	System.out.println();
    }


    public void swap(int x, int y) {
	int temp = this.sort_array[x];
	this.sort_array[x] = this.sort_array[y];
	this.sort_array[y] = temp;
    }

    public void selectionSort() {
	int out, in, min;
	for (out = 0; out < this.sort_array.length - 1; out++) {
	    min = out;
	    for (in = out + 1; in < this.sort_array.length; in++) {
		if (this.sort_array[in] < this.sort_array[min]) {
		    min = in;
		}
	    }
	    if (out != min) this.count++;
	    this.swap(out, min);
	}
    }
    public int getCount() {
	return this.count;
    }
}

