import java.util.Scanner;

public class Main{
    public static void swap(int[] A, int a, int b){
        int s = A[a];
        A[a] = A[b];
        A[b] = s;
    }

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int cnt = 0;
        int[] a = new int[n];
        /*input*/
        for(int i=0; i<n; i++){
            a[i] = sc.nextInt();
        }
        /*sort*/
        for(int i=0; i<n-1; i++){
            int min = i;
            for(int j=i+1; j<n; j++) {
                if(a[j]<a[min]) min=j;
            }
            if(i != min){
                swap(a, i, min);
                cnt++;
            }

        }
        /*output*/
        for(int i=0; i<n-1; i++) System.out.printf("%d ", a[i]);
        System.out.println(a[n-1]);
        System.out.println(cnt);
    }
}
 import java.util.Scanner; Scanner java.util public class Main{
    public static void swap(int[] A, int a, int b){
        int s = A[a];
        A[a] = A[b];
        A[b] = s;
    }

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int cnt = 0;
        int[] a = new int[n];
        /*input*/
        for(int i=0; i<n; i++){
            a[i] = sc.nextInt();
        }
        /*sort*/
        for(int i=0; i<n-1; i++){
            int min = i;
            for(int j=i+1; j<n; j++) {
                if(a[j]<a[min]) min=j;
            }
            if(i != min){
                swap(a, i, min);
                cnt++;
            }

        }
        /*output*/
        for(int i=0; i<n-1; i++) System.out.printf("%d ", a[i]);
        System.out.println(a[n-1]);
        System.out.println(cnt);
    }
} Main public static void swap(int[] A, int a, int b){
        int s = A[a];
        A[a] = A[b];
        A[b] = s;
    } swap {
        int s = A[a];
        A[a] = A[b];
        A[b] = s;
    } int s = A[a]; s A[a] A a A[a] = A[b] A[a] A a A[b] A b A[b] = s A[b] A b s int[] A A int a a int b b public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int cnt = 0;
        int[] a = new int[n];
        /*input*/
        for(int i=0; i<n; i++){
            a[i] = sc.nextInt();
        }
        /*sort*/
        for(int i=0; i<n-1; i++){
            int min = i;
            for(int j=i+1; j<n; j++) {
                if(a[j]<a[min]) min=j;
            }
            if(i != min){
                swap(a, i, min);
                cnt++;
            }

        }
        /*output*/
        for(int i=0; i<n-1; i++) System.out.printf("%d ", a[i]);
        System.out.println(a[n-1]);
        System.out.println(cnt);
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int cnt = 0;
        int[] a = new int[n];
        /*input*/
        for(int i=0; i<n; i++){
            a[i] = sc.nextInt();
        }
        /*sort*/
        for(int i=0; i<n-1; i++){
            int min = i;
            for(int j=i+1; j<n; j++) {
                if(a[j]<a[min]) min=j;
            }
            if(i != min){
                swap(a, i, min);
                cnt++;
            }

        }
        /*output*/
        for(int i=0; i<n-1; i++) System.out.printf("%d ", a[i]);
        System.out.println(a[n-1]);
        System.out.println(cnt);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int 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++){
            int min = i;
            for(int j=i+1; j<n; j++) {
                if(a[j]<a[min]) min=j;
            }
            if(i != min){
                swap(a, i, min);
                cnt++;
            }

        } int i=0; int i=0; i 0 i<n-1 i n-1 n 1 i++ i++ i {
            int min = i;
            for(int j=i+1; j<n; j++) {
                if(a[j]<a[min]) min=j;
            }
            if(i != min){
                swap(a, i, min);
                cnt++;
            }

        } {
            int min = i;
            for(int j=i+1; j<n; j++) {
                if(a[j]<a[min]) min=j;
            }
            if(i != min){
                swap(a, i, min);
                cnt++;
            }

        } int min = i; min i for(int j=i+1; j<n; j++) {
                if(a[j]<a[min]) min=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[min]) min=j;
            } {
                if(a[j]<a[min]) min=j;
            } if(a[j]<a[min]) min=j; a[j]<a[min] a[j] a j a[min] a min min=j min j if(i != min){
                swap(a, i, min);
                cnt++;
            } i != min i min {
                swap(a, i, min);
                cnt++;
            } swap(a, i, min) swap a i min cnt++ cnt 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 System.out System System.out "%d " a[i] a i System.out.println(a[n-1]) System.out.println System.out System System.out a[n-1] a n-1 n 1 System.out.println(cnt) System.out.println System.out System System.out cnt String[] args args public class Main{
    public static void swap(int[] A, int a, int b){
        int s = A[a];
        A[a] = A[b];
        A[b] = s;
    }

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int cnt = 0;
        int[] a = new int[n];
        /*input*/
        for(int i=0; i<n; i++){
            a[i] = sc.nextInt();
        }
        /*sort*/
        for(int i=0; i<n-1; i++){
            int min = i;
            for(int j=i+1; j<n; j++) {
                if(a[j]<a[min]) min=j;
            }
            if(i != min){
                swap(a, i, min);
                cnt++;
            }

        }
        /*output*/
        for(int i=0; i<n-1; i++) System.out.printf("%d ", a[i]);
        System.out.println(a[n-1]);
        System.out.println(cnt);
    }
} public class Main{
    public static void swap(int[] A, int a, int b){
        int s = A[a];
        A[a] = A[b];
        A[b] = s;
    }

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int cnt = 0;
        int[] a = new int[n];
        /*input*/
        for(int i=0; i<n; i++){
            a[i] = sc.nextInt();
        }
        /*sort*/
        for(int i=0; i<n-1; i++){
            int min = i;
            for(int j=i+1; j<n; j++) {
                if(a[j]<a[min]) min=j;
            }
            if(i != min){
                swap(a, i, min);
                cnt++;
            }

        }
        /*output*/
        for(int i=0; i<n-1; i++) System.out.printf("%d ", a[i]);
        System.out.println(a[n-1]);
        System.out.println(cnt);
    }
} Main
import java.util.Scanner;

public class Main{
    public static void swap(int[] A, int a, int b){
        int s = A[a];
        A[a] = A[b];
        A[b] = s;
    }

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int cnt = 0;
        int[] a = new int[n];
        /*input*/
        for(int i=0; i<n; i++){
            a[i] = sc.nextInt();
        }
        /*sort*/
        for(int i=0; i<n-1; i++){
            int min = i;
            for(int j=i+1; j<n; j++) {
                if(a[j]<a[min]) min=j;
            }
            if(i != min){
                swap(a, i, min);
                cnt++;
            }

        }
        /*output*/
        for(int i=0; i<n-1; i++) System.out.printf("%d ", a[i]);
        System.out.println(a[n-1]);
        System.out.println(cnt);
    }
}

