import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		int n = stdIn.nextInt();
		int[] a = new int[n];
		int i;
		
		for (i = 0; i < n; i++)
			a[i] = stdIn.nextInt();
		
		int count = SelectionSort(a, n);
		
		System.out.print(a[0]);
		for (i = 1; i < n; i++)
			System.out.print(" " + a[i]);
		System.out.println();
		System.out.println(count);
	}
	
	public static int SelectionSort(int[] a, int n) {
		int i, j, minat, t, count = 0;
		for (i = 0; i < n; i++) {
			minat = i;
			for (j = i + 1; j < n; j++)
				if (a[j] < a[minat])
					minat = j;
			if (i != minat) {
				t = a[i];
				a[i] = a[minat];
				a[minat] = t;
				count++;
			}
		}
		return count;
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		int n = stdIn.nextInt();
		int[] a = new int[n];
		int i;
		
		for (i = 0; i < n; i++)
			a[i] = stdIn.nextInt();
		
		int count = SelectionSort(a, n);
		
		System.out.print(a[0]);
		for (i = 1; i < n; i++)
			System.out.print(" " + a[i]);
		System.out.println();
		System.out.println(count);
	}
	
	public static int SelectionSort(int[] a, int n) {
		int i, j, minat, t, count = 0;
		for (i = 0; i < n; i++) {
			minat = i;
			for (j = i + 1; j < n; j++)
				if (a[j] < a[minat])
					minat = j;
			if (i != minat) {
				t = a[i];
				a[i] = a[minat];
				a[minat] = t;
				count++;
			}
		}
		return count;
	}
} Main public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		int n = stdIn.nextInt();
		int[] a = new int[n];
		int i;
		
		for (i = 0; i < n; i++)
			a[i] = stdIn.nextInt();
		
		int count = SelectionSort(a, n);
		
		System.out.print(a[0]);
		for (i = 1; i < n; i++)
			System.out.print(" " + a[i]);
		System.out.println();
		System.out.println(count);
	} main {
		Scanner stdIn = new Scanner(System.in);
		
		int n = stdIn.nextInt();
		int[] a = new int[n];
		int i;
		
		for (i = 0; i < n; i++)
			a[i] = stdIn.nextInt();
		
		int count = SelectionSort(a, n);
		
		System.out.print(a[0]);
		for (i = 1; i < n; i++)
			System.out.print(" " + a[i]);
		System.out.println();
		System.out.println(count);
	} Scanner stdIn = new Scanner(System.in); stdIn new Scanner(System.in) int n = stdIn.nextInt(); n stdIn.nextInt() stdIn.nextInt stdIn int[] a = new int[n]; a new int[n] n int i; i for (i = 0; i < n; i++)
			a[i] = stdIn.nextInt(); i = 0; i = 0 i 0 i < n i n i++ i++ i a[i] = stdIn.nextInt(); a[i] = stdIn.nextInt() a[i] a i stdIn.nextInt() stdIn.nextInt stdIn int count = SelectionSort(a, n); count SelectionSort(a, n) SelectionSort a n System.out.print(a[0]) System.out.print System.out System System.out a[0] a 0 for (i = 1; i < n; i++)
			System.out.print(" " + a[i]); i = 1; i = 1 i 1 i < n i n i++ i++ 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() System.out.println System.out System System.out System.out.println(count) System.out.println System.out System System.out count String[] args args public static int SelectionSort(int[] a, int n) {
		int i, j, minat, t, count = 0;
		for (i = 0; i < n; i++) {
			minat = i;
			for (j = i + 1; j < n; j++)
				if (a[j] < a[minat])
					minat = j;
			if (i != minat) {
				t = a[i];
				a[i] = a[minat];
				a[minat] = t;
				count++;
			}
		}
		return count;
	} SelectionSort {
		int i, j, minat, t, count = 0;
		for (i = 0; i < n; i++) {
			minat = i;
			for (j = i + 1; j < n; j++)
				if (a[j] < a[minat])
					minat = j;
			if (i != minat) {
				t = a[i];
				a[i] = a[minat];
				a[minat] = t;
				count++;
			}
		}
		return count;
	} int i i j j minat minat t t count = 0; count 0 for (i = 0; i < n; i++) {
			minat = i;
			for (j = i + 1; j < n; j++)
				if (a[j] < a[minat])
					minat = j;
			if (i != minat) {
				t = a[i];
				a[i] = a[minat];
				a[minat] = t;
				count++;
			}
		} i = 0; i = 0 i 0 i < n i n i++ i++ i {
			minat = i;
			for (j = i + 1; j < n; j++)
				if (a[j] < a[minat])
					minat = j;
			if (i != minat) {
				t = a[i];
				a[i] = a[minat];
				a[minat] = t;
				count++;
			}
		} {
			minat = i;
			for (j = i + 1; j < n; j++)
				if (a[j] < a[minat])
					minat = j;
			if (i != minat) {
				t = a[i];
				a[i] = a[minat];
				a[minat] = t;
				count++;
			}
		} minat = i minat i for (j = i + 1; j < n; j++)
				if (a[j] < a[minat])
					minat = j; j = i + 1; j = i + 1 j i + 1 i 1 j < n j n j++ j++ j if (a[j] < a[minat])
					minat = j; if (a[j] < a[minat])
					minat = j; a[j] < a[minat] a[j] a j a[minat] a minat minat = j minat j if (i != minat) {
				t = a[i];
				a[i] = a[minat];
				a[minat] = t;
				count++;
			} i != minat i minat {
				t = a[i];
				a[i] = a[minat];
				a[minat] = t;
				count++;
			} t = a[i] t a[i] a i a[i] = a[minat] a[i] a i a[minat] a minat a[minat] = t a[minat] a minat t count++ count return count; count int[] a a int n n public class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		int n = stdIn.nextInt();
		int[] a = new int[n];
		int i;
		
		for (i = 0; i < n; i++)
			a[i] = stdIn.nextInt();
		
		int count = SelectionSort(a, n);
		
		System.out.print(a[0]);
		for (i = 1; i < n; i++)
			System.out.print(" " + a[i]);
		System.out.println();
		System.out.println(count);
	}
	
	public static int SelectionSort(int[] a, int n) {
		int i, j, minat, t, count = 0;
		for (i = 0; i < n; i++) {
			minat = i;
			for (j = i + 1; j < n; j++)
				if (a[j] < a[minat])
					minat = j;
			if (i != minat) {
				t = a[i];
				a[i] = a[minat];
				a[minat] = t;
				count++;
			}
		}
		return count;
	}
} public class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		int n = stdIn.nextInt();
		int[] a = new int[n];
		int i;
		
		for (i = 0; i < n; i++)
			a[i] = stdIn.nextInt();
		
		int count = SelectionSort(a, n);
		
		System.out.print(a[0]);
		for (i = 1; i < n; i++)
			System.out.print(" " + a[i]);
		System.out.println();
		System.out.println(count);
	}
	
	public static int SelectionSort(int[] a, int n) {
		int i, j, minat, t, count = 0;
		for (i = 0; i < n; i++) {
			minat = i;
			for (j = i + 1; j < n; j++)
				if (a[j] < a[minat])
					minat = j;
			if (i != minat) {
				t = a[i];
				a[i] = a[minat];
				a[minat] = t;
				count++;
			}
		}
		return count;
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		int n = stdIn.nextInt();
		int[] a = new int[n];
		int i;
		
		for (i = 0; i < n; i++)
			a[i] = stdIn.nextInt();
		
		int count = SelectionSort(a, n);
		
		System.out.print(a[0]);
		for (i = 1; i < n; i++)
			System.out.print(" " + a[i]);
		System.out.println();
		System.out.println(count);
	}
	
	public static int SelectionSort(int[] a, int n) {
		int i, j, minat, t, count = 0;
		for (i = 0; i < n; i++) {
			minat = i;
			for (j = i + 1; j < n; j++)
				if (a[j] < a[minat])
					minat = j;
			if (i != minat) {
				t = a[i];
				a[i] = a[minat];
				a[minat] = t;
				count++;
			}
		}
		return count;
	}
}