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