using System.Collections.Generic;
using System.Linq;
public class PictureMatching
    {
        private static int[] Item;

        public static void Main(string[] args)
        {
            Input();
            Method();
            System.Console.ReadLine();
        }

        private static void Input()
        {
            System.Console.ReadLine();
            Item = ToIntArray(System.Console.ReadLine().Split(' '));
        }

        private static void Method()
        {
            int cnt = 0;
            for (int i = 0; i < Item.Length - 1; i++)
            {
                int mini = i;
                for (int j = i; j < Item.Length; j++)
                {
                    if (Item[j] < Item[mini])
                    {
                        mini = j;
                    }
                }
                if (mini != i)
                {
                    var temp = Item[mini];
                    Item[mini] = Item[i];
                    Item[i] = temp;
                    cnt++;
                }
            }
            ConsoleWrite();
            System.Console.WriteLine(cnt);
        }

        private static void ConsoleWrite()
        {
            for (int i = 0; i < Item.Length; i++)
            {
                System.Console.Write(Item[i]);
                if (i != Item.Length - 1)
                {
                    System.Console.Write(" ");
                }
            }
            System.Console.WriteLine("");
        }

        private static int[] ToIntArray(string[] str)
        {
            IEnumerable<int> intArray = str.Select(x => int.Parse(x));
            return intArray.ToArray();
        }