import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
       try{ 
        String line1 = reader.readLine();
        int N = Integer.parseInt(line1);
        String line2 = reader.readLine();
        String[] split = line2.split(" ");
        int[] A = new int[N];
        for(int i = 0; i < N ; i ++){
            A[i] = Integer.parseInt(split[i]);
        }
        int count = 0;
        for(int i = 0; i < N-1; i++){
            int minid = i;
            for(int j = i + 1; j < N; j++){
                if(A[j] < A[minid]){
                    minid = j;
                }
            }
            if(minid != i){
                int temp = A[i];
                A[i] = A[minid];
                A[minid] = temp;
                count ++;
            }
        }
        for(int i = 0; i < N; i++){
            if(i < N-1){
                System.out.print(A[i] + " ");
            }else{
                System.out.println(A[i]);
            }
        }
        System.out.println(count);
       }catch(IOException e){

       }
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
    public static void main(String[] args) {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
       try{ 
        String line1 = reader.readLine();
        int N = Integer.parseInt(line1);
        String line2 = reader.readLine();
        String[] split = line2.split(" ");
        int[] A = new int[N];
        for(int i = 0; i < N ; i ++){
            A[i] = Integer.parseInt(split[i]);
        }
        int count = 0;
        for(int i = 0; i < N-1; i++){
            int minid = i;
            for(int j = i + 1; j < N; j++){
                if(A[j] < A[minid]){
                    minid = j;
                }
            }
            if(minid != i){
                int temp = A[i];
                A[i] = A[minid];
                A[minid] = temp;
                count ++;
            }
        }
        for(int i = 0; i < N; i++){
            if(i < N-1){
                System.out.print(A[i] + " ");
            }else{
                System.out.println(A[i]);
            }
        }
        System.out.println(count);
       }catch(IOException e){

       }
    }
} Main public static void main(String[] args) {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
       try{ 
        String line1 = reader.readLine();
        int N = Integer.parseInt(line1);
        String line2 = reader.readLine();
        String[] split = line2.split(" ");
        int[] A = new int[N];
        for(int i = 0; i < N ; i ++){
            A[i] = Integer.parseInt(split[i]);
        }
        int count = 0;
        for(int i = 0; i < N-1; i++){
            int minid = i;
            for(int j = i + 1; j < N; j++){
                if(A[j] < A[minid]){
                    minid = j;
                }
            }
            if(minid != i){
                int temp = A[i];
                A[i] = A[minid];
                A[minid] = temp;
                count ++;
            }
        }
        for(int i = 0; i < N; i++){
            if(i < N-1){
                System.out.print(A[i] + " ");
            }else{
                System.out.println(A[i]);
            }
        }
        System.out.println(count);
       }catch(IOException e){

       }
    } main {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
       try{ 
        String line1 = reader.readLine();
        int N = Integer.parseInt(line1);
        String line2 = reader.readLine();
        String[] split = line2.split(" ");
        int[] A = new int[N];
        for(int i = 0; i < N ; i ++){
            A[i] = Integer.parseInt(split[i]);
        }
        int count = 0;
        for(int i = 0; i < N-1; i++){
            int minid = i;
            for(int j = i + 1; j < N; j++){
                if(A[j] < A[minid]){
                    minid = j;
                }
            }
            if(minid != i){
                int temp = A[i];
                A[i] = A[minid];
                A[minid] = temp;
                count ++;
            }
        }
        for(int i = 0; i < N; i++){
            if(i < N-1){
                System.out.print(A[i] + " ");
            }else{
                System.out.println(A[i]);
            }
        }
        System.out.println(count);
       }catch(IOException e){

       }
    } BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); reader new BufferedReader(new InputStreamReader(System.in)) try{ 
        String line1 = reader.readLine();
        int N = Integer.parseInt(line1);
        String line2 = reader.readLine();
        String[] split = line2.split(" ");
        int[] A = new int[N];
        for(int i = 0; i < N ; i ++){
            A[i] = Integer.parseInt(split[i]);
        }
        int count = 0;
        for(int i = 0; i < N-1; i++){
            int minid = i;
            for(int j = i + 1; j < N; j++){
                if(A[j] < A[minid]){
                    minid = j;
                }
            }
            if(minid != i){
                int temp = A[i];
                A[i] = A[minid];
                A[minid] = temp;
                count ++;
            }
        }
        for(int i = 0; i < N; i++){
            if(i < N-1){
                System.out.print(A[i] + " ");
            }else{
                System.out.println(A[i]);
            }
        }
        System.out.println(count);
       }catch(IOException e){

       } catch(IOException e){

       } IOException e {

       } { 
        String line1 = reader.readLine();
        int N = Integer.parseInt(line1);
        String line2 = reader.readLine();
        String[] split = line2.split(" ");
        int[] A = new int[N];
        for(int i = 0; i < N ; i ++){
            A[i] = Integer.parseInt(split[i]);
        }
        int count = 0;
        for(int i = 0; i < N-1; i++){
            int minid = i;
            for(int j = i + 1; j < N; j++){
                if(A[j] < A[minid]){
                    minid = j;
                }
            }
            if(minid != i){
                int temp = A[i];
                A[i] = A[minid];
                A[minid] = temp;
                count ++;
            }
        }
        for(int i = 0; i < N; i++){
            if(i < N-1){
                System.out.print(A[i] + " ");
            }else{
                System.out.println(A[i]);
            }
        }
        System.out.println(count);
       } String line1 = reader.readLine(); line1 reader.readLine() reader.readLine reader int N = Integer.parseInt(line1); N Integer.parseInt(line1) Integer.parseInt Integer line1 String line2 = reader.readLine(); line2 reader.readLine() reader.readLine reader String[] split = line2.split(" "); split line2.split(" ") line2.split line2 " " int[] A = new int[N]; A new int[N] N for(int i = 0; i < N ; i ++){
            A[i] = Integer.parseInt(split[i]);
        } int i = 0; int i = 0; i 0 i < N i N i ++ i ++ i {
            A[i] = Integer.parseInt(split[i]);
        } {
            A[i] = Integer.parseInt(split[i]);
        } A[i] = Integer.parseInt(split[i]) A[i] A i Integer.parseInt(split[i]) Integer.parseInt Integer split[i] split i int count = 0; count 0 for(int i = 0; i < N-1; i++){
            int minid = i;
            for(int j = i + 1; j < N; j++){
                if(A[j] < A[minid]){
                    minid = j;
                }
            }
            if(minid != i){
                int temp = A[i];
                A[i] = A[minid];
                A[minid] = temp;
                count ++;
            }
        } int i = 0; int i = 0; i 0 i < N-1 i N-1 N 1 i++ i++ i {
            int minid = i;
            for(int j = i + 1; j < N; j++){
                if(A[j] < A[minid]){
                    minid = j;
                }
            }
            if(minid != i){
                int temp = A[i];
                A[i] = A[minid];
                A[minid] = temp;
                count ++;
            }
        } {
            int minid = i;
            for(int j = i + 1; j < N; j++){
                if(A[j] < A[minid]){
                    minid = j;
                }
            }
            if(minid != i){
                int temp = A[i];
                A[i] = A[minid];
                A[minid] = temp;
                count ++;
            }
        } int minid = i; minid i for(int j = i + 1; j < N; j++){
                if(A[j] < A[minid]){
                    minid = 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[minid]){
                    minid = j;
                }
            } {
                if(A[j] < A[minid]){
                    minid = j;
                }
            } if(A[j] < A[minid]){
                    minid = j;
                } A[j] < A[minid] A[j] A j A[minid] A minid {
                    minid = j;
                } minid = j minid j if(minid != i){
                int temp = A[i];
                A[i] = A[minid];
                A[minid] = temp;
                count ++;
            } minid != i minid i {
                int temp = A[i];
                A[i] = A[minid];
                A[minid] = temp;
                count ++;
            } int temp = A[i]; temp A[i] A i A[i] = A[minid] A[i] A i A[minid] A minid A[minid] = temp A[minid] A minid temp count ++ count for(int i = 0; i < N; i++){
            if(i < N-1){
                System.out.print(A[i] + " ");
            }else{
                System.out.println(A[i]);
            }
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            if(i < N-1){
                System.out.print(A[i] + " ");
            }else{
                System.out.println(A[i]);
            }
        } {
            if(i < N-1){
                System.out.print(A[i] + " ");
            }else{
                System.out.println(A[i]);
            }
        } if(i < N-1){
                System.out.print(A[i] + " ");
            }else{
                System.out.println(A[i]);
            } i < N-1 i N-1 N 1 {
                System.out.print(A[i] + " ");
            } System.out.print(A[i] + " ") System.out.print System.out System System.out A[i] + " " A[i] A i " " {
                System.out.println(A[i]);
            } System.out.println(A[i]) System.out.println System.out System System.out A[i] A i 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) {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
       try{ 
        String line1 = reader.readLine();
        int N = Integer.parseInt(line1);
        String line2 = reader.readLine();
        String[] split = line2.split(" ");
        int[] A = new int[N];
        for(int i = 0; i < N ; i ++){
            A[i] = Integer.parseInt(split[i]);
        }
        int count = 0;
        for(int i = 0; i < N-1; i++){
            int minid = i;
            for(int j = i + 1; j < N; j++){
                if(A[j] < A[minid]){
                    minid = j;
                }
            }
            if(minid != i){
                int temp = A[i];
                A[i] = A[minid];
                A[minid] = temp;
                count ++;
            }
        }
        for(int i = 0; i < N; i++){
            if(i < N-1){
                System.out.print(A[i] + " ");
            }else{
                System.out.println(A[i]);
            }
        }
        System.out.println(count);
       }catch(IOException e){

       }
    }
} public class Main {
    public static void main(String[] args) {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
       try{ 
        String line1 = reader.readLine();
        int N = Integer.parseInt(line1);
        String line2 = reader.readLine();
        String[] split = line2.split(" ");
        int[] A = new int[N];
        for(int i = 0; i < N ; i ++){
            A[i] = Integer.parseInt(split[i]);
        }
        int count = 0;
        for(int i = 0; i < N-1; i++){
            int minid = i;
            for(int j = i + 1; j < N; j++){
                if(A[j] < A[minid]){
                    minid = j;
                }
            }
            if(minid != i){
                int temp = A[i];
                A[i] = A[minid];
                A[minid] = temp;
                count ++;
            }
        }
        for(int i = 0; i < N; i++){
            if(i < N-1){
                System.out.print(A[i] + " ");
            }else{
                System.out.println(A[i]);
            }
        }
        System.out.println(count);
       }catch(IOException e){

       }
    }
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
       try{ 
        String line1 = reader.readLine();
        int N = Integer.parseInt(line1);
        String line2 = reader.readLine();
        String[] split = line2.split(" ");
        int[] A = new int[N];
        for(int i = 0; i < N ; i ++){
            A[i] = Integer.parseInt(split[i]);
        }
        int count = 0;
        for(int i = 0; i < N-1; i++){
            int minid = i;
            for(int j = i + 1; j < N; j++){
                if(A[j] < A[minid]){
                    minid = j;
                }
            }
            if(minid != i){
                int temp = A[i];
                A[i] = A[minid];
                A[minid] = temp;
                count ++;
            }
        }
        for(int i = 0; i < N; i++){
            if(i < N-1){
                System.out.print(A[i] + " ");
            }else{
                System.out.println(A[i]);
            }
        }
        System.out.println(count);
       }catch(IOException e){

       }
    }
}
