using System;
using System.Linq;
using System.Text;

public class Solution{
    public static void Main(){
        // Here your code !
        var n = int.Parse(Console.ReadLine());
        long[] A = Array.ConvertAll(
                Console.ReadLine().Split(' '),
                new Converter<string,long>( s => long.Parse(s) ));

        long mini;
        long c = 0;
        
        for(var i = 0 ; i < n; i++){
            mini = i;
            for(var j = i; j < n; j++){
                if(A[j] < A[mini]){
                    mini = j;
                }
            }
            Swap(ref A[mini], ref A[i]);
            if(mini != i){
                c++;
            }
        }
        Console.WriteLine(String.Join(" ", A));
        Console.WriteLine(c);
    }
    static void Swap<T>(ref T lhs, ref T rhs)
    {
        T temp;
        temp = lhs;
        lhs = rhs;
        rhs = temp;
    }
}