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

