using System;
using System.Collections.Generic;
using System.Linq;
using System.Collections;
using System.Linq.Expressions;

static class Program
{
    static void Main()
    {
        new Magatro().Solve();
    }
}

class Magatro
{
    private int N;
    private int[] A;
    private void Scan()
    {
        N = int.Parse(Console.ReadLine());
        A = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
    }

    private void Swap(ref int a, ref int b)
    {
        a ^= b;
        b ^= a;
        a ^= b;
    }

    public void Solve()
    {
        Scan();
        int cnt = 0;
        for (int i = 0; i < N; i++)
        {
            int minj = i;
            for (int j = i; j < N; j++)
            {
                if (A[j] < A[minj])
                {
                    minj = j;
                }
            }
            if (i != minj)
            {
                cnt++;
                Swap(ref A[i], ref A[minj]);
            }
        }
        Console.WriteLine(string.Join(" ", A));
        Console.WriteLine(cnt);
    }
}