using System;
using System.Linq;
using System.Text;

namespace ALDS1_2_B
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var line = Console.ReadLine();
            var array = line.Split(' ').Select(int.Parse).Cast<int>().ToArray();

            int swapCnt = selectionSort(array);
            Console.WriteLine($"{string.Join(" ", array)}");
            Console.WriteLine(swapCnt);
        }
        static int selectionSort(int[] array)
        {
            var swapCnt = 0;
            for (var i = 0; i < array.Length - 1; i++)
            {
                int min = array[i];
                var minIndex = i;
                for (var j = i + 1; j < array.Length; j++)
                {
                    if (array[j] < min)
                    {
                        min = array[j];
                        minIndex = j;
                    }
                }
                if (min != array[i])
                {
                    int tmp = array[i];
                    array[i] = array[minIndex];
                    array[minIndex] = tmp;
                    swapCnt++;
                }
            }
            return swapCnt;
        }
    }
}