import java.util.*;

class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.nextLine());
        String[] line = sc.nextLine().split(" ");
        int[] arr = new int[n];
        int temp;
        int count = 0;
        for(int x = 0; x < n; x++){
            arr[x] = Integer.parseInt(line[x]);
        }

        for(int i=0; i < n; i++){
            int min = i;
            for(int j = i+1; j < n; j++){
                if(arr[min] > arr[j]){
                    min = j;
                }
            }
            if(i != min){
                temp = arr[i];
                arr[i] = arr[min];
                arr[min] = temp;
                count++;
            }
        }
        for(int x = 0; x < n; x++){
            if(x == n-1){
                System.out.println(arr[x]);
            }else{
                System.out.print(arr[x]);
                System.out.print(" ");
            }
        }
        System.out.println(count);
        

    }
} import java.util.*; util.* java class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.nextLine());
        String[] line = sc.nextLine().split(" ");
        int[] arr = new int[n];
        int temp;
        int count = 0;
        for(int x = 0; x < n; x++){
            arr[x] = Integer.parseInt(line[x]);
        }

        for(int i=0; i < n; i++){
            int min = i;
            for(int j = i+1; j < n; j++){
                if(arr[min] > arr[j]){
                    min = j;
                }
            }
            if(i != min){
                temp = arr[i];
                arr[i] = arr[min];
                arr[min] = temp;
                count++;
            }
        }
        for(int x = 0; x < n; x++){
            if(x == n-1){
                System.out.println(arr[x]);
            }else{
                System.out.print(arr[x]);
                System.out.print(" ");
            }
        }
        System.out.println(count);
        

    }
} Main public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.nextLine());
        String[] line = sc.nextLine().split(" ");
        int[] arr = new int[n];
        int temp;
        int count = 0;
        for(int x = 0; x < n; x++){
            arr[x] = Integer.parseInt(line[x]);
        }

        for(int i=0; i < n; i++){
            int min = i;
            for(int j = i+1; j < n; j++){
                if(arr[min] > arr[j]){
                    min = j;
                }
            }
            if(i != min){
                temp = arr[i];
                arr[i] = arr[min];
                arr[min] = temp;
                count++;
            }
        }
        for(int x = 0; x < n; x++){
            if(x == n-1){
                System.out.println(arr[x]);
            }else{
                System.out.print(arr[x]);
                System.out.print(" ");
            }
        }
        System.out.println(count);
        

    } main {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.nextLine());
        String[] line = sc.nextLine().split(" ");
        int[] arr = new int[n];
        int temp;
        int count = 0;
        for(int x = 0; x < n; x++){
            arr[x] = Integer.parseInt(line[x]);
        }

        for(int i=0; i < n; i++){
            int min = i;
            for(int j = i+1; j < n; j++){
                if(arr[min] > arr[j]){
                    min = j;
                }
            }
            if(i != min){
                temp = arr[i];
                arr[i] = arr[min];
                arr[min] = temp;
                count++;
            }
        }
        for(int x = 0; x < n; x++){
            if(x == n-1){
                System.out.println(arr[x]);
            }else{
                System.out.print(arr[x]);
                System.out.print(" ");
            }
        }
        System.out.println(count);
        

    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = Integer.parseInt(sc.nextLine()); n Integer.parseInt(sc.nextLine()) Integer.parseInt Integer sc.nextLine() sc.nextLine sc String[] line = sc.nextLine().split(" "); line sc.nextLine().split(" ") sc.nextLine().split sc.nextLine() sc.nextLine sc " " int[] arr = new int[n]; arr new int[n] n int temp; temp int count = 0; count 0 for(int x = 0; x < n; x++){
            arr[x] = Integer.parseInt(line[x]);
        } int x = 0; int x = 0; x 0 x < n x n x++ x++ x {
            arr[x] = Integer.parseInt(line[x]);
        } {
            arr[x] = Integer.parseInt(line[x]);
        } arr[x] = Integer.parseInt(line[x]) arr[x] arr x Integer.parseInt(line[x]) Integer.parseInt Integer line[x] line x for(int i=0; i < n; i++){
            int min = i;
            for(int j = i+1; j < n; j++){
                if(arr[min] > arr[j]){
                    min = j;
                }
            }
            if(i != min){
                temp = arr[i];
                arr[i] = arr[min];
                arr[min] = temp;
                count++;
            }
        } int i=0; int i=0; i 0 i < n i n i++ i++ i {
            int min = i;
            for(int j = i+1; j < n; j++){
                if(arr[min] > arr[j]){
                    min = j;
                }
            }
            if(i != min){
                temp = arr[i];
                arr[i] = arr[min];
                arr[min] = temp;
                count++;
            }
        } {
            int min = i;
            for(int j = i+1; j < n; j++){
                if(arr[min] > arr[j]){
                    min = j;
                }
            }
            if(i != min){
                temp = arr[i];
                arr[i] = arr[min];
                arr[min] = temp;
                count++;
            }
        } int min = i; min i for(int j = i+1; j < n; j++){
                if(arr[min] > arr[j]){
                    min = j;
                }
            } int j = i+1; int j = i+1; j i+1 i 1 j < n j n j++ j++ j {
                if(arr[min] > arr[j]){
                    min = j;
                }
            } {
                if(arr[min] > arr[j]){
                    min = j;
                }
            } if(arr[min] > arr[j]){
                    min = j;
                } arr[min] > arr[j] arr[min] arr min arr[j] arr j {
                    min = j;
                } min = j min j if(i != min){
                temp = arr[i];
                arr[i] = arr[min];
                arr[min] = temp;
                count++;
            } i != min i min {
                temp = arr[i];
                arr[i] = arr[min];
                arr[min] = temp;
                count++;
            } temp = arr[i] temp arr[i] arr i arr[i] = arr[min] arr[i] arr i arr[min] arr min arr[min] = temp arr[min] arr min temp count++ count for(int x = 0; x < n; x++){
            if(x == n-1){
                System.out.println(arr[x]);
            }else{
                System.out.print(arr[x]);
                System.out.print(" ");
            }
        } int x = 0; int x = 0; x 0 x < n x n x++ x++ x {
            if(x == n-1){
                System.out.println(arr[x]);
            }else{
                System.out.print(arr[x]);
                System.out.print(" ");
            }
        } {
            if(x == n-1){
                System.out.println(arr[x]);
            }else{
                System.out.print(arr[x]);
                System.out.print(" ");
            }
        } if(x == n-1){
                System.out.println(arr[x]);
            }else{
                System.out.print(arr[x]);
                System.out.print(" ");
            } x == n-1 x n-1 n 1 {
                System.out.println(arr[x]);
            } System.out.println(arr[x]) System.out.println System.out System System.out arr[x] arr x {
                System.out.print(arr[x]);
                System.out.print(" ");
            } System.out.print(arr[x]) System.out.print System.out System System.out arr[x] arr x System.out.print(" ") System.out.print System.out System System.out " " System.out.println(count) System.out.println System.out System System.out count String args[] args
import java.util.*;

class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.nextLine());
        String[] line = sc.nextLine().split(" ");
        int[] arr = new int[n];
        int temp;
        int count = 0;
        for(int x = 0; x < n; x++){
            arr[x] = Integer.parseInt(line[x]);
        }

        for(int i=0; i < n; i++){
            int min = i;
            for(int j = i+1; j < n; j++){
                if(arr[min] > arr[j]){
                    min = j;
                }
            }
            if(i != min){
                temp = arr[i];
                arr[i] = arr[min];
                arr[min] = temp;
                count++;
            }
        }
        for(int x = 0; x < n; x++){
            if(x == n-1){
                System.out.println(arr[x]);
            }else{
                System.out.print(arr[x]);
                System.out.print(" ");
            }
        }
        System.out.println(count);
        

    }
}