// Selection_Sort.cs

using System;

class Selection_Sort {
	public static void Main() {

		int count = 0;
		string num = Console.ReadLine();
		int n = int.Parse(num);

		int[] a = new int[n]; // 5 6 4 2 1 3 

		string numbers_str = Console.ReadLine();
		string[] number_str = numbers_str.Split();
		for(int i = 0; i < n; i++) {
			a[i] = int.Parse(number_str[i]);
		}

		int min;
		int minn = 0;
		for(int i = 0; i < n - 1; i++) {
			min = a[i];
			for(int j = 1 + i; j < n; j++) {

				if(a[j] < min) {
					min = a[j];
					minn = Array.IndexOf(a, min);
				}
			}
			if(a[i] != min) {
				Swap(ref count,ref a[i], ref a[minn]);
			}

		}

		for(int i = 0; i < n; i++) {
			if(i != n - 1)
			Console.Write(a[i] + " ");
			else
			Console.WriteLine(a[i]);
		}
		Console.WriteLine(count);

	}


	static void Swap(ref int count, ref int x, ref int y) {

		int comp = x;
		x = y;
		y = comp;
		count++;

		return;
	}

}