import java.util.*;

public class Main {
   public static void main(String [] args) {
      Scanner sc = new Scanner(System.in);
      int n = Integer.parseInt(sc.nextLine());
      int[] arr = new int[n];
      int counter = 0;
      int minIndex;
      
      String[] input = sc.nextLine().split(" ");
      for(int i = 0; i < n; i ++) {
         arr[i] = Integer.parseInt(input[i]);
      }
      
      for(int i = 0; i < n; i ++) {
         minIndex = i;
         for(int j = i; j < n; j ++) {
            if(arr[j] < arr[minIndex]) {
               minIndex = j;
            }
         }
         int temp = arr[minIndex];
         arr[minIndex] = arr[i];
         arr[i] = temp;
         if(minIndex != i) {
            counter ++;
         }
      }
      
      for(int i = 0; i < n; i ++) {
         System.out.print(arr[i]);
         if(i != n-1) {
            System.out.print(" ");
         }
      }
      
      System.out.println("\n" + counter);
      
   }
}
 import java.util.*; util.* java public class Main {
   public static void main(String [] args) {
      Scanner sc = new Scanner(System.in);
      int n = Integer.parseInt(sc.nextLine());
      int[] arr = new int[n];
      int counter = 0;
      int minIndex;
      
      String[] input = sc.nextLine().split(" ");
      for(int i = 0; i < n; i ++) {
         arr[i] = Integer.parseInt(input[i]);
      }
      
      for(int i = 0; i < n; i ++) {
         minIndex = i;
         for(int j = i; j < n; j ++) {
            if(arr[j] < arr[minIndex]) {
               minIndex = j;
            }
         }
         int temp = arr[minIndex];
         arr[minIndex] = arr[i];
         arr[i] = temp;
         if(minIndex != i) {
            counter ++;
         }
      }
      
      for(int i = 0; i < n; i ++) {
         System.out.print(arr[i]);
         if(i != n-1) {
            System.out.print(" ");
         }
      }
      
      System.out.println("\n" + counter);
      
   }
} Main public static void main(String [] args) {
      Scanner sc = new Scanner(System.in);
      int n = Integer.parseInt(sc.nextLine());
      int[] arr = new int[n];
      int counter = 0;
      int minIndex;
      
      String[] input = sc.nextLine().split(" ");
      for(int i = 0; i < n; i ++) {
         arr[i] = Integer.parseInt(input[i]);
      }
      
      for(int i = 0; i < n; i ++) {
         minIndex = i;
         for(int j = i; j < n; j ++) {
            if(arr[j] < arr[minIndex]) {
               minIndex = j;
            }
         }
         int temp = arr[minIndex];
         arr[minIndex] = arr[i];
         arr[i] = temp;
         if(minIndex != i) {
            counter ++;
         }
      }
      
      for(int i = 0; i < n; i ++) {
         System.out.print(arr[i]);
         if(i != n-1) {
            System.out.print(" ");
         }
      }
      
      System.out.println("\n" + counter);
      
   } main {
      Scanner sc = new Scanner(System.in);
      int n = Integer.parseInt(sc.nextLine());
      int[] arr = new int[n];
      int counter = 0;
      int minIndex;
      
      String[] input = sc.nextLine().split(" ");
      for(int i = 0; i < n; i ++) {
         arr[i] = Integer.parseInt(input[i]);
      }
      
      for(int i = 0; i < n; i ++) {
         minIndex = i;
         for(int j = i; j < n; j ++) {
            if(arr[j] < arr[minIndex]) {
               minIndex = j;
            }
         }
         int temp = arr[minIndex];
         arr[minIndex] = arr[i];
         arr[i] = temp;
         if(minIndex != i) {
            counter ++;
         }
      }
      
      for(int i = 0; i < n; i ++) {
         System.out.print(arr[i]);
         if(i != n-1) {
            System.out.print(" ");
         }
      }
      
      System.out.println("\n" + counter);
      
   } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = Integer.parseInt(sc.nextLine()); n Integer.parseInt(sc.nextLine()) Integer.parseInt Integer sc.nextLine() sc.nextLine sc int[] arr = new int[n]; arr new int[n] n int counter = 0; counter 0 int minIndex; minIndex String[] input = sc.nextLine().split(" "); input sc.nextLine().split(" ") sc.nextLine().split sc.nextLine() sc.nextLine sc " " for(int i = 0; i < n; i ++) {
         arr[i] = Integer.parseInt(input[i]);
      } int i = 0; int i = 0; i 0 i < n i n i ++ i ++ i {
         arr[i] = Integer.parseInt(input[i]);
      } {
         arr[i] = Integer.parseInt(input[i]);
      } arr[i] = Integer.parseInt(input[i]) arr[i] arr i Integer.parseInt(input[i]) Integer.parseInt Integer input[i] input i for(int i = 0; i < n; i ++) {
         minIndex = i;
         for(int j = i; j < n; j ++) {
            if(arr[j] < arr[minIndex]) {
               minIndex = j;
            }
         }
         int temp = arr[minIndex];
         arr[minIndex] = arr[i];
         arr[i] = temp;
         if(minIndex != i) {
            counter ++;
         }
      } int i = 0; int i = 0; i 0 i < n i n i ++ i ++ i {
         minIndex = i;
         for(int j = i; j < n; j ++) {
            if(arr[j] < arr[minIndex]) {
               minIndex = j;
            }
         }
         int temp = arr[minIndex];
         arr[minIndex] = arr[i];
         arr[i] = temp;
         if(minIndex != i) {
            counter ++;
         }
      } {
         minIndex = i;
         for(int j = i; j < n; j ++) {
            if(arr[j] < arr[minIndex]) {
               minIndex = j;
            }
         }
         int temp = arr[minIndex];
         arr[minIndex] = arr[i];
         arr[i] = temp;
         if(minIndex != i) {
            counter ++;
         }
      } minIndex = i minIndex i for(int j = i; j < n; j ++) {
            if(arr[j] < arr[minIndex]) {
               minIndex = j;
            }
         } int j = i; int j = i; j i j < n j n j ++ j ++ j {
            if(arr[j] < arr[minIndex]) {
               minIndex = j;
            }
         } {
            if(arr[j] < arr[minIndex]) {
               minIndex = j;
            }
         } if(arr[j] < arr[minIndex]) {
               minIndex = j;
            } arr[j] < arr[minIndex] arr[j] arr j arr[minIndex] arr minIndex {
               minIndex = j;
            } minIndex = j minIndex j int temp = arr[minIndex]; temp arr[minIndex] arr minIndex arr[minIndex] = arr[i] arr[minIndex] arr minIndex arr[i] arr i arr[i] = temp arr[i] arr i temp if(minIndex != i) {
            counter ++;
         } minIndex != i minIndex i {
            counter ++;
         } counter ++ counter for(int i = 0; i < n; i ++) {
         System.out.print(arr[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(arr[i]);
         if(i != n-1) {
            System.out.print(" ");
         }
      } {
         System.out.print(arr[i]);
         if(i != n-1) {
            System.out.print(" ");
         }
      } System.out.print(arr[i]) System.out.print System.out System System.out arr[i] arr 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("\n" + counter) System.out.println System.out System System.out "\n" + counter "\n" counter String [] args args public class Main {
   public static void main(String [] args) {
      Scanner sc = new Scanner(System.in);
      int n = Integer.parseInt(sc.nextLine());
      int[] arr = new int[n];
      int counter = 0;
      int minIndex;
      
      String[] input = sc.nextLine().split(" ");
      for(int i = 0; i < n; i ++) {
         arr[i] = Integer.parseInt(input[i]);
      }
      
      for(int i = 0; i < n; i ++) {
         minIndex = i;
         for(int j = i; j < n; j ++) {
            if(arr[j] < arr[minIndex]) {
               minIndex = j;
            }
         }
         int temp = arr[minIndex];
         arr[minIndex] = arr[i];
         arr[i] = temp;
         if(minIndex != i) {
            counter ++;
         }
      }
      
      for(int i = 0; i < n; i ++) {
         System.out.print(arr[i]);
         if(i != n-1) {
            System.out.print(" ");
         }
      }
      
      System.out.println("\n" + counter);
      
   }
} public class Main {
   public static void main(String [] args) {
      Scanner sc = new Scanner(System.in);
      int n = Integer.parseInt(sc.nextLine());
      int[] arr = new int[n];
      int counter = 0;
      int minIndex;
      
      String[] input = sc.nextLine().split(" ");
      for(int i = 0; i < n; i ++) {
         arr[i] = Integer.parseInt(input[i]);
      }
      
      for(int i = 0; i < n; i ++) {
         minIndex = i;
         for(int j = i; j < n; j ++) {
            if(arr[j] < arr[minIndex]) {
               minIndex = j;
            }
         }
         int temp = arr[minIndex];
         arr[minIndex] = arr[i];
         arr[i] = temp;
         if(minIndex != i) {
            counter ++;
         }
      }
      
      for(int i = 0; i < n; i ++) {
         System.out.print(arr[i]);
         if(i != n-1) {
            System.out.print(" ");
         }
      }
      
      System.out.println("\n" + counter);
      
   }
} Main
import java.util.*;

public class Main {
   public static void main(String [] args) {
      Scanner sc = new Scanner(System.in);
      int n = Integer.parseInt(sc.nextLine());
      int[] arr = new int[n];
      int counter = 0;
      int minIndex;
      
      String[] input = sc.nextLine().split(" ");
      for(int i = 0; i < n; i ++) {
         arr[i] = Integer.parseInt(input[i]);
      }
      
      for(int i = 0; i < n; i ++) {
         minIndex = i;
         for(int j = i; j < n; j ++) {
            if(arr[j] < arr[minIndex]) {
               minIndex = j;
            }
         }
         int temp = arr[minIndex];
         arr[minIndex] = arr[i];
         arr[i] = temp;
         if(minIndex != i) {
            counter ++;
         }
      }
      
      for(int i = 0; i < n; i ++) {
         System.out.print(arr[i]);
         if(i != n-1) {
            System.out.print(" ");
         }
      }
      
      System.out.println("\n" + counter);
      
   }
}

