import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] a = new int[n];

        for (int i = 0; i < n; i++) {
            a[i] = scanner.nextInt();
        }

        int m = 0;
        for (int i = 0; i < n; i++) {
            int minj = i;
            for (int j = i; j < n; j++) {
                if (a[j] < a[minj]) minj = j;
            }
            if (i != minj) m++;
            int tmp = a[i];
            a[i] = a[minj];
            a[minj] = tmp;
        }

        for (int i = 0; i < n-1; i++) {
            System.out.printf("%d ", a[i]);
        }
        System.out.println(a[n-1]);
        System.out.println(m);
        scanner.close();
    }
}
 import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] a = new int[n];

        for (int i = 0; i < n; i++) {
            a[i] = scanner.nextInt();
        }

        int m = 0;
        for (int i = 0; i < n; i++) {
            int minj = i;
            for (int j = i; j < n; j++) {
                if (a[j] < a[minj]) minj = j;
            }
            if (i != minj) m++;
            int tmp = a[i];
            a[i] = a[minj];
            a[minj] = tmp;
        }

        for (int i = 0; i < n-1; i++) {
            System.out.printf("%d ", a[i]);
        }
        System.out.println(a[n-1]);
        System.out.println(m);
        scanner.close();
    }
} Main public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] a = new int[n];

        for (int i = 0; i < n; i++) {
            a[i] = scanner.nextInt();
        }

        int m = 0;
        for (int i = 0; i < n; i++) {
            int minj = i;
            for (int j = i; j < n; j++) {
                if (a[j] < a[minj]) minj = j;
            }
            if (i != minj) m++;
            int tmp = a[i];
            a[i] = a[minj];
            a[minj] = tmp;
        }

        for (int i = 0; i < n-1; i++) {
            System.out.printf("%d ", a[i]);
        }
        System.out.println(a[n-1]);
        System.out.println(m);
        scanner.close();
    } main {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] a = new int[n];

        for (int i = 0; i < n; i++) {
            a[i] = scanner.nextInt();
        }

        int m = 0;
        for (int i = 0; i < n; i++) {
            int minj = i;
            for (int j = i; j < n; j++) {
                if (a[j] < a[minj]) minj = j;
            }
            if (i != minj) m++;
            int tmp = a[i];
            a[i] = a[minj];
            a[minj] = tmp;
        }

        for (int i = 0; i < n-1; i++) {
            System.out.printf("%d ", a[i]);
        }
        System.out.println(a[n-1]);
        System.out.println(m);
        scanner.close();
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int n = scanner.nextInt(); n scanner.nextInt() scanner.nextInt scanner int[] a = new int[n]; a new int[n] n for (int i = 0; i < n; i++) {
            a[i] = scanner.nextInt();
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            a[i] = scanner.nextInt();
        } {
            a[i] = scanner.nextInt();
        } a[i] = scanner.nextInt() a[i] a i scanner.nextInt() scanner.nextInt scanner int m = 0; m 0 for (int i = 0; i < n; i++) {
            int minj = i;
            for (int j = i; j < n; j++) {
                if (a[j] < a[minj]) minj = j;
            }
            if (i != minj) m++;
            int tmp = a[i];
            a[i] = a[minj];
            a[minj] = tmp;
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            int minj = i;
            for (int j = i; j < n; j++) {
                if (a[j] < a[minj]) minj = j;
            }
            if (i != minj) m++;
            int tmp = a[i];
            a[i] = a[minj];
            a[minj] = tmp;
        } {
            int minj = i;
            for (int j = i; j < n; j++) {
                if (a[j] < a[minj]) minj = j;
            }
            if (i != minj) m++;
            int tmp = a[i];
            a[i] = a[minj];
            a[minj] = tmp;
        } int 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 if (i != minj) m++; i != minj i minj m++ m int tmp = a[i]; tmp a[i] a i a[i] = a[minj] a[i] a i a[minj] a minj a[minj] = tmp a[minj] a minj tmp for (int i = 0; i < n-1; i++) {
            System.out.printf("%d ", a[i]);
        } int i = 0; int i = 0; i 0 i < n-1 i n-1 n 1 i++ i++ i {
            System.out.printf("%d ", a[i]);
        } {
            System.out.printf("%d ", a[i]);
        } System.out.printf("%d ", a[i]) System.out.printf System.out System System.out "%d " a[i] a i System.out.println(a[n-1]) System.out.println System.out System System.out a[n-1] a n-1 n 1 System.out.println(m) System.out.println System.out System System.out m scanner.close() scanner.close scanner String[] args args public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] a = new int[n];

        for (int i = 0; i < n; i++) {
            a[i] = scanner.nextInt();
        }

        int m = 0;
        for (int i = 0; i < n; i++) {
            int minj = i;
            for (int j = i; j < n; j++) {
                if (a[j] < a[minj]) minj = j;
            }
            if (i != minj) m++;
            int tmp = a[i];
            a[i] = a[minj];
            a[minj] = tmp;
        }

        for (int i = 0; i < n-1; i++) {
            System.out.printf("%d ", a[i]);
        }
        System.out.println(a[n-1]);
        System.out.println(m);
        scanner.close();
    }
} public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] a = new int[n];

        for (int i = 0; i < n; i++) {
            a[i] = scanner.nextInt();
        }

        int m = 0;
        for (int i = 0; i < n; i++) {
            int minj = i;
            for (int j = i; j < n; j++) {
                if (a[j] < a[minj]) minj = j;
            }
            if (i != minj) m++;
            int tmp = a[i];
            a[i] = a[minj];
            a[minj] = tmp;
        }

        for (int i = 0; i < n-1; i++) {
            System.out.printf("%d ", a[i]);
        }
        System.out.println(a[n-1]);
        System.out.println(m);
        scanner.close();
    }
} Main
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] a = new int[n];

        for (int i = 0; i < n; i++) {
            a[i] = scanner.nextInt();
        }

        int m = 0;
        for (int i = 0; i < n; i++) {
            int minj = i;
            for (int j = i; j < n; j++) {
                if (a[j] < a[minj]) minj = j;
            }
            if (i != minj) m++;
            int tmp = a[i];
            a[i] = a[minj];
            a[minj] = tmp;
        }

        for (int i = 0; i < n-1; i++) {
            System.out.printf("%d ", a[i]);
        }
        System.out.println(a[n-1]);
        System.out.println(m);
        scanner.close();
    }
}

