import java.util.Scanner;
import java.util.Arrays;

class Main{

    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);

        int n = Integer.parseInt(scan.nextLine());
        String[] inputStr = scan.nextLine().split(" ");
        int inputLen = inputStr.length;
        int[] inputInt = new int[inputLen];

        for (int i=0; i<inputLen; i++){
            inputInt[i] = Integer.parseInt(inputStr[i]);
        }

        int tmp;
        int numExchange = 0;
        int minj;
        for (int i=0; i<inputLen-1; i++){
            minj = i;
            for (int j=i+1; j<inputLen; j++){
                if (inputInt[minj] > inputInt[j]){
                    minj = j;
                }
            }
            tmp = inputInt[i];
            inputInt[i] = inputInt[minj];
            inputInt[minj] = tmp;
            if (i != minj)
                numExchange += 1;
        }
        for (int i=0; i<inputLen; i++){
            inputStr[i] = String.valueOf(inputInt[i]);
        }
        System.out.println(String.join(" ", inputStr));
        System.out.println(numExchange);
    }
}
/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz