using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AthleteProgramming
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] array = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int count = 0;

            for(int i = 0; i < n-1; i++)
            {
                int min =i;
                int j = i;
                for (; j < n; j++)
                {
                    if (array[j] < array[min])
                    {
                        min = j;
                        
                    }
                }
                if (min!=i)
                {
                    Swap(ref array[i], ref array[min]);
                    count++;
                }

            }
            for(int i = 0; i < n - 1; i++)
            {
                Console.Write("{0} ", array[i]);
            }
            Console.WriteLine(array[n-1]);
            Console.WriteLine(count);

        }

        static void Swap(ref int a, ref int b)
        {
            int tmp = a;
            a = b;
            b = tmp;
        }

    }
}