import java.util.*;

public class Main {
    
    public static void main(String[] args) {
        Main main = new Main();
        main.solv();
    }
    
    private void solv() {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int[] xs = new int[n];
        for (int i = 0; i < n; i++) xs[i] = input.nextInt();
        
        // sort
        int count = 0;
        for (int i = 0; i < xs.length; i++) {
            int min = i;
            for (int j = i; j < xs.length; j++) {
                if (xs[j] < xs[min]) {
                    min = j;
                }
            }
            if (i != min) {
                int temp = xs[i];
                xs[i] = xs[min];
                xs[min] = temp;
                count++;
            }
        }
        print(xs);
        System.out.println(count);
    }
    
    private void print(int[] xs) {
        StringBuilder sb = new StringBuilder();
        for (int x : xs) sb.append(x).append(' ');
        System.out.println(sb.toString().trim());
    }
} import java.util.*; util.* java public class Main {
    
    public static void main(String[] args) {
        Main main = new Main();
        main.solv();
    }
    
    private void solv() {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int[] xs = new int[n];
        for (int i = 0; i < n; i++) xs[i] = input.nextInt();
        
        // sort
        int count = 0;
        for (int i = 0; i < xs.length; i++) {
            int min = i;
            for (int j = i; j < xs.length; j++) {
                if (xs[j] < xs[min]) {
                    min = j;
                }
            }
            if (i != min) {
                int temp = xs[i];
                xs[i] = xs[min];
                xs[min] = temp;
                count++;
            }
        }
        print(xs);
        System.out.println(count);
    }
    
    private void print(int[] xs) {
        StringBuilder sb = new StringBuilder();
        for (int x : xs) sb.append(x).append(' ');
        System.out.println(sb.toString().trim());
    }
} Main public static void main(String[] args) {
        Main main = new Main();
        main.solv();
    } main {
        Main main = new Main();
        main.solv();
    } Main main = new Main(); main new Main() main.solv() main.solv main String[] args args private void solv() {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int[] xs = new int[n];
        for (int i = 0; i < n; i++) xs[i] = input.nextInt();
        
        // sort
        int count = 0;
        for (int i = 0; i < xs.length; i++) {
            int min = i;
            for (int j = i; j < xs.length; j++) {
                if (xs[j] < xs[min]) {
                    min = j;
                }
            }
            if (i != min) {
                int temp = xs[i];
                xs[i] = xs[min];
                xs[min] = temp;
                count++;
            }
        }
        print(xs);
        System.out.println(count);
    } solv {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int[] xs = new int[n];
        for (int i = 0; i < n; i++) xs[i] = input.nextInt();
        
        // sort
        int count = 0;
        for (int i = 0; i < xs.length; i++) {
            int min = i;
            for (int j = i; j < xs.length; j++) {
                if (xs[j] < xs[min]) {
                    min = j;
                }
            }
            if (i != min) {
                int temp = xs[i];
                xs[i] = xs[min];
                xs[min] = temp;
                count++;
            }
        }
        print(xs);
        System.out.println(count);
    } Scanner input = new Scanner(System.in); input new Scanner(System.in) int n = input.nextInt(); n input.nextInt() input.nextInt input int[] xs = new int[n]; xs new int[n] n for (int i = 0; i < n; i++) xs[i] = input.nextInt(); int i = 0; int i = 0; i 0 i < n i n i++ i++ i xs[i] = input.nextInt(); xs[i] = input.nextInt() xs[i] xs i input.nextInt() input.nextInt input int count = 0; count 0 for (int i = 0; i < xs.length; i++) {
            int min = i;
            for (int j = i; j < xs.length; j++) {
                if (xs[j] < xs[min]) {
                    min = j;
                }
            }
            if (i != min) {
                int temp = xs[i];
                xs[i] = xs[min];
                xs[min] = temp;
                count++;
            }
        } int i = 0; int i = 0; i 0 i < xs.length i xs.length xs xs.length i++ i++ i {
            int min = i;
            for (int j = i; j < xs.length; j++) {
                if (xs[j] < xs[min]) {
                    min = j;
                }
            }
            if (i != min) {
                int temp = xs[i];
                xs[i] = xs[min];
                xs[min] = temp;
                count++;
            }
        } {
            int min = i;
            for (int j = i; j < xs.length; j++) {
                if (xs[j] < xs[min]) {
                    min = j;
                }
            }
            if (i != min) {
                int temp = xs[i];
                xs[i] = xs[min];
                xs[min] = temp;
                count++;
            }
        } int min = i; min i for (int j = i; j < xs.length; j++) {
                if (xs[j] < xs[min]) {
                    min = j;
                }
            } int j = i; int j = i; j i j < xs.length j xs.length xs xs.length j++ j++ j {
                if (xs[j] < xs[min]) {
                    min = j;
                }
            } {
                if (xs[j] < xs[min]) {
                    min = j;
                }
            } if (xs[j] < xs[min]) {
                    min = j;
                } xs[j] < xs[min] xs[j] xs j xs[min] xs min {
                    min = j;
                } min = j min j if (i != min) {
                int temp = xs[i];
                xs[i] = xs[min];
                xs[min] = temp;
                count++;
            } i != min i min {
                int temp = xs[i];
                xs[i] = xs[min];
                xs[min] = temp;
                count++;
            } int temp = xs[i]; temp xs[i] xs i xs[i] = xs[min] xs[i] xs i xs[min] xs min xs[min] = temp xs[min] xs min temp count++ count print(xs) print xs System.out.println(count) System.out.println System.out System System.out count private void print(int[] xs) {
        StringBuilder sb = new StringBuilder();
        for (int x : xs) sb.append(x).append(' ');
        System.out.println(sb.toString().trim());
    } print {
        StringBuilder sb = new StringBuilder();
        for (int x : xs) sb.append(x).append(' ');
        System.out.println(sb.toString().trim());
    } StringBuilder sb = new StringBuilder(); sb new StringBuilder() for (int x : xs) sb.append(x).append(' '); int x xs sb.append(x).append(' '); sb.append(x).append(' ') sb.append(x).append sb.append(x) sb.append sb x ' ' System.out.println(sb.toString().trim()) System.out.println System.out System System.out sb.toString().trim() sb.toString().trim sb.toString() sb.toString sb int[] xs xs public class Main {
    
    public static void main(String[] args) {
        Main main = new Main();
        main.solv();
    }
    
    private void solv() {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int[] xs = new int[n];
        for (int i = 0; i < n; i++) xs[i] = input.nextInt();
        
        // sort
        int count = 0;
        for (int i = 0; i < xs.length; i++) {
            int min = i;
            for (int j = i; j < xs.length; j++) {
                if (xs[j] < xs[min]) {
                    min = j;
                }
            }
            if (i != min) {
                int temp = xs[i];
                xs[i] = xs[min];
                xs[min] = temp;
                count++;
            }
        }
        print(xs);
        System.out.println(count);
    }
    
    private void print(int[] xs) {
        StringBuilder sb = new StringBuilder();
        for (int x : xs) sb.append(x).append(' ');
        System.out.println(sb.toString().trim());
    }
} public class Main {
    
    public static void main(String[] args) {
        Main main = new Main();
        main.solv();
    }
    
    private void solv() {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int[] xs = new int[n];
        for (int i = 0; i < n; i++) xs[i] = input.nextInt();
        
        // sort
        int count = 0;
        for (int i = 0; i < xs.length; i++) {
            int min = i;
            for (int j = i; j < xs.length; j++) {
                if (xs[j] < xs[min]) {
                    min = j;
                }
            }
            if (i != min) {
                int temp = xs[i];
                xs[i] = xs[min];
                xs[min] = temp;
                count++;
            }
        }
        print(xs);
        System.out.println(count);
    }
    
    private void print(int[] xs) {
        StringBuilder sb = new StringBuilder();
        for (int x : xs) sb.append(x).append(' ');
        System.out.println(sb.toString().trim());
    }
} Main
import java.util.*;

public class Main {
    
    public static void main(String[] args) {
        Main main = new Main();
        main.solv();
    }
    
    private void solv() {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int[] xs = new int[n];
        for (int i = 0; i < n; i++) xs[i] = input.nextInt();
        
        // sort
        int count = 0;
        for (int i = 0; i < xs.length; i++) {
            int min = i;
            for (int j = i; j < xs.length; j++) {
                if (xs[j] < xs[min]) {
                    min = j;
                }
            }
            if (i != min) {
                int temp = xs[i];
                xs[i] = xs[min];
                xs[min] = temp;
                count++;
            }
        }
        print(xs);
        System.out.println(count);
    }
    
    private void print(int[] xs) {
        StringBuilder sb = new StringBuilder();
        for (int x : xs) sb.append(x).append(' ');
        System.out.println(sb.toString().trim());
    }
}