/* ALDS1_2_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];
      SelectionSort ss = new SelectionSort();

      for(int i = 0; i < n; i++){
        array[i] = Integer.parseInt(str[i]);
      }

      ss.selectionSort(array);
      ss.showArray(array);
      System.out.println(ss.getSwap());

    }catch(Exception e){
      System.out.println(e);
    }
  }
}

class SelectionSort
{
  private int swap;

  public void selectionSort(int[] A)
  {
    swap = 0;

    for(int i = 0; i < A.length; i++){
      int mini = i;
      for(int j = i; j < A.length; j++){
        if(A[j] < A[mini]) mini = j;
      }
      if(i != mini){
        int tmp = A[i];
        A[i] =  A[mini];
        A[mini] = tmp;
        swap++;
      }
    }
  }

  public void showArray(int[] A)
  {
    StringBuilder sb = new StringBuilder();

    for(int i = 0; i < A.length; i++){
      sb.append(A[i]).append(" ");
    }
    sb.deleteCharAt(sb.length() - 1);
    System.out.println(sb);
  }

  public int getSwap() { return swap; }
} 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];
      SelectionSort ss = new SelectionSort();

      for(int i = 0; i < n; i++){
        array[i] = Integer.parseInt(str[i]);
      }

      ss.selectionSort(array);
      ss.showArray(array);
      System.out.println(ss.getSwap());

    }catch(Exception e){
      System.out.println(e);
    }
  }
} 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];
      SelectionSort ss = new SelectionSort();

      for(int i = 0; i < n; i++){
        array[i] = Integer.parseInt(str[i]);
      }

      ss.selectionSort(array);
      ss.showArray(array);
      System.out.println(ss.getSwap());

    }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];
      SelectionSort ss = new SelectionSort();

      for(int i = 0; i < n; i++){
        array[i] = Integer.parseInt(str[i]);
      }

      ss.selectionSort(array);
      ss.showArray(array);
      System.out.println(ss.getSwap());

    }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];
      SelectionSort ss = new SelectionSort();

      for(int i = 0; i < n; i++){
        array[i] = Integer.parseInt(str[i]);
      }

      ss.selectionSort(array);
      ss.showArray(array);
      System.out.println(ss.getSwap());

    }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];
      SelectionSort ss = new SelectionSort();

      for(int i = 0; i < n; i++){
        array[i] = Integer.parseInt(str[i]);
      }

      ss.selectionSort(array);
      ss.showArray(array);
      System.out.println(ss.getSwap());

    } 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 SelectionSort ss = new SelectionSort(); ss new SelectionSort() 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 ss.selectionSort(array) ss.selectionSort ss array ss.showArray(array) ss.showArray ss array System.out.println(ss.getSwap()) System.out.println System.out System System.out ss.getSwap() ss.getSwap ss String[] args args class SelectionSort
{
  private int swap;

  public void selectionSort(int[] A)
  {
    swap = 0;

    for(int i = 0; i < A.length; i++){
      int mini = i;
      for(int j = i; j < A.length; j++){
        if(A[j] < A[mini]) mini = j;
      }
      if(i != mini){
        int tmp = A[i];
        A[i] =  A[mini];
        A[mini] = tmp;
        swap++;
      }
    }
  }

  public void showArray(int[] A)
  {
    StringBuilder sb = new StringBuilder();

    for(int i = 0; i < A.length; i++){
      sb.append(A[i]).append(" ");
    }
    sb.deleteCharAt(sb.length() - 1);
    System.out.println(sb);
  }

  public int getSwap() { return swap; }
} SelectionSort private int swap; swap public void selectionSort(int[] A)
  {
    swap = 0;

    for(int i = 0; i < A.length; i++){
      int mini = i;
      for(int j = i; j < A.length; j++){
        if(A[j] < A[mini]) mini = j;
      }
      if(i != mini){
        int tmp = A[i];
        A[i] =  A[mini];
        A[mini] = tmp;
        swap++;
      }
    }
  } selectionSort {
    swap = 0;

    for(int i = 0; i < A.length; i++){
      int mini = i;
      for(int j = i; j < A.length; j++){
        if(A[j] < A[mini]) mini = j;
      }
      if(i != mini){
        int tmp = A[i];
        A[i] =  A[mini];
        A[mini] = tmp;
        swap++;
      }
    }
  } swap = 0 swap 0 for(int i = 0; i < A.length; i++){
      int mini = i;
      for(int j = i; j < A.length; j++){
        if(A[j] < A[mini]) mini = j;
      }
      if(i != mini){
        int tmp = A[i];
        A[i] =  A[mini];
        A[mini] = tmp;
        swap++;
      }
    } int i = 0; int i = 0; i 0 i < A.length i A.length A A.length i++ i++ i {
      int mini = i;
      for(int j = i; j < A.length; j++){
        if(A[j] < A[mini]) mini = j;
      }
      if(i != mini){
        int tmp = A[i];
        A[i] =  A[mini];
        A[mini] = tmp;
        swap++;
      }
    } {
      int mini = i;
      for(int j = i; j < A.length; j++){
        if(A[j] < A[mini]) mini = j;
      }
      if(i != mini){
        int tmp = A[i];
        A[i] =  A[mini];
        A[mini] = tmp;
        swap++;
      }
    } int mini = i; mini i for(int j = i; j < A.length; j++){
        if(A[j] < A[mini]) mini = j;
      } int j = i; int j = i; j i 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 if(i != mini){
        int tmp = A[i];
        A[i] =  A[mini];
        A[mini] = tmp;
        swap++;
      } i != mini i mini {
        int tmp = A[i];
        A[i] =  A[mini];
        A[mini] = tmp;
        swap++;
      } 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 swap++ swap int[] A A public void showArray(int[] A)
  {
    StringBuilder sb = new StringBuilder();

    for(int i = 0; i < A.length; i++){
      sb.append(A[i]).append(" ");
    }
    sb.deleteCharAt(sb.length() - 1);
    System.out.println(sb);
  } showArray {
    StringBuilder sb = new StringBuilder();

    for(int i = 0; i < A.length; i++){
      sb.append(A[i]).append(" ");
    }
    sb.deleteCharAt(sb.length() - 1);
    System.out.println(sb);
  } StringBuilder sb = new StringBuilder(); sb new StringBuilder() for(int i = 0; i < A.length; i++){
      sb.append(A[i]).append(" ");
    } int i = 0; int i = 0; i 0 i < A.length i A.length A A.length i++ i++ i {
      sb.append(A[i]).append(" ");
    } {
      sb.append(A[i]).append(" ");
    } sb.append(A[i]).append(" ") sb.append(A[i]).append sb.append(A[i]) sb.append sb A[i] A i " " sb.deleteCharAt(sb.length() - 1) sb.deleteCharAt sb sb.length() - 1 sb.length() sb.length sb 1 System.out.println(sb) System.out.println System.out System System.out sb int[] A A public int getSwap() { return swap; } getSwap { return swap; } return swap; swap
/* ALDS1_2_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];
      SelectionSort ss = new SelectionSort();

      for(int i = 0; i < n; i++){
        array[i] = Integer.parseInt(str[i]);
      }

      ss.selectionSort(array);
      ss.showArray(array);
      System.out.println(ss.getSwap());

    }catch(Exception e){
      System.out.println(e);
    }
  }
}

class SelectionSort
{
  private int swap;

  public void selectionSort(int[] A)
  {
    swap = 0;

    for(int i = 0; i < A.length; i++){
      int mini = i;
      for(int j = i; j < A.length; j++){
        if(A[j] < A[mini]) mini = j;
      }
      if(i != mini){
        int tmp = A[i];
        A[i] =  A[mini];
        A[mini] = tmp;
        swap++;
      }
    }
  }

  public void showArray(int[] A)
  {
    StringBuilder sb = new StringBuilder();

    for(int i = 0; i < A.length; i++){
      sb.append(A[i]).append(" ");
    }
    sb.deleteCharAt(sb.length() - 1);
    System.out.println(sb);
  }

  public int getSwap() { return swap; }
}