import java.util.Scanner;
//* alds1_2_B *//
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int input[] = new int[N];
        int minj,i,j,tmp,k;
        int count = 0;
        for (int x =0 ; x < N ; x++){
            input[x] = sc.nextInt();
        }
        for (i=0; i <N; i++){
            minj = i;
            for (j =i; j < N; j++){
                if(input[j] < input[minj]){
                    minj = j;
                }
            }
            if(i != minj) {
                tmp = input[minj];
                input[minj] = input[i];
                input[i] = tmp;
                count++;
            }
        }
        for(k=0; k<N-1;k++){
            System.out.print(input[k]+ " ");
        }
        if(k == N-1){
            System.out.println(input[k]);
        }
        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 input[] = new int[N];
        int minj,i,j,tmp,k;
        int count = 0;
        for (int x =0 ; x < N ; x++){
            input[x] = sc.nextInt();
        }
        for (i=0; i <N; i++){
            minj = i;
            for (j =i; j < N; j++){
                if(input[j] < input[minj]){
                    minj = j;
                }
            }
            if(i != minj) {
                tmp = input[minj];
                input[minj] = input[i];
                input[i] = tmp;
                count++;
            }
        }
        for(k=0; k<N-1;k++){
            System.out.print(input[k]+ " ");
        }
        if(k == N-1){
            System.out.println(input[k]);
        }
        System.out.println(count);
    }

} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int input[] = new int[N];
        int minj,i,j,tmp,k;
        int count = 0;
        for (int x =0 ; x < N ; x++){
            input[x] = sc.nextInt();
        }
        for (i=0; i <N; i++){
            minj = i;
            for (j =i; j < N; j++){
                if(input[j] < input[minj]){
                    minj = j;
                }
            }
            if(i != minj) {
                tmp = input[minj];
                input[minj] = input[i];
                input[i] = tmp;
                count++;
            }
        }
        for(k=0; k<N-1;k++){
            System.out.print(input[k]+ " ");
        }
        if(k == N-1){
            System.out.println(input[k]);
        }
        System.out.println(count);
    } main {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int input[] = new int[N];
        int minj,i,j,tmp,k;
        int count = 0;
        for (int x =0 ; x < N ; x++){
            input[x] = sc.nextInt();
        }
        for (i=0; i <N; i++){
            minj = i;
            for (j =i; j < N; j++){
                if(input[j] < input[minj]){
                    minj = j;
                }
            }
            if(i != minj) {
                tmp = input[minj];
                input[minj] = input[i];
                input[i] = tmp;
                count++;
            }
        }
        for(k=0; k<N-1;k++){
            System.out.print(input[k]+ " ");
        }
        if(k == N-1){
            System.out.println(input[k]);
        }
        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 input[] = new int[N]; input new int[N] N int minj minj i i j j tmp tmp k; k int count = 0; count 0 for (int x =0 ; x < N ; x++){
            input[x] = sc.nextInt();
        } int x =0 ; int x =0 ; x 0 x < N x N x++ x++ x {
            input[x] = sc.nextInt();
        } {
            input[x] = sc.nextInt();
        } input[x] = sc.nextInt() input[x] input x sc.nextInt() sc.nextInt sc for (i=0; i <N; i++){
            minj = i;
            for (j =i; j < N; j++){
                if(input[j] < input[minj]){
                    minj = j;
                }
            }
            if(i != minj) {
                tmp = input[minj];
                input[minj] = input[i];
                input[i] = tmp;
                count++;
            }
        } i=0; i=0 i 0 i <N i N i++ i++ i {
            minj = i;
            for (j =i; j < N; j++){
                if(input[j] < input[minj]){
                    minj = j;
                }
            }
            if(i != minj) {
                tmp = input[minj];
                input[minj] = input[i];
                input[i] = tmp;
                count++;
            }
        } {
            minj = i;
            for (j =i; j < N; j++){
                if(input[j] < input[minj]){
                    minj = j;
                }
            }
            if(i != minj) {
                tmp = input[minj];
                input[minj] = input[i];
                input[i] = tmp;
                count++;
            }
        } minj = i minj i for (j =i; j < N; j++){
                if(input[j] < input[minj]){
                    minj = j;
                }
            } j =i; j =i j i j < N j N j++ j++ j {
                if(input[j] < input[minj]){
                    minj = j;
                }
            } {
                if(input[j] < input[minj]){
                    minj = j;
                }
            } if(input[j] < input[minj]){
                    minj = j;
                } input[j] < input[minj] input[j] input j input[minj] input minj {
                    minj = j;
                } minj = j minj j if(i != minj) {
                tmp = input[minj];
                input[minj] = input[i];
                input[i] = tmp;
                count++;
            } i != minj i minj {
                tmp = input[minj];
                input[minj] = input[i];
                input[i] = tmp;
                count++;
            } tmp = input[minj] tmp input[minj] input minj input[minj] = input[i] input[minj] input minj input[i] input i input[i] = tmp input[i] input i tmp count++ count for(k=0; k<N-1;k++){
            System.out.print(input[k]+ " ");
        } k=0; k=0 k 0 k<N-1 k N-1 N 1 k++ k++ k {
            System.out.print(input[k]+ " ");
        } {
            System.out.print(input[k]+ " ");
        } System.out.print(input[k]+ " ") System.out.print System.out System System.out input[k]+ " " input[k] input k " " if(k == N-1){
            System.out.println(input[k]);
        } k == N-1 k N-1 N 1 {
            System.out.println(input[k]);
        } System.out.println(input[k]) System.out.println System.out System System.out input[k] input k 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 input[] = new int[N];
        int minj,i,j,tmp,k;
        int count = 0;
        for (int x =0 ; x < N ; x++){
            input[x] = sc.nextInt();
        }
        for (i=0; i <N; i++){
            minj = i;
            for (j =i; j < N; j++){
                if(input[j] < input[minj]){
                    minj = j;
                }
            }
            if(i != minj) {
                tmp = input[minj];
                input[minj] = input[i];
                input[i] = tmp;
                count++;
            }
        }
        for(k=0; k<N-1;k++){
            System.out.print(input[k]+ " ");
        }
        if(k == N-1){
            System.out.println(input[k]);
        }
        System.out.println(count);
    }

} public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int input[] = new int[N];
        int minj,i,j,tmp,k;
        int count = 0;
        for (int x =0 ; x < N ; x++){
            input[x] = sc.nextInt();
        }
        for (i=0; i <N; i++){
            minj = i;
            for (j =i; j < N; j++){
                if(input[j] < input[minj]){
                    minj = j;
                }
            }
            if(i != minj) {
                tmp = input[minj];
                input[minj] = input[i];
                input[i] = tmp;
                count++;
            }
        }
        for(k=0; k<N-1;k++){
            System.out.print(input[k]+ " ");
        }
        if(k == N-1){
            System.out.println(input[k]);
        }
        System.out.println(count);
    }

} Main
import java.util.Scanner;
//* alds1_2_B *//
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int input[] = new int[N];
        int minj,i,j,tmp,k;
        int count = 0;
        for (int x =0 ; x < N ; x++){
            input[x] = sc.nextInt();
        }
        for (i=0; i <N; i++){
            minj = i;
            for (j =i; j < N; j++){
                if(input[j] < input[minj]){
                    minj = j;
                }
            }
            if(i != minj) {
                tmp = input[minj];
                input[minj] = input[i];
                input[i] = tmp;
                count++;
            }
        }
        for(k=0; k<N-1;k++){
            System.out.print(input[k]+ " ");
        }
        if(k == N-1){
            System.out.println(input[k]);
        }
        System.out.println(count);
    }

}
