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);
    }
} import java.util.Scanner; Scanner java.util import java.util.Arrays; Arrays java.util 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);
    }
} 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);
    } main {
        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);
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = Integer.parseInt(scan.nextLine()); n Integer.parseInt(scan.nextLine()) Integer.parseInt Integer scan.nextLine() scan.nextLine scan String[] inputStr = scan.nextLine().split(" "); inputStr scan.nextLine().split(" ") scan.nextLine().split scan.nextLine() scan.nextLine scan " " int inputLen = inputStr.length; inputLen inputStr.length inputStr inputStr.length int[] inputInt = new int[inputLen]; inputInt new int[inputLen] inputLen for (int i=0; i<inputLen; i++){
            inputInt[i] = Integer.parseInt(inputStr[i]);
        } int i=0; int i=0; i 0 i<inputLen i inputLen i++ i++ i {
            inputInt[i] = Integer.parseInt(inputStr[i]);
        } {
            inputInt[i] = Integer.parseInt(inputStr[i]);
        } inputInt[i] = Integer.parseInt(inputStr[i]) inputInt[i] inputInt i Integer.parseInt(inputStr[i]) Integer.parseInt Integer inputStr[i] inputStr i int tmp; tmp int numExchange = 0; numExchange 0 int minj; 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;
        } int i=0; int i=0; i 0 i<inputLen-1 i inputLen-1 inputLen 1 i++ i++ 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;
        } {
            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;
        } minj = i minj i for (int j=i+1; j<inputLen; j++){
                if (inputInt[minj] > inputInt[j]){
                    minj = j;
                }
            } int j=i+1; int j=i+1; j i+1 i 1 j<inputLen j inputLen j++ j++ j {
                if (inputInt[minj] > inputInt[j]){
                    minj = j;
                }
            } {
                if (inputInt[minj] > inputInt[j]){
                    minj = j;
                }
            } if (inputInt[minj] > inputInt[j]){
                    minj = j;
                } inputInt[minj] > inputInt[j] inputInt[minj] inputInt minj inputInt[j] inputInt j {
                    minj = j;
                } minj = j minj j tmp = inputInt[i] tmp inputInt[i] inputInt i inputInt[i] = inputInt[minj] inputInt[i] inputInt i inputInt[minj] inputInt minj inputInt[minj] = tmp inputInt[minj] inputInt minj tmp if (i != minj)
                numExchange += 1; i != minj i minj numExchange += 1 numExchange 1 for (int i=0; i<inputLen; i++){
            inputStr[i] = String.valueOf(inputInt[i]);
        } int i=0; int i=0; i 0 i<inputLen i inputLen i++ i++ i {
            inputStr[i] = String.valueOf(inputInt[i]);
        } {
            inputStr[i] = String.valueOf(inputInt[i]);
        } inputStr[i] = String.valueOf(inputInt[i]) inputStr[i] inputStr i String.valueOf(inputInt[i]) String.valueOf String inputInt[i] inputInt i System.out.println(String.join(" ", inputStr)) System.out.println System.out System System.out String.join(" ", inputStr) String.join String " " inputStr System.out.println(numExchange) System.out.println System.out System System.out numExchange String[] args args
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);
    }
}