using System;

namespace teisyutusensei
{
    class Program
    {
        static void Main(string[] args)
        {
            ////?????????????????????

            int count = 0;

            string dmmy = Console.ReadLine();

            int n = int.Parse(dmmy);

            string dmmy1 = Console.ReadLine();

            string[] dmmySP = new string[n];

            char del = ' ';

            dmmySP = dmmy1.Split(del);

            int[] A = new int[n];

            for (int i = 0; i < n; i++)
            {
                A[i] = int.Parse(dmmySP[i]);
            }

            int minj = 0;
            int D = 0;

            for (int i = 0; i < n; i++)
            {
                minj = i;

                for (int j = i; j < n; j++)
                {
                    if(A[j] < A[minj])
                    {
                        minj = j;
                    }
                }

                if (A[i] != A[minj])
                {
                    D = A[i];

                    A[i] = A[minj];
                    A[minj] = D;
                    count++;
                }

            }

            string[] K = new string[n];

            for (int i = 0; i < n; i++)
            {                
                K[i] = A[i].ToString();
            }

            string result = string.Join(" ", A);


            Console.WriteLine(result);

            Console.WriteLine(count);
            Console.ReadLine();

        }
    }

}