using System;


class Program
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        string[] s = Console.ReadLine().Split(' ');
        int[] a = new int[n];
        for (int i = 0; i < s.Length; i++)
            a[i] = int.Parse(s[i]);

        int count = 0;
        for (int i = 0; i < a.Length; i++)
        {
            int minj = i;
            for (int j = i; j < a.Length; j++)
            {
                if (a[minj] > a[j])
                {
                    minj = j;
                }
            }
            if (a[i] != a[minj])
            {
                int tmp = a[i];
                a[i] = a[minj];
                a[minj] = tmp;
                count++;
            }
        }

        foreach (int x in a)
        {
            if (x != a[a.Length - 1])
                Console.Write("{0} ", x);
            else
                Console.WriteLine("{0}", x);
        }
        Console.WriteLine(count);

    }
}