import java.util.Scanner;

class Main {

    private static String toString(int[] numbers){
        StringBuilder ans = new StringBuilder().append(numbers[0]);
        for (int x = 1; x < numbers.length; x++)
            ans.append(" ").append(numbers[x]);
        return ans.toString();
    }

    public static void main(String[] args){
        
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int[] A = new int[n];

        // stores all numbers in the array A
        for (int i = 0; i < n; i++) {
            A[i] = sc.nextInt();
        }
         /**
        int n = 6;
        int[] A = new int[]{5,6,4,2,1,3};
         */
        int count = 0; // the number of swap operations.
        for (int i = 0; i < n; i++) {
            int mini = i;
            for (int j = i; j < n; j++)
                if (A[j] < A[mini])
                    mini = j;
            // swap operation
            if(mini != i) {
                int temp = A[i];
                A[i] = A[mini];
                A[mini] = temp;
                count++;
            }
        }
        System.out.println(toString(A));
        System.out.println(count);
    }

}
 import java.util.Scanner; Scanner java.util class Main {

    private static String toString(int[] numbers){
        StringBuilder ans = new StringBuilder().append(numbers[0]);
        for (int x = 1; x < numbers.length; x++)
            ans.append(" ").append(numbers[x]);
        return ans.toString();
    }

    public static void main(String[] args){
        
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int[] A = new int[n];

        // stores all numbers in the array A
        for (int i = 0; i < n; i++) {
            A[i] = sc.nextInt();
        }
         /**
        int n = 6;
        int[] A = new int[]{5,6,4,2,1,3};
         */
        int count = 0; // the number of swap operations.
        for (int i = 0; i < n; i++) {
            int mini = i;
            for (int j = i; j < n; j++)
                if (A[j] < A[mini])
                    mini = j;
            // swap operation
            if(mini != i) {
                int temp = A[i];
                A[i] = A[mini];
                A[mini] = temp;
                count++;
            }
        }
        System.out.println(toString(A));
        System.out.println(count);
    }

} Main private static String toString(int[] numbers){
        StringBuilder ans = new StringBuilder().append(numbers[0]);
        for (int x = 1; x < numbers.length; x++)
            ans.append(" ").append(numbers[x]);
        return ans.toString();
    } toString {
        StringBuilder ans = new StringBuilder().append(numbers[0]);
        for (int x = 1; x < numbers.length; x++)
            ans.append(" ").append(numbers[x]);
        return ans.toString();
    } StringBuilder ans = new StringBuilder().append(numbers[0]); ans new StringBuilder().append(numbers[0]) new StringBuilder().append new StringBuilder() numbers[0] numbers 0 for (int x = 1; x < numbers.length; x++)
            ans.append(" ").append(numbers[x]); int x = 1; int x = 1; x 1 x < numbers.length x numbers.length numbers numbers.length x++ x++ x ans.append(" ").append(numbers[x]); ans.append(" ").append(numbers[x]) ans.append(" ").append ans.append(" ") ans.append ans " " numbers[x] numbers x return ans.toString(); ans.toString() ans.toString ans int[] numbers numbers public static void main(String[] args){
        
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int[] A = new int[n];

        // stores all numbers in the array A
        for (int i = 0; i < n; i++) {
            A[i] = sc.nextInt();
        }
         /**
        int n = 6;
        int[] A = new int[]{5,6,4,2,1,3};
         */
        int count = 0; // the number of swap operations.
        for (int i = 0; i < n; i++) {
            int mini = i;
            for (int j = i; j < n; j++)
                if (A[j] < A[mini])
                    mini = j;
            // swap operation
            if(mini != i) {
                int temp = A[i];
                A[i] = A[mini];
                A[mini] = temp;
                count++;
            }
        }
        System.out.println(toString(A));
        System.out.println(count);
    } main {
        
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int[] A = new int[n];

        // stores all numbers in the array A
        for (int i = 0; i < n; i++) {
            A[i] = sc.nextInt();
        }
         /**
        int n = 6;
        int[] A = new int[]{5,6,4,2,1,3};
         */
        int count = 0; // the number of swap operations.
        for (int i = 0; i < n; i++) {
            int mini = i;
            for (int j = i; j < n; j++)
                if (A[j] < A[mini])
                    mini = j;
            // swap operation
            if(mini != i) {
                int temp = A[i];
                A[i] = A[mini];
                A[mini] = temp;
                count++;
            }
        }
        System.out.println(toString(A));
        System.out.println(count);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] A = new int[n]; A new int[n] n for (int i = 0; i < n; i++) {
            A[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            A[i] = sc.nextInt();
        } {
            A[i] = sc.nextInt();
        } A[i] = sc.nextInt() A[i] A i sc.nextInt() sc.nextInt sc int count = 0; count 0 for (int i = 0; i < n; i++) {
            int mini = i;
            for (int j = i; j < n; j++)
                if (A[j] < A[mini])
                    mini = j;
            // swap operation
            if(mini != i) {
                int temp = A[i];
                A[i] = A[mini];
                A[mini] = temp;
                count++;
            }
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            int mini = i;
            for (int j = i; j < n; j++)
                if (A[j] < A[mini])
                    mini = j;
            // swap operation
            if(mini != i) {
                int temp = A[i];
                A[i] = A[mini];
                A[mini] = temp;
                count++;
            }
        } {
            int mini = i;
            for (int j = i; j < n; j++)
                if (A[j] < A[mini])
                    mini = j;
            // swap operation
            if(mini != i) {
                int temp = A[i];
                A[i] = A[mini];
                A[mini] = temp;
                count++;
            }
        } int mini = i; mini i for (int j = i; j < n; j++)
                if (A[j] < A[mini])
                    mini = j; int j = i; int j = i; j i j < n j n j++ j++ j if (A[j] < A[mini])
                    mini = j; if (A[j] < A[mini])
                    mini = j; A[j] < A[mini] A[j] A j A[mini] A mini mini = j mini j if(mini != i) {
                int temp = A[i];
                A[i] = A[mini];
                A[mini] = temp;
                count++;
            } mini != i mini i {
                int temp = A[i];
                A[i] = A[mini];
                A[mini] = temp;
                count++;
            } int temp = A[i]; temp A[i] A i A[i] = A[mini] A[i] A i A[mini] A mini A[mini] = temp A[mini] A mini temp count++ count System.out.println(toString(A)) System.out.println System.out System System.out toString(A) toString A System.out.println(count) System.out.println System.out System System.out count String[] args args
import java.util.Scanner;

class Main {

    private static String toString(int[] numbers){
        StringBuilder ans = new StringBuilder().append(numbers[0]);
        for (int x = 1; x < numbers.length; x++)
            ans.append(" ").append(numbers[x]);
        return ans.toString();
    }

    public static void main(String[] args){
        
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int[] A = new int[n];

        // stores all numbers in the array A
        for (int i = 0; i < n; i++) {
            A[i] = sc.nextInt();
        }
         /**
        int n = 6;
        int[] A = new int[]{5,6,4,2,1,3};
         */
        int count = 0; // the number of swap operations.
        for (int i = 0; i < n; i++) {
            int mini = i;
            for (int j = i; j < n; j++)
                if (A[j] < A[mini])
                    mini = j;
            // swap operation
            if(mini != i) {
                int temp = A[i];
                A[i] = A[mini];
                A[mini] = temp;
                count++;
            }
        }
        System.out.println(toString(A));
        System.out.println(count);
    }

}

