using System;
using System.Text;

namespace ALDS1_2_B
{
    class Program
    {
        static void Main(string[] args)
        {
            string input = Console.ReadLine();
            int N = int.Parse(input);
            int[] list = new int[N];
            input = Console.ReadLine();
            string[] num = input.Split(' ');
            for (int i = 0; i < N; i++)
            {
                list[i] = int.Parse(num[i]);
            }

            selectionSort(list, N);

        }

        public static void selectionSort(int[] arr, int N)
        {
            bool flag = true;
            int tmp, minj;
            int count = 0;
            
            for (int i = 0; i < N; i++)
                {
                    minj = i;
                    for (int j = i; j < N; j++)
                    {
                        if (arr[j] < arr[minj])
                        {
                            minj = j;
                        }
                    }
                    if (i != minj)
                    {
                        tmp = arr[i];
                        arr[i] = arr[minj];
                        arr[minj] = tmp;
                        count++;
                    }
                }

            string output = ArrayJoin(arr);
            Console.WriteLine(output);
            Console.WriteLine(count);

        }

        private static string ArrayJoin(int[] arr)
        {
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < arr.Length; i++)
            {
                if (sb.Length > 0)
                {
                    sb.Append(" ");
                }
                sb.Append(arr[i]);
            }
            return sb.ToString();
        }
    }
}