using System;

class main{
    public static void Main(String[] args){

        int n = int.Parse(Console.ReadLine());
        int[] a = Array.ConvertAll(Console.ReadLine().Split(' '),int.Parse);

        int index;

        index = selectionSort(a,n);
        
        for(int i = 0; i < n; i++){
            if(i != n-1){
                Console.Write(a[i] + " ");
            }else{
                Console.WriteLine(a[i]);
            }
        }
        
        Console.WriteLine(index);
    }

    internal static int selectionSort(int[] a,int n){

        int[] A = a;
        int N = n;
        int index = 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;
                }
            }

            int temp = A[i];
            A[i] = A[minj];
            A[minj] = temp;
            index++;
        }

        return index;
    }
}