using System;
using System.Linq;

namespace Sort_I
{
    class Selection_Sort
    {
        static void Main(string[] args)
        {
            Console.ReadLine();
            var A = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
            var n = SelectionSort(A);
            for (int i = 0; i < A.Length - 1; i++)
            {
                Console.Write(A[i] + " ");
            }
            Console.WriteLine(A.Last());
            Console.WriteLine(n);
        }

        static int SelectionSort(int[] A)
        {
            var n = 0;
            for (int i = 0; i < A.Length; i++)
            {
                var minj = i;
                for (int j = i; j < A.Length ; j++)
                    if (A[j] < A[minj])
                        minj = j;

                var temp = A[i];
                A[i] = A[minj];
                A[minj] = temp;
                n++;
            }
            return n;
        }
    }
}