import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    List<Integer> arr = new ArrayList<>();
    int count = 0;
    for(int i = 0; i < n; i++) {
      arr.add(sc.nextInt());
    }
    for(int i = 0; i < n - 1; i++) {
      int min = i;
      for(int j = i + 1; j < n; j++) {
        if(arr.get(min) > arr.get(j)) {
          min = j;
        }
      }
      if(min != i) {
        count++;
        int v = arr.get(i);
        arr.set(i, arr.get(min));
        arr.set(min, v);
      }
      System.out.print(arr.get(i) + " ");
    }
    System.out.println(arr.get(n - 1));
    System.out.println(count);
  }
}
 import java.util.*; util.* java public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    List<Integer> arr = new ArrayList<>();
    int count = 0;
    for(int i = 0; i < n; i++) {
      arr.add(sc.nextInt());
    }
    for(int i = 0; i < n - 1; i++) {
      int min = i;
      for(int j = i + 1; j < n; j++) {
        if(arr.get(min) > arr.get(j)) {
          min = j;
        }
      }
      if(min != i) {
        count++;
        int v = arr.get(i);
        arr.set(i, arr.get(min));
        arr.set(min, v);
      }
      System.out.print(arr.get(i) + " ");
    }
    System.out.println(arr.get(n - 1));
    System.out.println(count);
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    List<Integer> arr = new ArrayList<>();
    int count = 0;
    for(int i = 0; i < n; i++) {
      arr.add(sc.nextInt());
    }
    for(int i = 0; i < n - 1; i++) {
      int min = i;
      for(int j = i + 1; j < n; j++) {
        if(arr.get(min) > arr.get(j)) {
          min = j;
        }
      }
      if(min != i) {
        count++;
        int v = arr.get(i);
        arr.set(i, arr.get(min));
        arr.set(min, v);
      }
      System.out.print(arr.get(i) + " ");
    }
    System.out.println(arr.get(n - 1));
    System.out.println(count);
  } main {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    List<Integer> arr = new ArrayList<>();
    int count = 0;
    for(int i = 0; i < n; i++) {
      arr.add(sc.nextInt());
    }
    for(int i = 0; i < n - 1; i++) {
      int min = i;
      for(int j = i + 1; j < n; j++) {
        if(arr.get(min) > arr.get(j)) {
          min = j;
        }
      }
      if(min != i) {
        count++;
        int v = arr.get(i);
        arr.set(i, arr.get(min));
        arr.set(min, v);
      }
      System.out.print(arr.get(i) + " ");
    }
    System.out.println(arr.get(n - 1));
    System.out.println(count);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc List<Integer> arr = new ArrayList<>(); arr new ArrayList<>() int count = 0; count 0 for(int i = 0; i < n; i++) {
      arr.add(sc.nextInt());
    } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
      arr.add(sc.nextInt());
    } {
      arr.add(sc.nextInt());
    } arr.add(sc.nextInt()) arr.add arr sc.nextInt() sc.nextInt sc for(int i = 0; i < n - 1; i++) {
      int min = i;
      for(int j = i + 1; j < n; j++) {
        if(arr.get(min) > arr.get(j)) {
          min = j;
        }
      }
      if(min != i) {
        count++;
        int v = arr.get(i);
        arr.set(i, arr.get(min));
        arr.set(min, v);
      }
      System.out.print(arr.get(i) + " ");
    } int i = 0; int i = 0; i 0 i < n - 1 i n - 1 n 1 i++ i++ i {
      int min = i;
      for(int j = i + 1; j < n; j++) {
        if(arr.get(min) > arr.get(j)) {
          min = j;
        }
      }
      if(min != i) {
        count++;
        int v = arr.get(i);
        arr.set(i, arr.get(min));
        arr.set(min, v);
      }
      System.out.print(arr.get(i) + " ");
    } {
      int min = i;
      for(int j = i + 1; j < n; j++) {
        if(arr.get(min) > arr.get(j)) {
          min = j;
        }
      }
      if(min != i) {
        count++;
        int v = arr.get(i);
        arr.set(i, arr.get(min));
        arr.set(min, v);
      }
      System.out.print(arr.get(i) + " ");
    } int min = i; min i for(int j = i + 1; j < n; j++) {
        if(arr.get(min) > arr.get(j)) {
          min = j;
        }
      } int j = i + 1; int j = i + 1; j i + 1 i 1 j < n j n j++ j++ j {
        if(arr.get(min) > arr.get(j)) {
          min = j;
        }
      } {
        if(arr.get(min) > arr.get(j)) {
          min = j;
        }
      } if(arr.get(min) > arr.get(j)) {
          min = j;
        } arr.get(min) > arr.get(j) arr.get(min) arr.get arr min arr.get(j) arr.get arr j {
          min = j;
        } min = j min j if(min != i) {
        count++;
        int v = arr.get(i);
        arr.set(i, arr.get(min));
        arr.set(min, v);
      } min != i min i {
        count++;
        int v = arr.get(i);
        arr.set(i, arr.get(min));
        arr.set(min, v);
      } count++ count int v = arr.get(i); v arr.get(i) arr.get arr i arr.set(i, arr.get(min)) arr.set arr i arr.get(min) arr.get arr min arr.set(min, v) arr.set arr min v System.out.print(arr.get(i) + " ") System.out.print System.out System System.out arr.get(i) + " " arr.get(i) arr.get arr i " " System.out.println(arr.get(n - 1)) System.out.println System.out System System.out arr.get(n - 1) arr.get arr n - 1 n 1 System.out.println(count) System.out.println System.out System System.out count String[] args args public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    List<Integer> arr = new ArrayList<>();
    int count = 0;
    for(int i = 0; i < n; i++) {
      arr.add(sc.nextInt());
    }
    for(int i = 0; i < n - 1; i++) {
      int min = i;
      for(int j = i + 1; j < n; j++) {
        if(arr.get(min) > arr.get(j)) {
          min = j;
        }
      }
      if(min != i) {
        count++;
        int v = arr.get(i);
        arr.set(i, arr.get(min));
        arr.set(min, v);
      }
      System.out.print(arr.get(i) + " ");
    }
    System.out.println(arr.get(n - 1));
    System.out.println(count);
  }
} public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    List<Integer> arr = new ArrayList<>();
    int count = 0;
    for(int i = 0; i < n; i++) {
      arr.add(sc.nextInt());
    }
    for(int i = 0; i < n - 1; i++) {
      int min = i;
      for(int j = i + 1; j < n; j++) {
        if(arr.get(min) > arr.get(j)) {
          min = j;
        }
      }
      if(min != i) {
        count++;
        int v = arr.get(i);
        arr.set(i, arr.get(min));
        arr.set(min, v);
      }
      System.out.print(arr.get(i) + " ");
    }
    System.out.println(arr.get(n - 1));
    System.out.println(count);
  }
} Main
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    List<Integer> arr = new ArrayList<>();
    int count = 0;
    for(int i = 0; i < n; i++) {
      arr.add(sc.nextInt());
    }
    for(int i = 0; i < n - 1; i++) {
      int min = i;
      for(int j = i + 1; j < n; j++) {
        if(arr.get(min) > arr.get(j)) {
          min = j;
        }
      }
      if(min != i) {
        count++;
        int v = arr.get(i);
        arr.set(i, arr.get(min));
        arr.set(min, v);
      }
      System.out.print(arr.get(i) + " ");
    }
    System.out.println(arr.get(n - 1));
    System.out.println(count);
  }
}

