import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] input = new int[n];

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

        int count = 0;
        int min;
        for(int i = 0; i < n; i++) {
            min = i;
            for(int j = i; j < n; j++) {
                if(input[j] < input[min]) {
                    min = j;
                }
            }
            int temp = input[i];
            input[i] = input[min];
            input[min] = temp;
            if(i != min) {
                count++;
            }
        }

        System.out.print(input[0]);
        for(int i = 1; i < n; i++) {
            System.out.print(" " + input[i]);
        }

        System.out.println();
        System.out.println(count);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] input = new int[n];

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

        int count = 0;
        int min;
        for(int i = 0; i < n; i++) {
            min = i;
            for(int j = i; j < n; j++) {
                if(input[j] < input[min]) {
                    min = j;
                }
            }
            int temp = input[i];
            input[i] = input[min];
            input[min] = temp;
            if(i != min) {
                count++;
            }
        }

        System.out.print(input[0]);
        for(int i = 1; i < n; i++) {
            System.out.print(" " + input[i]);
        }

        System.out.println();
        System.out.println(count);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] input = new int[n];

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

        int count = 0;
        int min;
        for(int i = 0; i < n; i++) {
            min = i;
            for(int j = i; j < n; j++) {
                if(input[j] < input[min]) {
                    min = j;
                }
            }
            int temp = input[i];
            input[i] = input[min];
            input[min] = temp;
            if(i != min) {
                count++;
            }
        }

        System.out.print(input[0]);
        for(int i = 1; i < n; i++) {
            System.out.print(" " + input[i]);
        }

        System.out.println();
        System.out.println(count);
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] input = new int[n];

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

        int count = 0;
        int min;
        for(int i = 0; i < n; i++) {
            min = i;
            for(int j = i; j < n; j++) {
                if(input[j] < input[min]) {
                    min = j;
                }
            }
            int temp = input[i];
            input[i] = input[min];
            input[min] = temp;
            if(i != min) {
                count++;
            }
        }

        System.out.print(input[0]);
        for(int i = 1; i < n; i++) {
            System.out.print(" " + input[i]);
        }

        System.out.println();
        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[] input = new int[n]; input new int[n] n for (int i = 0; i < n; i++) {
            input[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            input[i] = sc.nextInt();
        } {
            input[i] = sc.nextInt();
        } input[i] = sc.nextInt() input[i] input i sc.nextInt() sc.nextInt sc int count = 0; count 0 int min; min for(int i = 0; i < n; i++) {
            min = i;
            for(int j = i; j < n; j++) {
                if(input[j] < input[min]) {
                    min = j;
                }
            }
            int temp = input[i];
            input[i] = input[min];
            input[min] = temp;
            if(i != min) {
                count++;
            }
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            min = i;
            for(int j = i; j < n; j++) {
                if(input[j] < input[min]) {
                    min = j;
                }
            }
            int temp = input[i];
            input[i] = input[min];
            input[min] = temp;
            if(i != min) {
                count++;
            }
        } {
            min = i;
            for(int j = i; j < n; j++) {
                if(input[j] < input[min]) {
                    min = j;
                }
            }
            int temp = input[i];
            input[i] = input[min];
            input[min] = temp;
            if(i != min) {
                count++;
            }
        } min = i min i for(int j = i; j < n; j++) {
                if(input[j] < input[min]) {
                    min = j;
                }
            } int j = i; int j = i; j i j < n j n j++ j++ j {
                if(input[j] < input[min]) {
                    min = j;
                }
            } {
                if(input[j] < input[min]) {
                    min = j;
                }
            } if(input[j] < input[min]) {
                    min = j;
                } input[j] < input[min] input[j] input j input[min] input min {
                    min = j;
                } min = j min j int temp = input[i]; temp input[i] input i input[i] = input[min] input[i] input i input[min] input min input[min] = temp input[min] input min temp if(i != min) {
                count++;
            } i != min i min {
                count++;
            } count++ count System.out.print(input[0]) System.out.print System.out System System.out input[0] input 0 for(int i = 1; i < n; i++) {
            System.out.print(" " + input[i]);
        } int i = 1; int i = 1; i 1 i < n i n i++ i++ i {
            System.out.print(" " + input[i]);
        } {
            System.out.print(" " + input[i]);
        } System.out.print(" " + input[i]) System.out.print System.out System System.out " " + input[i] " " input[i] input i System.out.println() System.out.println System.out System System.out System.out.println(count) System.out.println System.out System System.out count String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] input = new int[n];

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

        int count = 0;
        int min;
        for(int i = 0; i < n; i++) {
            min = i;
            for(int j = i; j < n; j++) {
                if(input[j] < input[min]) {
                    min = j;
                }
            }
            int temp = input[i];
            input[i] = input[min];
            input[min] = temp;
            if(i != min) {
                count++;
            }
        }

        System.out.print(input[0]);
        for(int i = 1; i < n; i++) {
            System.out.print(" " + input[i]);
        }

        System.out.println();
        System.out.println(count);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] input = new int[n];

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

        int count = 0;
        int min;
        for(int i = 0; i < n; i++) {
            min = i;
            for(int j = i; j < n; j++) {
                if(input[j] < input[min]) {
                    min = j;
                }
            }
            int temp = input[i];
            input[i] = input[min];
            input[min] = temp;
            if(i != min) {
                count++;
            }
        }

        System.out.print(input[0]);
        for(int i = 1; i < n; i++) {
            System.out.print(" " + input[i]);
        }

        System.out.println();
        System.out.println(count);
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] input = new int[n];

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

        int count = 0;
        int min;
        for(int i = 0; i < n; i++) {
            min = i;
            for(int j = i; j < n; j++) {
                if(input[j] < input[min]) {
                    min = j;
                }
            }
            int temp = input[i];
            input[i] = input[min];
            input[min] = temp;
            if(i != min) {
                count++;
            }
        }

        System.out.print(input[0]);
        for(int i = 1; i < n; i++) {
            System.out.print(" " + input[i]);
        }

        System.out.println();
        System.out.println(count);
    }
}