import 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 time = selsort(a, N);
        for(int i = 0; i<N; i++){
            System.out.printf("%d", a[i]);
            if(i < N-1) System.out.printf(" ");
        }
        System.out.printf("\n%d\n", time);
        sc.close();

    }
    static int selsort(int a[], int size){
        int time = 0;
        int minj;
        for(int i = 0; i<size-1; i++){
            minj = i;
            for(int j = i+1; j<size; j++){
                if(a[j] < a[minj]) minj = j;
            }
            if(i != minj){
                int tmp = a[i];
                a[i] = a[minj];
                a[minj] = tmp;
                time++;
            }
        }
        return time;
    }
} import java.util.*; util.* java 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 time = selsort(a, N);
        for(int i = 0; i<N; i++){
            System.out.printf("%d", a[i]);
            if(i < N-1) System.out.printf(" ");
        }
        System.out.printf("\n%d\n", time);
        sc.close();

    }
    static int selsort(int a[], int size){
        int time = 0;
        int minj;
        for(int i = 0; i<size-1; i++){
            minj = i;
            for(int j = i+1; j<size; j++){
                if(a[j] < a[minj]) minj = j;
            }
            if(i != minj){
                int tmp = a[i];
                a[i] = a[minj];
                a[minj] = tmp;
                time++;
            }
        }
        return time;
    }
} 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 time = selsort(a, N);
        for(int i = 0; i<N; i++){
            System.out.printf("%d", a[i]);
            if(i < N-1) System.out.printf(" ");
        }
        System.out.printf("\n%d\n", time);
        sc.close();

    } 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 time = selsort(a, N);
        for(int i = 0; i<N; i++){
            System.out.printf("%d", a[i]);
            if(i < N-1) System.out.printf(" ");
        }
        System.out.printf("\n%d\n", time);
        sc.close();

    } 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 time = selsort(a, N); time selsort(a, N) selsort a N for(int i = 0; i<N; i++){
            System.out.printf("%d", a[i]);
            if(i < N-1) System.out.printf(" ");
        } int i = 0; int i = 0; i 0 i<N i N i++ i++ i {
            System.out.printf("%d", a[i]);
            if(i < N-1) System.out.printf(" ");
        } {
            System.out.printf("%d", a[i]);
            if(i < N-1) System.out.printf(" ");
        } System.out.printf("%d", a[i]) System.out.printf System.out System System.out "%d" a[i] a i if(i < N-1) System.out.printf(" "); i < N-1 i N-1 N 1 System.out.printf(" ") System.out.printf System.out System System.out " " System.out.printf("\n%d\n", time) System.out.printf System.out System System.out "\n%d\n" time sc.close() sc.close sc String[] args args static int selsort(int a[], int size){
        int time = 0;
        int minj;
        for(int i = 0; i<size-1; i++){
            minj = i;
            for(int j = i+1; j<size; j++){
                if(a[j] < a[minj]) minj = j;
            }
            if(i != minj){
                int tmp = a[i];
                a[i] = a[minj];
                a[minj] = tmp;
                time++;
            }
        }
        return time;
    } selsort {
        int time = 0;
        int minj;
        for(int i = 0; i<size-1; i++){
            minj = i;
            for(int j = i+1; j<size; j++){
                if(a[j] < a[minj]) minj = j;
            }
            if(i != minj){
                int tmp = a[i];
                a[i] = a[minj];
                a[minj] = tmp;
                time++;
            }
        }
        return time;
    } int time = 0; time 0 int minj; minj for(int i = 0; i<size-1; i++){
            minj = i;
            for(int j = i+1; j<size; j++){
                if(a[j] < a[minj]) minj = j;
            }
            if(i != minj){
                int tmp = a[i];
                a[i] = a[minj];
                a[minj] = tmp;
                time++;
            }
        } int i = 0; int i = 0; i 0 i<size-1 i size-1 size 1 i++ i++ i {
            minj = i;
            for(int j = i+1; j<size; j++){
                if(a[j] < a[minj]) minj = j;
            }
            if(i != minj){
                int tmp = a[i];
                a[i] = a[minj];
                a[minj] = tmp;
                time++;
            }
        } {
            minj = i;
            for(int j = i+1; j<size; j++){
                if(a[j] < a[minj]) minj = j;
            }
            if(i != minj){
                int tmp = a[i];
                a[i] = a[minj];
                a[minj] = tmp;
                time++;
            }
        } minj = i minj i for(int j = i+1; j<size; j++){
                if(a[j] < a[minj]) minj = j;
            } int j = i+1; int j = i+1; j i+1 i 1 j<size j size 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 if(i != minj){
                int tmp = a[i];
                a[i] = a[minj];
                a[minj] = tmp;
                time++;
            } i != minj i minj {
                int tmp = a[i];
                a[i] = a[minj];
                a[minj] = tmp;
                time++;
            } 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 time++ time return time; time int a[] a int size size 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 time = selsort(a, N);
        for(int i = 0; i<N; i++){
            System.out.printf("%d", a[i]);
            if(i < N-1) System.out.printf(" ");
        }
        System.out.printf("\n%d\n", time);
        sc.close();

    }
    static int selsort(int a[], int size){
        int time = 0;
        int minj;
        for(int i = 0; i<size-1; i++){
            minj = i;
            for(int j = i+1; j<size; j++){
                if(a[j] < a[minj]) minj = j;
            }
            if(i != minj){
                int tmp = a[i];
                a[i] = a[minj];
                a[minj] = tmp;
                time++;
            }
        }
        return time;
    }
} 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 time = selsort(a, N);
        for(int i = 0; i<N; i++){
            System.out.printf("%d", a[i]);
            if(i < N-1) System.out.printf(" ");
        }
        System.out.printf("\n%d\n", time);
        sc.close();

    }
    static int selsort(int a[], int size){
        int time = 0;
        int minj;
        for(int i = 0; i<size-1; i++){
            minj = i;
            for(int j = i+1; j<size; j++){
                if(a[j] < a[minj]) minj = j;
            }
            if(i != minj){
                int tmp = a[i];
                a[i] = a[minj];
                a[minj] = tmp;
                time++;
            }
        }
        return time;
    }
} Main
import 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 time = selsort(a, N);
        for(int i = 0; i<N; i++){
            System.out.printf("%d", a[i]);
            if(i < N-1) System.out.printf(" ");
        }
        System.out.printf("\n%d\n", time);
        sc.close();

    }
    static int selsort(int a[], int size){
        int time = 0;
        int minj;
        for(int i = 0; i<size-1; i++){
            minj = i;
            for(int j = i+1; j<size; j++){
                if(a[j] < a[minj]) minj = j;
            }
            if(i != minj){
                int tmp = a[i];
                a[i] = a[minj];
                a[minj] = tmp;
                time++;
            }
        }
        return time;
    }
}
