import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
	    int length = scanner.nextInt();
		int A[] = new int[length];
        for(int i = 0; i < length; i++)
        	A[i] = scanner.nextInt();
        
        int key = 1000;
		int mini = 0;
		int count = 0;
		for (int i = 0; i < length; i++) {
			mini = i;
			for (int j = i; j < length; j++) {
				if (A[j] < A[mini])
					mini = j;
			}
			if (i != mini){
			key = A[mini];
			A[mini] = A[i];
			A[i] = key;
			count++;
			}
		}
		out_put(A);
		System.out.println(count);	
	}
	
	private static void out_put(int A[]){
        System.out.printf("%d", A[0]);
        for(int i = 1; i < A.length; i++){
            System.out.printf(" %d", A[i]);
        }
        System.out.printf("\n");
    }
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
	    int length = scanner.nextInt();
		int A[] = new int[length];
        for(int i = 0; i < length; i++)
        	A[i] = scanner.nextInt();
        
        int key = 1000;
		int mini = 0;
		int count = 0;
		for (int i = 0; i < length; i++) {
			mini = i;
			for (int j = i; j < length; j++) {
				if (A[j] < A[mini])
					mini = j;
			}
			if (i != mini){
			key = A[mini];
			A[mini] = A[i];
			A[i] = key;
			count++;
			}
		}
		out_put(A);
		System.out.println(count);	
	}
	
	private static void out_put(int A[]){
        System.out.printf("%d", A[0]);
        for(int i = 1; i < A.length; i++){
            System.out.printf(" %d", A[i]);
        }
        System.out.printf("\n");
    }
} Main public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
	    int length = scanner.nextInt();
		int A[] = new int[length];
        for(int i = 0; i < length; i++)
        	A[i] = scanner.nextInt();
        
        int key = 1000;
		int mini = 0;
		int count = 0;
		for (int i = 0; i < length; i++) {
			mini = i;
			for (int j = i; j < length; j++) {
				if (A[j] < A[mini])
					mini = j;
			}
			if (i != mini){
			key = A[mini];
			A[mini] = A[i];
			A[i] = key;
			count++;
			}
		}
		out_put(A);
		System.out.println(count);	
	} main {
		Scanner scanner = new Scanner(System.in);
	    int length = scanner.nextInt();
		int A[] = new int[length];
        for(int i = 0; i < length; i++)
        	A[i] = scanner.nextInt();
        
        int key = 1000;
		int mini = 0;
		int count = 0;
		for (int i = 0; i < length; i++) {
			mini = i;
			for (int j = i; j < length; j++) {
				if (A[j] < A[mini])
					mini = j;
			}
			if (i != mini){
			key = A[mini];
			A[mini] = A[i];
			A[i] = key;
			count++;
			}
		}
		out_put(A);
		System.out.println(count);	
	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int length = scanner.nextInt(); length scanner.nextInt() scanner.nextInt scanner int A[] = new int[length]; A new int[length] length for(int i = 0; i < length; i++)
        	A[i] = scanner.nextInt(); int i = 0; int i = 0; i 0 i < length i length i++ i++ i A[i] = scanner.nextInt(); A[i] = scanner.nextInt() A[i] A i scanner.nextInt() scanner.nextInt scanner int key = 1000; key 1000 int mini = 0; mini 0 int count = 0; count 0 for (int i = 0; i < length; i++) {
			mini = i;
			for (int j = i; j < length; j++) {
				if (A[j] < A[mini])
					mini = j;
			}
			if (i != mini){
			key = A[mini];
			A[mini] = A[i];
			A[i] = key;
			count++;
			}
		} int i = 0; int i = 0; i 0 i < length i length i++ i++ i {
			mini = i;
			for (int j = i; j < length; j++) {
				if (A[j] < A[mini])
					mini = j;
			}
			if (i != mini){
			key = A[mini];
			A[mini] = A[i];
			A[i] = key;
			count++;
			}
		} {
			mini = i;
			for (int j = i; j < length; j++) {
				if (A[j] < A[mini])
					mini = j;
			}
			if (i != mini){
			key = A[mini];
			A[mini] = A[i];
			A[i] = key;
			count++;
			}
		} mini = i mini i for (int j = i; j < length; j++) {
				if (A[j] < A[mini])
					mini = j;
			} int j = i; int j = i; j i j < length j length j++ j++ j {
				if (A[j] < A[mini])
					mini = j;
			} {
				if (A[j] < A[mini])
					mini = j;
			} if (A[j] < A[mini])
					mini = j; A[j] < A[mini] A[j] A j A[mini] A mini mini = j mini j if (i != mini){
			key = A[mini];
			A[mini] = A[i];
			A[i] = key;
			count++;
			} i != mini i mini {
			key = A[mini];
			A[mini] = A[i];
			A[i] = key;
			count++;
			} key = A[mini] key A[mini] A mini A[mini] = A[i] A[mini] A mini A[i] A i A[i] = key A[i] A i key count++ count out_put(A) out_put A System.out.println(count) System.out.println System.out System System.out count String[] args args private static void out_put(int A[]){
        System.out.printf("%d", A[0]);
        for(int i = 1; i < A.length; i++){
            System.out.printf(" %d", A[i]);
        }
        System.out.printf("\n");
    } out_put {
        System.out.printf("%d", A[0]);
        for(int i = 1; i < A.length; i++){
            System.out.printf(" %d", A[i]);
        }
        System.out.printf("\n");
    } System.out.printf("%d", A[0]) System.out.printf System.out System System.out "%d" A[0] A 0 for(int i = 1; i < A.length; i++){
            System.out.printf(" %d", A[i]);
        } int i = 1; int i = 1; i 1 i < A.length i A.length A A.length i++ i++ i {
            System.out.printf(" %d", A[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.printf("\n") System.out.printf System.out System System.out "\n" int A[] A public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
	    int length = scanner.nextInt();
		int A[] = new int[length];
        for(int i = 0; i < length; i++)
        	A[i] = scanner.nextInt();
        
        int key = 1000;
		int mini = 0;
		int count = 0;
		for (int i = 0; i < length; i++) {
			mini = i;
			for (int j = i; j < length; j++) {
				if (A[j] < A[mini])
					mini = j;
			}
			if (i != mini){
			key = A[mini];
			A[mini] = A[i];
			A[i] = key;
			count++;
			}
		}
		out_put(A);
		System.out.println(count);	
	}
	
	private static void out_put(int A[]){
        System.out.printf("%d", A[0]);
        for(int i = 1; i < A.length; i++){
            System.out.printf(" %d", A[i]);
        }
        System.out.printf("\n");
    }
} public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
	    int length = scanner.nextInt();
		int A[] = new int[length];
        for(int i = 0; i < length; i++)
        	A[i] = scanner.nextInt();
        
        int key = 1000;
		int mini = 0;
		int count = 0;
		for (int i = 0; i < length; i++) {
			mini = i;
			for (int j = i; j < length; j++) {
				if (A[j] < A[mini])
					mini = j;
			}
			if (i != mini){
			key = A[mini];
			A[mini] = A[i];
			A[i] = key;
			count++;
			}
		}
		out_put(A);
		System.out.println(count);	
	}
	
	private static void out_put(int A[]){
        System.out.printf("%d", A[0]);
        for(int i = 1; i < A.length; i++){
            System.out.printf(" %d", A[i]);
        }
        System.out.printf("\n");
    }
} Main
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
	    int length = scanner.nextInt();
		int A[] = new int[length];
        for(int i = 0; i < length; i++)
        	A[i] = scanner.nextInt();
        
        int key = 1000;
		int mini = 0;
		int count = 0;
		for (int i = 0; i < length; i++) {
			mini = i;
			for (int j = i; j < length; j++) {
				if (A[j] < A[mini])
					mini = j;
			}
			if (i != mini){
			key = A[mini];
			A[mini] = A[i];
			A[i] = key;
			count++;
			}
		}
		out_put(A);
		System.out.println(count);	
	}
	
	private static void out_put(int A[]){
        System.out.printf("%d", A[0]);
        for(int i = 1; i < A.length; i++){
            System.out.printf(" %d", A[i]);
        }
        System.out.printf("\n");
    }
}
