import java.util.Scanner;

public class Main {
  static int selectionSort(int[] a, int n) {
    int sw = 0;
    for (int i = 0; i < n; i++) {
      int minj = i;
      for (int j = i; j < n; j++) 
        if (a[j] < a[minj]) 
          minj = j;
      int t = a[i];
      a[i] = a[minj];
      a[minj] = t;
      if (minj != i) sw++;
    }
    return sw;
  }

  public static void main(String[] args) {
    Scanner stdIn = new Scanner(System.in);
    int n = stdIn.nextInt();
    int[] a = new int[n];
    for (int i = 0; i < n; i++) a[i] = stdIn.nextInt();
    int sw = selectionSort(a, n);
    for (int i = 0; i < n; i++) {
      System.out.print(a[i]);
      if (i != n - 1) System.out.print(' ');
      else System.out.println();
    }
    System.out.println(sw);
  }
} import java.util.Scanner; Scanner java.util public class Main {
  static int selectionSort(int[] a, int n) {
    int sw = 0;
    for (int i = 0; i < n; i++) {
      int minj = i;
      for (int j = i; j < n; j++) 
        if (a[j] < a[minj]) 
          minj = j;
      int t = a[i];
      a[i] = a[minj];
      a[minj] = t;
      if (minj != i) sw++;
    }
    return sw;
  }

  public static void main(String[] args) {
    Scanner stdIn = new Scanner(System.in);
    int n = stdIn.nextInt();
    int[] a = new int[n];
    for (int i = 0; i < n; i++) a[i] = stdIn.nextInt();
    int sw = selectionSort(a, n);
    for (int i = 0; i < n; i++) {
      System.out.print(a[i]);
      if (i != n - 1) System.out.print(' ');
      else System.out.println();
    }
    System.out.println(sw);
  }
} Main static int selectionSort(int[] a, int n) {
    int sw = 0;
    for (int i = 0; i < n; i++) {
      int minj = i;
      for (int j = i; j < n; j++) 
        if (a[j] < a[minj]) 
          minj = j;
      int t = a[i];
      a[i] = a[minj];
      a[minj] = t;
      if (minj != i) sw++;
    }
    return sw;
  } selectionSort {
    int sw = 0;
    for (int i = 0; i < n; i++) {
      int minj = i;
      for (int j = i; j < n; j++) 
        if (a[j] < a[minj]) 
          minj = j;
      int t = a[i];
      a[i] = a[minj];
      a[minj] = t;
      if (minj != i) sw++;
    }
    return sw;
  } int sw = 0; sw 0 for (int i = 0; i < n; i++) {
      int minj = i;
      for (int j = i; j < n; j++) 
        if (a[j] < a[minj]) 
          minj = j;
      int t = a[i];
      a[i] = a[minj];
      a[minj] = t;
      if (minj != i) sw++;
    } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
      int minj = i;
      for (int j = i; j < n; j++) 
        if (a[j] < a[minj]) 
          minj = j;
      int t = a[i];
      a[i] = a[minj];
      a[minj] = t;
      if (minj != i) sw++;
    } {
      int minj = i;
      for (int j = i; j < n; j++) 
        if (a[j] < a[minj]) 
          minj = j;
      int t = a[i];
      a[i] = a[minj];
      a[minj] = t;
      if (minj != i) sw++;
    } int 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; a[j] < a[minj] a[j] a j a[minj] a minj minj = j minj j int t = a[i]; t a[i] a i a[i] = a[minj] a[i] a i a[minj] a minj a[minj] = t a[minj] a minj t if (minj != i) sw++; minj != i minj i sw++ sw return sw; sw int[] a a int n n public static void main(String[] args) {
    Scanner stdIn = new Scanner(System.in);
    int n = stdIn.nextInt();
    int[] a = new int[n];
    for (int i = 0; i < n; i++) a[i] = stdIn.nextInt();
    int sw = selectionSort(a, n);
    for (int i = 0; i < n; i++) {
      System.out.print(a[i]);
      if (i != n - 1) System.out.print(' ');
      else System.out.println();
    }
    System.out.println(sw);
  } main {
    Scanner stdIn = new Scanner(System.in);
    int n = stdIn.nextInt();
    int[] a = new int[n];
    for (int i = 0; i < n; i++) a[i] = stdIn.nextInt();
    int sw = selectionSort(a, n);
    for (int i = 0; i < n; i++) {
      System.out.print(a[i]);
      if (i != n - 1) System.out.print(' ');
      else System.out.println();
    }
    System.out.println(sw);
  } Scanner stdIn = new Scanner(System.in); stdIn new Scanner(System.in) int n = stdIn.nextInt(); n stdIn.nextInt() stdIn.nextInt stdIn int[] a = new int[n]; a new int[n] n for (int i = 0; i < n; i++) a[i] = stdIn.nextInt(); int i = 0; int i = 0; i 0 i < n i n i++ i++ i a[i] = stdIn.nextInt(); a[i] = stdIn.nextInt() a[i] a i stdIn.nextInt() stdIn.nextInt stdIn int sw = selectionSort(a, n); sw selectionSort(a, n) selectionSort a n for (int i = 0; i < n; i++) {
      System.out.print(a[i]);
      if (i != n - 1) System.out.print(' ');
      else System.out.println();
    } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
      System.out.print(a[i]);
      if (i != n - 1) System.out.print(' ');
      else System.out.println();
    } {
      System.out.print(a[i]);
      if (i != n - 1) System.out.print(' ');
      else System.out.println();
    } System.out.print(a[i]) System.out.print System.out System System.out a[i] a i if (i != n - 1) System.out.print(' ');
      else System.out.println(); i != n - 1 i n - 1 n 1 System.out.print(' ') System.out.print System.out System System.out ' ' System.out.println() System.out.println System.out System System.out System.out.println(sw) System.out.println System.out System System.out sw String[] args args public class Main {
  static int selectionSort(int[] a, int n) {
    int sw = 0;
    for (int i = 0; i < n; i++) {
      int minj = i;
      for (int j = i; j < n; j++) 
        if (a[j] < a[minj]) 
          minj = j;
      int t = a[i];
      a[i] = a[minj];
      a[minj] = t;
      if (minj != i) sw++;
    }
    return sw;
  }

  public static void main(String[] args) {
    Scanner stdIn = new Scanner(System.in);
    int n = stdIn.nextInt();
    int[] a = new int[n];
    for (int i = 0; i < n; i++) a[i] = stdIn.nextInt();
    int sw = selectionSort(a, n);
    for (int i = 0; i < n; i++) {
      System.out.print(a[i]);
      if (i != n - 1) System.out.print(' ');
      else System.out.println();
    }
    System.out.println(sw);
  }
} public class Main {
  static int selectionSort(int[] a, int n) {
    int sw = 0;
    for (int i = 0; i < n; i++) {
      int minj = i;
      for (int j = i; j < n; j++) 
        if (a[j] < a[minj]) 
          minj = j;
      int t = a[i];
      a[i] = a[minj];
      a[minj] = t;
      if (minj != i) sw++;
    }
    return sw;
  }

  public static void main(String[] args) {
    Scanner stdIn = new Scanner(System.in);
    int n = stdIn.nextInt();
    int[] a = new int[n];
    for (int i = 0; i < n; i++) a[i] = stdIn.nextInt();
    int sw = selectionSort(a, n);
    for (int i = 0; i < n; i++) {
      System.out.print(a[i]);
      if (i != n - 1) System.out.print(' ');
      else System.out.println();
    }
    System.out.println(sw);
  }
} Main
import java.util.Scanner;

public class Main {
  static int selectionSort(int[] a, int n) {
    int sw = 0;
    for (int i = 0; i < n; i++) {
      int minj = i;
      for (int j = i; j < n; j++) 
        if (a[j] < a[minj]) 
          minj = j;
      int t = a[i];
      a[i] = a[minj];
      a[minj] = t;
      if (minj != i) sw++;
    }
    return sw;
  }

  public static void main(String[] args) {
    Scanner stdIn = new Scanner(System.in);
    int n = stdIn.nextInt();
    int[] a = new int[n];
    for (int i = 0; i < n; i++) a[i] = stdIn.nextInt();
    int sw = selectionSort(a, n);
    for (int i = 0; i < n; i++) {
      System.out.print(a[i]);
      if (i != n - 1) System.out.print(' ');
      else System.out.println();
    }
    System.out.println(sw);
  }
}