import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main{
	private static int selection(int a[]){
		int count=0;
		int mini=0;
		for(int i = 0 ; i < a.length-1 ; i++){
			mini=i;
			for(int j = i+1;j<a.length;j++){
				if(a[j]<a[mini]){
					mini=j;			
				}
			}
			if(mini!=i){
				int temp=a[i];
				a[i]=a[mini];
				a[mini]=temp;
				count++;
			}
		}
		return count;
	}
	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String[] strdata = new String[n];
		String str = br.readLine();
		strdata = str.split(" ");
		int[] data = new int[n];
		for(int i = 0 ; i < n ; i ++)
			data[i] = Integer.parseInt(strdata[i]);
		int count = selection(data);
		for(int i = 0 ; i < n-1; i++){
			System.out.print(data[i]+" ");
		}
		System.out.println(data[n-1]);
		System.out.println(count);
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main{
	private static int selection(int a[]){
		int count=0;
		int mini=0;
		for(int i = 0 ; i < a.length-1 ; i++){
			mini=i;
			for(int j = i+1;j<a.length;j++){
				if(a[j]<a[mini]){
					mini=j;			
				}
			}
			if(mini!=i){
				int temp=a[i];
				a[i]=a[mini];
				a[mini]=temp;
				count++;
			}
		}
		return count;
	}
	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String[] strdata = new String[n];
		String str = br.readLine();
		strdata = str.split(" ");
		int[] data = new int[n];
		for(int i = 0 ; i < n ; i ++)
			data[i] = Integer.parseInt(strdata[i]);
		int count = selection(data);
		for(int i = 0 ; i < n-1; i++){
			System.out.print(data[i]+" ");
		}
		System.out.println(data[n-1]);
		System.out.println(count);
	}
} Main private static int selection(int a[]){
		int count=0;
		int mini=0;
		for(int i = 0 ; i < a.length-1 ; i++){
			mini=i;
			for(int j = i+1;j<a.length;j++){
				if(a[j]<a[mini]){
					mini=j;			
				}
			}
			if(mini!=i){
				int temp=a[i];
				a[i]=a[mini];
				a[mini]=temp;
				count++;
			}
		}
		return count;
	} selection {
		int count=0;
		int mini=0;
		for(int i = 0 ; i < a.length-1 ; i++){
			mini=i;
			for(int j = i+1;j<a.length;j++){
				if(a[j]<a[mini]){
					mini=j;			
				}
			}
			if(mini!=i){
				int temp=a[i];
				a[i]=a[mini];
				a[mini]=temp;
				count++;
			}
		}
		return count;
	} int count=0; count 0 int mini=0; mini 0 for(int i = 0 ; i < a.length-1 ; i++){
			mini=i;
			for(int j = i+1;j<a.length;j++){
				if(a[j]<a[mini]){
					mini=j;			
				}
			}
			if(mini!=i){
				int temp=a[i];
				a[i]=a[mini];
				a[mini]=temp;
				count++;
			}
		} int i = 0 ; int i = 0 ; i 0 i < a.length-1 i a.length-1 a.length a a.length 1 i++ i++ i {
			mini=i;
			for(int j = i+1;j<a.length;j++){
				if(a[j]<a[mini]){
					mini=j;			
				}
			}
			if(mini!=i){
				int temp=a[i];
				a[i]=a[mini];
				a[mini]=temp;
				count++;
			}
		} {
			mini=i;
			for(int j = i+1;j<a.length;j++){
				if(a[j]<a[mini]){
					mini=j;			
				}
			}
			if(mini!=i){
				int temp=a[i];
				a[i]=a[mini];
				a[mini]=temp;
				count++;
			}
		} mini=i mini i for(int j = i+1;j<a.length;j++){
				if(a[j]<a[mini]){
					mini=j;			
				}
			} int j = i+1; int j = i+1; j i+1 i 1 j<a.length j a.length a a.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 mini j if(mini!=i){
				int temp=a[i];
				a[i]=a[mini];
				a[mini]=temp;
				count++;
			} mini!=i mini i {
				int temp=a[i];
				a[i]=a[mini];
				a[mini]=temp;
				count++;
			} int temp=a[i]; temp a[i] a i a[i]=a[mini] a[i] a i a[mini] a mini a[mini]=temp a[mini] a mini temp count++ count return count; count int a[] a public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String[] strdata = new String[n];
		String str = br.readLine();
		strdata = str.split(" ");
		int[] data = new int[n];
		for(int i = 0 ; i < n ; i ++)
			data[i] = Integer.parseInt(strdata[i]);
		int count = selection(data);
		for(int i = 0 ; i < n-1; i++){
			System.out.print(data[i]+" ");
		}
		System.out.println(data[n-1]);
		System.out.println(count);
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String[] strdata = new String[n];
		String str = br.readLine();
		strdata = str.split(" ");
		int[] data = new int[n];
		for(int i = 0 ; i < n ; i ++)
			data[i] = Integer.parseInt(strdata[i]);
		int count = selection(data);
		for(int i = 0 ; i < n-1; i++){
			System.out.print(data[i]+" ");
		}
		System.out.println(data[n-1]);
		System.out.println(count);
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int n = Integer.parseInt(br.readLine()); n Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br String[] strdata = new String[n]; strdata new String[n] n String str = br.readLine(); str br.readLine() br.readLine br strdata = str.split(" ") strdata str.split(" ") str.split str " " int[] data = new int[n]; data new int[n] n for(int i = 0 ; i < n ; i ++)
			data[i] = Integer.parseInt(strdata[i]); int i = 0 ; int i = 0 ; i 0 i < n i n i ++ i ++ i data[i] = Integer.parseInt(strdata[i]); data[i] = Integer.parseInt(strdata[i]) data[i] data i Integer.parseInt(strdata[i]) Integer.parseInt Integer strdata[i] strdata i int count = selection(data); count selection(data) selection data for(int i = 0 ; i < n-1; i++){
			System.out.print(data[i]+" ");
		} int i = 0 ; int i = 0 ; i 0 i < n-1 i n-1 n 1 i++ i++ i {
			System.out.print(data[i]+" ");
		} {
			System.out.print(data[i]+" ");
		} System.out.print(data[i]+" ") System.out.print System.out System System.out data[i]+" " data[i] data i " " System.out.println(data[n-1]) System.out.println System.out System System.out data[n-1] data n-1 n 1 System.out.println(count) System.out.println System.out System System.out count String[] args args public class Main{
	private static int selection(int a[]){
		int count=0;
		int mini=0;
		for(int i = 0 ; i < a.length-1 ; i++){
			mini=i;
			for(int j = i+1;j<a.length;j++){
				if(a[j]<a[mini]){
					mini=j;			
				}
			}
			if(mini!=i){
				int temp=a[i];
				a[i]=a[mini];
				a[mini]=temp;
				count++;
			}
		}
		return count;
	}
	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String[] strdata = new String[n];
		String str = br.readLine();
		strdata = str.split(" ");
		int[] data = new int[n];
		for(int i = 0 ; i < n ; i ++)
			data[i] = Integer.parseInt(strdata[i]);
		int count = selection(data);
		for(int i = 0 ; i < n-1; i++){
			System.out.print(data[i]+" ");
		}
		System.out.println(data[n-1]);
		System.out.println(count);
	}
} public class Main{
	private static int selection(int a[]){
		int count=0;
		int mini=0;
		for(int i = 0 ; i < a.length-1 ; i++){
			mini=i;
			for(int j = i+1;j<a.length;j++){
				if(a[j]<a[mini]){
					mini=j;			
				}
			}
			if(mini!=i){
				int temp=a[i];
				a[i]=a[mini];
				a[mini]=temp;
				count++;
			}
		}
		return count;
	}
	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String[] strdata = new String[n];
		String str = br.readLine();
		strdata = str.split(" ");
		int[] data = new int[n];
		for(int i = 0 ; i < n ; i ++)
			data[i] = Integer.parseInt(strdata[i]);
		int count = selection(data);
		for(int i = 0 ; i < n-1; i++){
			System.out.print(data[i]+" ");
		}
		System.out.println(data[n-1]);
		System.out.println(count);
	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main{
	private static int selection(int a[]){
		int count=0;
		int mini=0;
		for(int i = 0 ; i < a.length-1 ; i++){
			mini=i;
			for(int j = i+1;j<a.length;j++){
				if(a[j]<a[mini]){
					mini=j;			
				}
			}
			if(mini!=i){
				int temp=a[i];
				a[i]=a[mini];
				a[mini]=temp;
				count++;
			}
		}
		return count;
	}
	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String[] strdata = new String[n];
		String str = br.readLine();
		strdata = str.split(" ");
		int[] data = new int[n];
		for(int i = 0 ; i < n ; i ++)
			data[i] = Integer.parseInt(strdata[i]);
		int count = selection(data);
		for(int i = 0 ; i < n-1; i++){
			System.out.print(data[i]+" ");
		}
		System.out.println(data[n-1]);
		System.out.println(count);
	}
}