/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;
import java.util.Collections;

/* Name of the class has to be "Main" only if the class is public. */
class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// 標準入力の読み込み開始
        Scanner scanner = new Scanner(System.in);

        // 数列の長さ
        int n = scanner.nextInt();

        // 数列
        List<Integer> numList = new ArrayList<Integer>();
        for (int i = 0; i < n; i++) {
            numList.add(scanner.nextInt());
        }

        // 標準入力の読み込み終了
        scanner.close();
        
        int minj = 0;
        int cnt = 0;
		for (int i = 0; i < n; i++) {
			minj = i;
			
			for (int j = i; j < n; j++) {
				if (numList.get(j) < numList.get(minj)) {
					minj = j;
				}
			}
			//A[i] と A[minj] を交換
			if (i < minj) {
				Collections.swap(numList, i, minj);
				cnt++;
			}
		}
		
		// 出力
		for(int i = 0; i < n; i++){
			System.out.print(numList.get(i));
			if(i < n - 1){
	    		System.out.print(" ");
			}
        }
        System.out.println();
        
        System.out.println(cnt);
    }
} import java.util.*; util.* java import java.lang.*; lang.* java import java.io.*; io.* java import java.util.Collections; Collections java.util class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// 標準入力の読み込み開始
        Scanner scanner = new Scanner(System.in);

        // 数列の長さ
        int n = scanner.nextInt();

        // 数列
        List<Integer> numList = new ArrayList<Integer>();
        for (int i = 0; i < n; i++) {
            numList.add(scanner.nextInt());
        }

        // 標準入力の読み込み終了
        scanner.close();
        
        int minj = 0;
        int cnt = 0;
		for (int i = 0; i < n; i++) {
			minj = i;
			
			for (int j = i; j < n; j++) {
				if (numList.get(j) < numList.get(minj)) {
					minj = j;
				}
			}
			//A[i] と A[minj] を交換
			if (i < minj) {
				Collections.swap(numList, i, minj);
				cnt++;
			}
		}
		
		// 出力
		for(int i = 0; i < n; i++){
			System.out.print(numList.get(i));
			if(i < n - 1){
	    		System.out.print(" ");
			}
        }
        System.out.println();
        
        System.out.println(cnt);
    }
} Main public static void main (String[] args) throws java.lang.Exception
	{
		// 標準入力の読み込み開始
        Scanner scanner = new Scanner(System.in);

        // 数列の長さ
        int n = scanner.nextInt();

        // 数列
        List<Integer> numList = new ArrayList<Integer>();
        for (int i = 0; i < n; i++) {
            numList.add(scanner.nextInt());
        }

        // 標準入力の読み込み終了
        scanner.close();
        
        int minj = 0;
        int cnt = 0;
		for (int i = 0; i < n; i++) {
			minj = i;
			
			for (int j = i; j < n; j++) {
				if (numList.get(j) < numList.get(minj)) {
					minj = j;
				}
			}
			//A[i] と A[minj] を交換
			if (i < minj) {
				Collections.swap(numList, i, minj);
				cnt++;
			}
		}
		
		// 出力
		for(int i = 0; i < n; i++){
			System.out.print(numList.get(i));
			if(i < n - 1){
	    		System.out.print(" ");
			}
        }
        System.out.println();
        
        System.out.println(cnt);
    } main {
		// 標準入力の読み込み開始
        Scanner scanner = new Scanner(System.in);

        // 数列の長さ
        int n = scanner.nextInt();

        // 数列
        List<Integer> numList = new ArrayList<Integer>();
        for (int i = 0; i < n; i++) {
            numList.add(scanner.nextInt());
        }

        // 標準入力の読み込み終了
        scanner.close();
        
        int minj = 0;
        int cnt = 0;
		for (int i = 0; i < n; i++) {
			minj = i;
			
			for (int j = i; j < n; j++) {
				if (numList.get(j) < numList.get(minj)) {
					minj = j;
				}
			}
			//A[i] と A[minj] を交換
			if (i < minj) {
				Collections.swap(numList, i, minj);
				cnt++;
			}
		}
		
		// 出力
		for(int i = 0; i < n; i++){
			System.out.print(numList.get(i));
			if(i < n - 1){
	    		System.out.print(" ");
			}
        }
        System.out.println();
        
        System.out.println(cnt);
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int n = scanner.nextInt(); n scanner.nextInt() scanner.nextInt scanner List<Integer> numList = new ArrayList<Integer>(); numList new ArrayList<Integer>() for (int i = 0; i < n; i++) {
            numList.add(scanner.nextInt());
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            numList.add(scanner.nextInt());
        } {
            numList.add(scanner.nextInt());
        } numList.add(scanner.nextInt()) numList.add numList scanner.nextInt() scanner.nextInt scanner scanner.close() scanner.close scanner int minj = 0; minj 0 int cnt = 0; cnt 0 for (int i = 0; i < n; i++) {
			minj = i;
			
			for (int j = i; j < n; j++) {
				if (numList.get(j) < numList.get(minj)) {
					minj = j;
				}
			}
			//A[i] と A[minj] を交換
			if (i < minj) {
				Collections.swap(numList, i, minj);
				cnt++;
			}
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			minj = i;
			
			for (int j = i; j < n; j++) {
				if (numList.get(j) < numList.get(minj)) {
					minj = j;
				}
			}
			//A[i] と A[minj] を交換
			if (i < minj) {
				Collections.swap(numList, i, minj);
				cnt++;
			}
		} {
			minj = i;
			
			for (int j = i; j < n; j++) {
				if (numList.get(j) < numList.get(minj)) {
					minj = j;
				}
			}
			//A[i] と A[minj] を交換
			if (i < minj) {
				Collections.swap(numList, i, minj);
				cnt++;
			}
		} minj = i minj i for (int j = i; j < n; j++) {
				if (numList.get(j) < numList.get(minj)) {
					minj = j;
				}
			} int j = i; int j = i; j i j < n j n j++ j++ j {
				if (numList.get(j) < numList.get(minj)) {
					minj = j;
				}
			} {
				if (numList.get(j) < numList.get(minj)) {
					minj = j;
				}
			} if (numList.get(j) < numList.get(minj)) {
					minj = j;
				} numList.get(j) < numList.get(minj) numList.get(j) numList.get numList j numList.get(minj) numList.get numList minj {
					minj = j;
				} minj = j minj j if (i < minj) {
				Collections.swap(numList, i, minj);
				cnt++;
			} i < minj i minj {
				Collections.swap(numList, i, minj);
				cnt++;
			} Collections.swap(numList, i, minj) Collections.swap Collections numList i minj cnt++ cnt for(int i = 0; i < n; i++){
			System.out.print(numList.get(i));
			if(i < n - 1){
	    		System.out.print(" ");
			}
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			System.out.print(numList.get(i));
			if(i < n - 1){
	    		System.out.print(" ");
			}
        } {
			System.out.print(numList.get(i));
			if(i < n - 1){
	    		System.out.print(" ");
			}
        } System.out.print(numList.get(i)) System.out.print System.out System System.out numList.get(i) numList.get numList i if(i < n - 1){
	    		System.out.print(" ");
			} i < n - 1 i n - 1 n 1 {
	    		System.out.print(" ");
			} System.out.print(" ") System.out.print System.out System System.out " " System.out.println() System.out.println System.out System System.out System.out.println(cnt) System.out.println System.out System System.out cnt String[] args args
/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;
import java.util.Collections;

/* Name of the class has to be "Main" only if the class is public. */
class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// 標準入力の読み込み開始
        Scanner scanner = new Scanner(System.in);

        // 数列の長さ
        int n = scanner.nextInt();

        // 数列
        List<Integer> numList = new ArrayList<Integer>();
        for (int i = 0; i < n; i++) {
            numList.add(scanner.nextInt());
        }

        // 標準入力の読み込み終了
        scanner.close();
        
        int minj = 0;
        int cnt = 0;
		for (int i = 0; i < n; i++) {
			minj = i;
			
			for (int j = i; j < n; j++) {
				if (numList.get(j) < numList.get(minj)) {
					minj = j;
				}
			}
			//A[i] と A[minj] を交換
			if (i < minj) {
				Collections.swap(numList, i, minj);
				cnt++;
			}
		}
		
		// 出力
		for(int i = 0; i < n; i++){
			System.out.print(numList.get(i));
			if(i < n - 1){
	    		System.out.print(" ");
			}
        }
        System.out.println();
        
        System.out.println(cnt);
    }
}
