import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int a[] = new int[n];
        for(int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        int count = 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) {
                int tmp = a[i];
                a[i] = a[minj];
                a[minj] = tmp;
                count += 1;
            }
        }
        System.out.printf("%d", a[0]);
        for(int i = 1; i < n; i ++) {
            System.out.printf(" %d", a[i]);
        }
        System.out.printf("\n");
        System.out.println(count);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int a[] = new int[n];
        for(int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        int count = 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) {
                int tmp = a[i];
                a[i] = a[minj];
                a[minj] = tmp;
                count += 1;
            }
        }
        System.out.printf("%d", a[0]);
        for(int i = 1; i < n; i ++) {
            System.out.printf(" %d", a[i]);
        }
        System.out.printf("\n");
        System.out.println(count);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int a[] = new int[n];
        for(int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        int count = 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) {
                int tmp = a[i];
                a[i] = a[minj];
                a[minj] = tmp;
                count += 1;
            }
        }
        System.out.printf("%d", a[0]);
        for(int i = 1; i < n; i ++) {
            System.out.printf(" %d", a[i]);
        }
        System.out.printf("\n");
        System.out.println(count);
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int a[] = new int[n];
        for(int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        int count = 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) {
                int tmp = a[i];
                a[i] = a[minj];
                a[minj] = tmp;
                count += 1;
            }
        }
        System.out.printf("%d", a[0]);
        for(int i = 1; i < n; i ++) {
            System.out.printf(" %d", a[i]);
        }
        System.out.printf("\n");
        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 minj = i;
            for(int j = i; j < n; j++) {
                if(a[j] < a[minj]) {
                    minj = j;
                }
            }
            if (i != minj) {
                int tmp = a[i];
                a[i] = a[minj];
                a[minj] = tmp;
                count += 1;
            }
        } 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) {
                int tmp = a[i];
                a[i] = a[minj];
                a[minj] = tmp;
                count += 1;
            }
        } {
            int minj = i;
            for(int j = i; j < n; j++) {
                if(a[j] < a[minj]) {
                    minj = j;
                }
            }
            if (i != minj) {
                int tmp = a[i];
                a[i] = a[minj];
                a[minj] = tmp;
                count += 1;
            }
        } 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 minj j if (i != minj) {
                int tmp = a[i];
                a[i] = a[minj];
                a[minj] = tmp;
                count += 1;
            } i != minj i minj {
                int tmp = a[i];
                a[i] = a[minj];
                a[minj] = tmp;
                count += 1;
            } 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 count += 1 count 1 System.out.printf("%d", a[0]) System.out.printf System.out System System.out "%d" a[0] a 0 for(int i = 1; i < n; i ++) {
            System.out.printf(" %d", a[i]);
        } int i = 1; int i = 1; i 1 i < n i n 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.printf("\n") System.out.printf System.out System System.out "\n" 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 a[] = new int[n];
        for(int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        int count = 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) {
                int tmp = a[i];
                a[i] = a[minj];
                a[minj] = tmp;
                count += 1;
            }
        }
        System.out.printf("%d", a[0]);
        for(int i = 1; i < n; i ++) {
            System.out.printf(" %d", a[i]);
        }
        System.out.printf("\n");
        System.out.println(count);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int a[] = new int[n];
        for(int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        int count = 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) {
                int tmp = a[i];
                a[i] = a[minj];
                a[minj] = tmp;
                count += 1;
            }
        }
        System.out.printf("%d", a[0]);
        for(int i = 1; i < n; i ++) {
            System.out.printf(" %d", a[i]);
        }
        System.out.printf("\n");
        System.out.println(count);
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int a[] = new int[n];
        for(int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        int count = 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) {
                int tmp = a[i];
                a[i] = a[minj];
                a[minj] = tmp;
                count += 1;
            }
        }
        System.out.printf("%d", a[0]);
        for(int i = 1; i < n; i ++) {
            System.out.printf(" %d", a[i]);
        }
        System.out.printf("\n");
        System.out.println(count);
    }
}
