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