import java.util.*;
import java.io.*;
import java.lang.*;

public class Main {
    static final int INF = 1000000000;     
    
    public static void main(String[] args) throws Exception {                
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; ++i) a[i] = input.nextInt();
        int swaps = 0;
        for (int i = 0; i < n; ++i) {
            int min = i;
            for (int k = i; k < n; ++k) {
                if (a[k] < a[min]) min = k;
            }
            if (min != i) {
                int temp = a[i];
                a[i] = a[min];
                a[min] = temp;
                ++swaps;
            }
        }
        System.out.print(a[0]);
        for (int i = 1; i < n; ++i) System.out.print(" " + a[i]);
        System.out.println("");
        System.out.println(swaps);
    }            
} import java.util.*; util.* java import java.io.*; io.* java import java.lang.*; lang.* java public class Main {
    static final int INF = 1000000000;     
    
    public static void main(String[] args) throws Exception {                
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; ++i) a[i] = input.nextInt();
        int swaps = 0;
        for (int i = 0; i < n; ++i) {
            int min = i;
            for (int k = i; k < n; ++k) {
                if (a[k] < a[min]) min = k;
            }
            if (min != i) {
                int temp = a[i];
                a[i] = a[min];
                a[min] = temp;
                ++swaps;
            }
        }
        System.out.print(a[0]);
        for (int i = 1; i < n; ++i) System.out.print(" " + a[i]);
        System.out.println("");
        System.out.println(swaps);
    }            
} Main static final int INF = 1000000000; INF 1000000000 public static void main(String[] args) throws Exception {                
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; ++i) a[i] = input.nextInt();
        int swaps = 0;
        for (int i = 0; i < n; ++i) {
            int min = i;
            for (int k = i; k < n; ++k) {
                if (a[k] < a[min]) min = k;
            }
            if (min != i) {
                int temp = a[i];
                a[i] = a[min];
                a[min] = temp;
                ++swaps;
            }
        }
        System.out.print(a[0]);
        for (int i = 1; i < n; ++i) System.out.print(" " + a[i]);
        System.out.println("");
        System.out.println(swaps);
    } main {                
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; ++i) a[i] = input.nextInt();
        int swaps = 0;
        for (int i = 0; i < n; ++i) {
            int min = i;
            for (int k = i; k < n; ++k) {
                if (a[k] < a[min]) min = k;
            }
            if (min != i) {
                int temp = a[i];
                a[i] = a[min];
                a[min] = temp;
                ++swaps;
            }
        }
        System.out.print(a[0]);
        for (int i = 1; i < n; ++i) System.out.print(" " + a[i]);
        System.out.println("");
        System.out.println(swaps);
    } Scanner input = new Scanner(System.in); input new Scanner(System.in) int n = input.nextInt(); n input.nextInt() input.nextInt input int[] a = new int[n]; a new int[n] n for (int i = 0; i < n; ++i) a[i] = input.nextInt(); int i = 0; int i = 0; i 0 i < n i n ++i ++i i a[i] = input.nextInt(); a[i] = input.nextInt() a[i] a i input.nextInt() input.nextInt input int swaps = 0; swaps 0 for (int i = 0; i < n; ++i) {
            int min = i;
            for (int k = i; k < n; ++k) {
                if (a[k] < a[min]) min = k;
            }
            if (min != i) {
                int temp = a[i];
                a[i] = a[min];
                a[min] = temp;
                ++swaps;
            }
        } int i = 0; int i = 0; i 0 i < n i n ++i ++i i {
            int min = i;
            for (int k = i; k < n; ++k) {
                if (a[k] < a[min]) min = k;
            }
            if (min != i) {
                int temp = a[i];
                a[i] = a[min];
                a[min] = temp;
                ++swaps;
            }
        } {
            int min = i;
            for (int k = i; k < n; ++k) {
                if (a[k] < a[min]) min = k;
            }
            if (min != i) {
                int temp = a[i];
                a[i] = a[min];
                a[min] = temp;
                ++swaps;
            }
        } int min = i; min i for (int k = i; k < n; ++k) {
                if (a[k] < a[min]) min = k;
            } int k = i; int k = i; k i k < n k n ++k ++k k {
                if (a[k] < a[min]) min = k;
            } {
                if (a[k] < a[min]) min = k;
            } if (a[k] < a[min]) min = k; a[k] < a[min] a[k] a k a[min] a min min = k min k if (min != i) {
                int temp = a[i];
                a[i] = a[min];
                a[min] = temp;
                ++swaps;
            } min != i min i {
                int temp = a[i];
                a[i] = a[min];
                a[min] = temp;
                ++swaps;
            } int temp = a[i]; temp a[i] a i a[i] = a[min] a[i] a i a[min] a min a[min] = temp a[min] a min temp ++swaps swaps System.out.print(a[0]) System.out.print System.out System System.out a[0] a 0 for (int i = 1; i < n; ++i) System.out.print(" " + a[i]); int i = 1; int i = 1; i 1 i < n i n ++i ++i i System.out.print(" " + a[i]); System.out.print(" " + a[i]) System.out.print System.out System System.out " " + a[i] " " a[i] a i System.out.println("") System.out.println System.out System System.out "" System.out.println(swaps) System.out.println System.out System System.out swaps String[] args args public class Main {
    static final int INF = 1000000000;     
    
    public static void main(String[] args) throws Exception {                
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; ++i) a[i] = input.nextInt();
        int swaps = 0;
        for (int i = 0; i < n; ++i) {
            int min = i;
            for (int k = i; k < n; ++k) {
                if (a[k] < a[min]) min = k;
            }
            if (min != i) {
                int temp = a[i];
                a[i] = a[min];
                a[min] = temp;
                ++swaps;
            }
        }
        System.out.print(a[0]);
        for (int i = 1; i < n; ++i) System.out.print(" " + a[i]);
        System.out.println("");
        System.out.println(swaps);
    }            
} public class Main {
    static final int INF = 1000000000;     
    
    public static void main(String[] args) throws Exception {                
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; ++i) a[i] = input.nextInt();
        int swaps = 0;
        for (int i = 0; i < n; ++i) {
            int min = i;
            for (int k = i; k < n; ++k) {
                if (a[k] < a[min]) min = k;
            }
            if (min != i) {
                int temp = a[i];
                a[i] = a[min];
                a[min] = temp;
                ++swaps;
            }
        }
        System.out.print(a[0]);
        for (int i = 1; i < n; ++i) System.out.print(" " + a[i]);
        System.out.println("");
        System.out.println(swaps);
    }            
} Main
import java.util.*;
import java.io.*;
import java.lang.*;

public class Main {
    static final int INF = 1000000000;     
    
    public static void main(String[] args) throws Exception {                
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; ++i) a[i] = input.nextInt();
        int swaps = 0;
        for (int i = 0; i < n; ++i) {
            int min = i;
            for (int k = i; k < n; ++k) {
                if (a[k] < a[min]) min = k;
            }
            if (min != i) {
                int temp = a[i];
                a[i] = a[min];
                a[min] = temp;
                ++swaps;
            }
        }
        System.out.print(a[0]);
        for (int i = 1; i < n; ++i) System.out.print(" " + a[i]);
        System.out.println("");
        System.out.println(swaps);
    }            
}