import java.io.*;

class Main
{
 
  public static void main(String[] args)
  {
    try{
    	// ??\???????????????
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      // ????????°???????????????
      int n = Integer.parseInt(br.readLine());
      String[] str = br.readLine().split(" ");
      int[] array = new int[n];
 
      for(int i = 0; i < n; i++){
        array[i] = Integer.parseInt(str[i]);
      }
      selectionSort(array, array.length);
 
    }catch(Exception e){
      System.out.println(e);
    }
  }
 
  public static void selectionSort(int[] A, int N)
  {
    int swapNum = 0;
 
    for(int i = 0; i < N; ++i){
    	int mini = i;
    	for(int j = i + 1;j < N;++j){
    		if(A[j] < A[mini]){
    			mini = j;
    		}
    	}
    	if(mini != i){
    		++swapNum;
			final int tmp = A[i];
			A[i] = A[mini];
			A[mini] = tmp;
    	}
    }
    
    System.out.print(show(A));
    System.out.println(Integer.valueOf(swapNum));
  }
 
  public static String show(int[] B)
  {
    StringBuilder sb = new StringBuilder();
 
    for(int i = 0; i < B.length; i++){
      sb.append(B[i]).append(" ");
    }
    sb.deleteCharAt(sb.length() - 1);
    sb.append("\n");
 
    return sb.toString();
  }
} import java.io.*; io.* java class Main
{
 
  public static void main(String[] args)
  {
    try{
    	// ??\???????????????
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      // ????????°???????????????
      int n = Integer.parseInt(br.readLine());
      String[] str = br.readLine().split(" ");
      int[] array = new int[n];
 
      for(int i = 0; i < n; i++){
        array[i] = Integer.parseInt(str[i]);
      }
      selectionSort(array, array.length);
 
    }catch(Exception e){
      System.out.println(e);
    }
  }
 
  public static void selectionSort(int[] A, int N)
  {
    int swapNum = 0;
 
    for(int i = 0; i < N; ++i){
    	int mini = i;
    	for(int j = i + 1;j < N;++j){
    		if(A[j] < A[mini]){
    			mini = j;
    		}
    	}
    	if(mini != i){
    		++swapNum;
			final int tmp = A[i];
			A[i] = A[mini];
			A[mini] = tmp;
    	}
    }
    
    System.out.print(show(A));
    System.out.println(Integer.valueOf(swapNum));
  }
 
  public static String show(int[] B)
  {
    StringBuilder sb = new StringBuilder();
 
    for(int i = 0; i < B.length; i++){
      sb.append(B[i]).append(" ");
    }
    sb.deleteCharAt(sb.length() - 1);
    sb.append("\n");
 
    return sb.toString();
  }
} Main public static void main(String[] args)
  {
    try{
    	// ??\???????????????
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      // ????????°???????????????
      int n = Integer.parseInt(br.readLine());
      String[] str = br.readLine().split(" ");
      int[] array = new int[n];
 
      for(int i = 0; i < n; i++){
        array[i] = Integer.parseInt(str[i]);
      }
      selectionSort(array, array.length);
 
    }catch(Exception e){
      System.out.println(e);
    }
  } main {
    try{
    	// ??\???????????????
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      // ????????°???????????????
      int n = Integer.parseInt(br.readLine());
      String[] str = br.readLine().split(" ");
      int[] array = new int[n];
 
      for(int i = 0; i < n; i++){
        array[i] = Integer.parseInt(str[i]);
      }
      selectionSort(array, array.length);
 
    }catch(Exception e){
      System.out.println(e);
    }
  } try{
    	// ??\???????????????
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      // ????????°???????????????
      int n = Integer.parseInt(br.readLine());
      String[] str = br.readLine().split(" ");
      int[] array = new int[n];
 
      for(int i = 0; i < n; i++){
        array[i] = Integer.parseInt(str[i]);
      }
      selectionSort(array, array.length);
 
    }catch(Exception e){
      System.out.println(e);
    } catch(Exception e){
      System.out.println(e);
    } Exception e {
      System.out.println(e);
    } System.out.println(e) System.out.println System.out System System.out e {
    	// ??\???????????????
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      // ????????°???????????????
      int n = Integer.parseInt(br.readLine());
      String[] str = br.readLine().split(" ");
      int[] array = new int[n];
 
      for(int i = 0; i < n; i++){
        array[i] = Integer.parseInt(str[i]);
      }
      selectionSort(array, array.length);
 
    } 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[] str = br.readLine().split(" "); str br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int[] array = new int[n]; array new int[n] n for(int i = 0; i < n; i++){
        array[i] = Integer.parseInt(str[i]);
      } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
        array[i] = Integer.parseInt(str[i]);
      } {
        array[i] = Integer.parseInt(str[i]);
      } array[i] = Integer.parseInt(str[i]) array[i] array i Integer.parseInt(str[i]) Integer.parseInt Integer str[i] str i selectionSort(array, array.length) selectionSort array array.length array array.length String[] args args public static void selectionSort(int[] A, int N)
  {
    int swapNum = 0;
 
    for(int i = 0; i < N; ++i){
    	int mini = i;
    	for(int j = i + 1;j < N;++j){
    		if(A[j] < A[mini]){
    			mini = j;
    		}
    	}
    	if(mini != i){
    		++swapNum;
			final int tmp = A[i];
			A[i] = A[mini];
			A[mini] = tmp;
    	}
    }
    
    System.out.print(show(A));
    System.out.println(Integer.valueOf(swapNum));
  } selectionSort {
    int swapNum = 0;
 
    for(int i = 0; i < N; ++i){
    	int mini = i;
    	for(int j = i + 1;j < N;++j){
    		if(A[j] < A[mini]){
    			mini = j;
    		}
    	}
    	if(mini != i){
    		++swapNum;
			final int tmp = A[i];
			A[i] = A[mini];
			A[mini] = tmp;
    	}
    }
    
    System.out.print(show(A));
    System.out.println(Integer.valueOf(swapNum));
  } int swapNum = 0; swapNum 0 for(int i = 0; i < N; ++i){
    	int mini = i;
    	for(int j = i + 1;j < N;++j){
    		if(A[j] < A[mini]){
    			mini = j;
    		}
    	}
    	if(mini != i){
    		++swapNum;
			final int tmp = A[i];
			A[i] = A[mini];
			A[mini] = tmp;
    	}
    } int i = 0; int i = 0; i 0 i < N i N ++i ++i i {
    	int mini = i;
    	for(int j = i + 1;j < N;++j){
    		if(A[j] < A[mini]){
    			mini = j;
    		}
    	}
    	if(mini != i){
    		++swapNum;
			final int tmp = A[i];
			A[i] = A[mini];
			A[mini] = tmp;
    	}
    } {
    	int mini = i;
    	for(int j = i + 1;j < N;++j){
    		if(A[j] < A[mini]){
    			mini = j;
    		}
    	}
    	if(mini != i){
    		++swapNum;
			final int tmp = A[i];
			A[i] = A[mini];
			A[mini] = tmp;
    	}
    } int mini = i; mini i for(int j = i + 1;j < N;++j){
    		if(A[j] < A[mini]){
    			mini = 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[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){
    		++swapNum;
			final int tmp = A[i];
			A[i] = A[mini];
			A[mini] = tmp;
    	} mini != i mini i {
    		++swapNum;
			final int tmp = A[i];
			A[i] = A[mini];
			A[mini] = tmp;
    	} ++swapNum swapNum final int tmp = A[i]; tmp A[i] A i A[i] = A[mini] A[i] A i A[mini] A mini A[mini] = tmp A[mini] A mini tmp System.out.print(show(A)) System.out.print System.out System System.out show(A) show A System.out.println(Integer.valueOf(swapNum)) System.out.println System.out System System.out Integer.valueOf(swapNum) Integer.valueOf Integer swapNum int[] A A int N N public static String show(int[] B)
  {
    StringBuilder sb = new StringBuilder();
 
    for(int i = 0; i < B.length; i++){
      sb.append(B[i]).append(" ");
    }
    sb.deleteCharAt(sb.length() - 1);
    sb.append("\n");
 
    return sb.toString();
  } show {
    StringBuilder sb = new StringBuilder();
 
    for(int i = 0; i < B.length; i++){
      sb.append(B[i]).append(" ");
    }
    sb.deleteCharAt(sb.length() - 1);
    sb.append("\n");
 
    return sb.toString();
  } StringBuilder sb = new StringBuilder(); sb new StringBuilder() for(int i = 0; i < B.length; i++){
      sb.append(B[i]).append(" ");
    } int i = 0; int i = 0; i 0 i < B.length i B.length B B.length i++ i++ i {
      sb.append(B[i]).append(" ");
    } {
      sb.append(B[i]).append(" ");
    } sb.append(B[i]).append(" ") sb.append(B[i]).append sb.append(B[i]) sb.append sb B[i] B i " " sb.deleteCharAt(sb.length() - 1) sb.deleteCharAt sb sb.length() - 1 sb.length() sb.length sb 1 sb.append("\n") sb.append sb "\n" return sb.toString(); sb.toString() sb.toString sb int[] B B
import java.io.*;

class Main
{
 
  public static void main(String[] args)
  {
    try{
    	// ??\???????????????
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      // ????????°???????????????
      int n = Integer.parseInt(br.readLine());
      String[] str = br.readLine().split(" ");
      int[] array = new int[n];
 
      for(int i = 0; i < n; i++){
        array[i] = Integer.parseInt(str[i]);
      }
      selectionSort(array, array.length);
 
    }catch(Exception e){
      System.out.println(e);
    }
  }
 
  public static void selectionSort(int[] A, int N)
  {
    int swapNum = 0;
 
    for(int i = 0; i < N; ++i){
    	int mini = i;
    	for(int j = i + 1;j < N;++j){
    		if(A[j] < A[mini]){
    			mini = j;
    		}
    	}
    	if(mini != i){
    		++swapNum;
			final int tmp = A[i];
			A[i] = A[mini];
			A[mini] = tmp;
    	}
    }
    
    System.out.print(show(A));
    System.out.println(Integer.valueOf(swapNum));
  }
 
  public static String show(int[] B)
  {
    StringBuilder sb = new StringBuilder();
 
    for(int i = 0; i < B.length; i++){
      sb.append(B[i]).append(" ");
    }
    sb.deleteCharAt(sb.length() - 1);
    sb.append("\n");
 
    return sb.toString();
  }
}