// ALDS1_2_B Selection Sort
import java.io.*;

class Main {
   public static void main(String[] args) {
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

      try {  
         int N = Integer.parseInt(br.readLine());
         String[] inputAry = br.readLine().split(" ");
         int[] A = new int[N];
         for (int i = 0; i < N; i++) {
            A[i] = Integer.parseInt(inputAry[i]);
         }
         selectionSort(A, N);
      }
      catch (Exception e) {
         e.printStackTrace();
      }
   }
   static void selectionSort(int[] A, int N) {
      int tmp, minj, cnt = 0;
      for (int i = 0; i < N; i++) {
         minj = i;
         for (int j = i; j < N; j++) {
            if (A[j] < A[minj]){
               minj = j;
            }
         }
         if (i != minj) {
            tmp = A[i];
            A[i] = A[minj];
            A[minj] = tmp;
            cnt++;
         }
      }
      for (int i = 0; i < N; i++) {
         if (i == N - 1) {
            System.out.println(A[i]);
         } else {
            System.out.print(A[i] + " ");
         }
      }
      System.out.println(cnt);
   }
} import java.io.*; io.* java class Main {
   public static void main(String[] args) {
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

      try {  
         int N = Integer.parseInt(br.readLine());
         String[] inputAry = br.readLine().split(" ");
         int[] A = new int[N];
         for (int i = 0; i < N; i++) {
            A[i] = Integer.parseInt(inputAry[i]);
         }
         selectionSort(A, N);
      }
      catch (Exception e) {
         e.printStackTrace();
      }
   }
   static void selectionSort(int[] A, int N) {
      int tmp, minj, cnt = 0;
      for (int i = 0; i < N; i++) {
         minj = i;
         for (int j = i; j < N; j++) {
            if (A[j] < A[minj]){
               minj = j;
            }
         }
         if (i != minj) {
            tmp = A[i];
            A[i] = A[minj];
            A[minj] = tmp;
            cnt++;
         }
      }
      for (int i = 0; i < N; i++) {
         if (i == N - 1) {
            System.out.println(A[i]);
         } else {
            System.out.print(A[i] + " ");
         }
      }
      System.out.println(cnt);
   }
} Main public static void main(String[] args) {
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

      try {  
         int N = Integer.parseInt(br.readLine());
         String[] inputAry = br.readLine().split(" ");
         int[] A = new int[N];
         for (int i = 0; i < N; i++) {
            A[i] = Integer.parseInt(inputAry[i]);
         }
         selectionSort(A, N);
      }
      catch (Exception e) {
         e.printStackTrace();
      }
   } main {
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

      try {  
         int N = Integer.parseInt(br.readLine());
         String[] inputAry = br.readLine().split(" ");
         int[] A = new int[N];
         for (int i = 0; i < N; i++) {
            A[i] = Integer.parseInt(inputAry[i]);
         }
         selectionSort(A, N);
      }
      catch (Exception e) {
         e.printStackTrace();
      }
   } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) try {  
         int N = Integer.parseInt(br.readLine());
         String[] inputAry = br.readLine().split(" ");
         int[] A = new int[N];
         for (int i = 0; i < N; i++) {
            A[i] = Integer.parseInt(inputAry[i]);
         }
         selectionSort(A, N);
      }
      catch (Exception e) {
         e.printStackTrace();
      } catch (Exception e) {
         e.printStackTrace();
      } Exception e {
         e.printStackTrace();
      } e.printStackTrace() e.printStackTrace e {  
         int N = Integer.parseInt(br.readLine());
         String[] inputAry = br.readLine().split(" ");
         int[] A = new int[N];
         for (int i = 0; i < N; i++) {
            A[i] = Integer.parseInt(inputAry[i]);
         }
         selectionSort(A, N);
      } int N = Integer.parseInt(br.readLine()); N Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br String[] inputAry = br.readLine().split(" "); inputAry br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int[] A = new int[N]; A new int[N] N for (int i = 0; i < N; i++) {
            A[i] = Integer.parseInt(inputAry[i]);
         } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            A[i] = Integer.parseInt(inputAry[i]);
         } {
            A[i] = Integer.parseInt(inputAry[i]);
         } A[i] = Integer.parseInt(inputAry[i]) A[i] A i Integer.parseInt(inputAry[i]) Integer.parseInt Integer inputAry[i] inputAry i selectionSort(A, N) selectionSort A N String[] args args static void selectionSort(int[] A, int N) {
      int tmp, minj, cnt = 0;
      for (int i = 0; i < N; i++) {
         minj = i;
         for (int j = i; j < N; j++) {
            if (A[j] < A[minj]){
               minj = j;
            }
         }
         if (i != minj) {
            tmp = A[i];
            A[i] = A[minj];
            A[minj] = tmp;
            cnt++;
         }
      }
      for (int i = 0; i < N; i++) {
         if (i == N - 1) {
            System.out.println(A[i]);
         } else {
            System.out.print(A[i] + " ");
         }
      }
      System.out.println(cnt);
   } selectionSort {
      int tmp, minj, cnt = 0;
      for (int i = 0; i < N; i++) {
         minj = i;
         for (int j = i; j < N; j++) {
            if (A[j] < A[minj]){
               minj = j;
            }
         }
         if (i != minj) {
            tmp = A[i];
            A[i] = A[minj];
            A[minj] = tmp;
            cnt++;
         }
      }
      for (int i = 0; i < N; i++) {
         if (i == N - 1) {
            System.out.println(A[i]);
         } else {
            System.out.print(A[i] + " ");
         }
      }
      System.out.println(cnt);
   } int tmp tmp minj minj cnt = 0; cnt 0 for (int i = 0; i < N; i++) {
         minj = i;
         for (int j = i; j < N; j++) {
            if (A[j] < A[minj]){
               minj = j;
            }
         }
         if (i != minj) {
            tmp = A[i];
            A[i] = A[minj];
            A[minj] = tmp;
            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 (A[j] < A[minj]){
               minj = j;
            }
         }
         if (i != minj) {
            tmp = A[i];
            A[i] = A[minj];
            A[minj] = tmp;
            cnt++;
         }
      } {
         minj = i;
         for (int j = i; j < N; j++) {
            if (A[j] < A[minj]){
               minj = j;
            }
         }
         if (i != minj) {
            tmp = A[i];
            A[i] = A[minj];
            A[minj] = tmp;
            cnt++;
         }
      } minj = i minj i for (int j = i; j < N; j++) {
            if (A[j] < A[minj]){
               minj = j;
            }
         } int j = i; int j = i; j i j < N j N j++ j++ j {
            if (A[j] < A[minj]){
               minj = j;
            }
         } {
            if (A[j] < A[minj]){
               minj = j;
            }
         } if (A[j] < A[minj]){
               minj = j;
            } A[j] < A[minj] A[j] A j A[minj] A minj {
               minj = j;
            } minj = j minj j if (i != minj) {
            tmp = A[i];
            A[i] = A[minj];
            A[minj] = tmp;
            cnt++;
         } i != minj i minj {
            tmp = A[i];
            A[i] = A[minj];
            A[minj] = tmp;
            cnt++;
         } tmp = A[i] tmp A[i] A i A[i] = A[minj] A[i] A i A[minj] A minj A[minj] = tmp A[minj] A minj tmp cnt++ cnt for (int i = 0; i < N; i++) {
         if (i == N - 1) {
            System.out.println(A[i]);
         } else {
            System.out.print(A[i] + " ");
         }
      } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
         if (i == N - 1) {
            System.out.println(A[i]);
         } else {
            System.out.print(A[i] + " ");
         }
      } {
         if (i == N - 1) {
            System.out.println(A[i]);
         } else {
            System.out.print(A[i] + " ");
         }
      } if (i == N - 1) {
            System.out.println(A[i]);
         } else {
            System.out.print(A[i] + " ");
         } i == N - 1 i N - 1 N 1 {
            System.out.println(A[i]);
         } System.out.println(A[i]) System.out.println System.out System System.out A[i] A i {
            System.out.print(A[i] + " ");
         } System.out.print(A[i] + " ") System.out.print System.out System System.out A[i] + " " A[i] A i " " System.out.println(cnt) System.out.println System.out System System.out cnt int[] A A int N N
// ALDS1_2_B Selection Sort
import java.io.*;

class Main {
   public static void main(String[] args) {
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

      try {  
         int N = Integer.parseInt(br.readLine());
         String[] inputAry = br.readLine().split(" ");
         int[] A = new int[N];
         for (int i = 0; i < N; i++) {
            A[i] = Integer.parseInt(inputAry[i]);
         }
         selectionSort(A, N);
      }
      catch (Exception e) {
         e.printStackTrace();
      }
   }
   static void selectionSort(int[] A, int N) {
      int tmp, minj, cnt = 0;
      for (int i = 0; i < N; i++) {
         minj = i;
         for (int j = i; j < N; j++) {
            if (A[j] < A[minj]){
               minj = j;
            }
         }
         if (i != minj) {
            tmp = A[i];
            A[i] = A[minj];
            A[minj] = tmp;
            cnt++;
         }
      }
      for (int i = 0; i < N; i++) {
         if (i == N - 1) {
            System.out.println(A[i]);
         } else {
            System.out.print(A[i] + " ");
         }
      }
      System.out.println(cnt);
   }
}