import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main{

    public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int[] a = new int[n];
        String[] t = br.readLine().split(" ");
        for(int i = 0; i < n; i++){
            a[i] = Integer.parseInt(t[i]);
        }

        selectionSort(a, n);
    }

    public static void selectionSort(int[] a, int n){
        int minj, temp = 0, count = 0;
        for(int i = 0; i < n; i++){
            minj = i;
            for(int j = i; j < n; j++){
                if(a[j] < a[minj]){
                    minj = j;
                }
            }
            if(i != minj)count++;
            temp = a[i];
            a[i] = a[minj];
            a[minj] = temp;
        }
        StringBuilder sb = new StringBuilder();
        for(int i = 0; i < n; i++){
            if(i != 0)sb.append(" ");
            sb.append(a[i]);
        }
        sb.append("\n").append(count);
        System.out.println(sb);
    }

} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.IOException; IOException java.io public class Main{

    public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int[] a = new int[n];
        String[] t = br.readLine().split(" ");
        for(int i = 0; i < n; i++){
            a[i] = Integer.parseInt(t[i]);
        }

        selectionSort(a, n);
    }

    public static void selectionSort(int[] a, int n){
        int minj, temp = 0, count = 0;
        for(int i = 0; i < n; i++){
            minj = i;
            for(int j = i; j < n; j++){
                if(a[j] < a[minj]){
                    minj = j;
                }
            }
            if(i != minj)count++;
            temp = a[i];
            a[i] = a[minj];
            a[minj] = temp;
        }
        StringBuilder sb = new StringBuilder();
        for(int i = 0; i < n; i++){
            if(i != 0)sb.append(" ");
            sb.append(a[i]);
        }
        sb.append("\n").append(count);
        System.out.println(sb);
    }

} Main public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int[] a = new int[n];
        String[] t = br.readLine().split(" ");
        for(int i = 0; i < n; i++){
            a[i] = Integer.parseInt(t[i]);
        }

        selectionSort(a, n);
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int[] a = new int[n];
        String[] t = br.readLine().split(" ");
        for(int i = 0; i < n; i++){
            a[i] = Integer.parseInt(t[i]);
        }

        selectionSort(a, n);
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int n = Integer.parseInt(br.readLine()); n Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br int[] a = new int[n]; a new int[n] n String[] t = br.readLine().split(" "); t br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " for(int i = 0; i < n; i++){
            a[i] = Integer.parseInt(t[i]);
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            a[i] = Integer.parseInt(t[i]);
        } {
            a[i] = Integer.parseInt(t[i]);
        } a[i] = Integer.parseInt(t[i]) a[i] a i Integer.parseInt(t[i]) Integer.parseInt Integer t[i] t i selectionSort(a, n) selectionSort a n String[] args args public static void selectionSort(int[] a, int n){
        int minj, temp = 0, count = 0;
        for(int i = 0; i < n; i++){
            minj = i;
            for(int j = i; j < n; j++){
                if(a[j] < a[minj]){
                    minj = j;
                }
            }
            if(i != minj)count++;
            temp = a[i];
            a[i] = a[minj];
            a[minj] = temp;
        }
        StringBuilder sb = new StringBuilder();
        for(int i = 0; i < n; i++){
            if(i != 0)sb.append(" ");
            sb.append(a[i]);
        }
        sb.append("\n").append(count);
        System.out.println(sb);
    } selectionSort {
        int minj, temp = 0, count = 0;
        for(int i = 0; i < n; i++){
            minj = i;
            for(int j = i; j < n; j++){
                if(a[j] < a[minj]){
                    minj = j;
                }
            }
            if(i != minj)count++;
            temp = a[i];
            a[i] = a[minj];
            a[minj] = temp;
        }
        StringBuilder sb = new StringBuilder();
        for(int i = 0; i < n; i++){
            if(i != 0)sb.append(" ");
            sb.append(a[i]);
        }
        sb.append("\n").append(count);
        System.out.println(sb);
    } int minj minj temp = 0 temp 0 count = 0; count 0 for(int i = 0; i < n; i++){
            minj = i;
            for(int j = i; j < n; j++){
                if(a[j] < a[minj]){
                    minj = j;
                }
            }
            if(i != minj)count++;
            temp = a[i];
            a[i] = a[minj];
            a[minj] = temp;
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            minj = i;
            for(int j = i; j < n; j++){
                if(a[j] < a[minj]){
                    minj = j;
                }
            }
            if(i != minj)count++;
            temp = a[i];
            a[i] = a[minj];
            a[minj] = temp;
        } {
            minj = i;
            for(int j = i; j < n; j++){
                if(a[j] < a[minj]){
                    minj = j;
                }
            }
            if(i != minj)count++;
            temp = a[i];
            a[i] = a[minj];
            a[minj] = temp;
        } minj = i minj i for(int j = i; j < n; j++){
                if(a[j] < a[minj]){
                    minj = j;
                }
            } int j = i; int j = i; j i j < n j n j++ j++ j {
                if(a[j] < a[minj]){
                    minj = j;
                }
            } {
                if(a[j] < a[minj]){
                    minj = j;
                }
            } if(a[j] < a[minj]){
                    minj = j;
                } a[j] < a[minj] a[j] a j a[minj] a minj {
                    minj = j;
                } minj = j minj j if(i != minj)count++; i != minj i minj count++ count temp = a[i] temp a[i] a i a[i] = a[minj] a[i] a i a[minj] a minj a[minj] = temp a[minj] a minj temp StringBuilder sb = new StringBuilder(); sb new StringBuilder() for(int i = 0; i < n; i++){
            if(i != 0)sb.append(" ");
            sb.append(a[i]);
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            if(i != 0)sb.append(" ");
            sb.append(a[i]);
        } {
            if(i != 0)sb.append(" ");
            sb.append(a[i]);
        } if(i != 0)sb.append(" "); i != 0 i 0 sb.append(" ") sb.append sb " " sb.append(a[i]) sb.append sb a[i] a i sb.append("\n").append(count) sb.append("\n").append sb.append("\n") sb.append sb "\n" count System.out.println(sb) System.out.println System.out System System.out sb int[] a a int n n public class Main{

    public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int[] a = new int[n];
        String[] t = br.readLine().split(" ");
        for(int i = 0; i < n; i++){
            a[i] = Integer.parseInt(t[i]);
        }

        selectionSort(a, n);
    }

    public static void selectionSort(int[] a, int n){
        int minj, temp = 0, count = 0;
        for(int i = 0; i < n; i++){
            minj = i;
            for(int j = i; j < n; j++){
                if(a[j] < a[minj]){
                    minj = j;
                }
            }
            if(i != minj)count++;
            temp = a[i];
            a[i] = a[minj];
            a[minj] = temp;
        }
        StringBuilder sb = new StringBuilder();
        for(int i = 0; i < n; i++){
            if(i != 0)sb.append(" ");
            sb.append(a[i]);
        }
        sb.append("\n").append(count);
        System.out.println(sb);
    }

} public class Main{

    public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int[] a = new int[n];
        String[] t = br.readLine().split(" ");
        for(int i = 0; i < n; i++){
            a[i] = Integer.parseInt(t[i]);
        }

        selectionSort(a, n);
    }

    public static void selectionSort(int[] a, int n){
        int minj, temp = 0, count = 0;
        for(int i = 0; i < n; i++){
            minj = i;
            for(int j = i; j < n; j++){
                if(a[j] < a[minj]){
                    minj = j;
                }
            }
            if(i != minj)count++;
            temp = a[i];
            a[i] = a[minj];
            a[minj] = temp;
        }
        StringBuilder sb = new StringBuilder();
        for(int i = 0; i < n; i++){
            if(i != 0)sb.append(" ");
            sb.append(a[i]);
        }
        sb.append("\n").append(count);
        System.out.println(sb);
    }

} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main{

    public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int[] a = new int[n];
        String[] t = br.readLine().split(" ");
        for(int i = 0; i < n; i++){
            a[i] = Integer.parseInt(t[i]);
        }

        selectionSort(a, n);
    }

    public static void selectionSort(int[] a, int n){
        int minj, temp = 0, count = 0;
        for(int i = 0; i < n; i++){
            minj = i;
            for(int j = i; j < n; j++){
                if(a[j] < a[minj]){
                    minj = j;
                }
            }
            if(i != minj)count++;
            temp = a[i];
            a[i] = a[minj];
            a[minj] = temp;
        }
        StringBuilder sb = new StringBuilder();
        for(int i = 0; i < n; i++){
            if(i != 0)sb.append(" ");
            sb.append(a[i]);
        }
        sb.append("\n").append(count);
        System.out.println(sb);
    }

}