import java.util.Scanner;

class Main { 
  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    int N = in.nextInt();
    int[] numbers = new int[N];
    for (int i = 0; i < N; i++) {
      numbers[i] = in.nextInt();
    }
    int count = selectionSort(numbers);
    trace(numbers);
    System.out.println(count);
  }
  
  public static int selectionSort(int[] array) {
    int count = 0;
    for (int i = 0; i < array.length; i++) {
      int mini = i;
      for (int j = i; j < array.length; j++) {
        if (array[j] < array[mini]) mini = j;
      }
      if (mini != i ) {
        swap(array, i, mini);
        count++;
      }
    }
    return count;
  }
  
  public static void swap(int[] array, int p, int q) {
    int temp = array[p];
    array[p] = array[q];
    array[q] = temp;
  }
  
  public static void trace(int[] array) {
    StringBuilder output = new StringBuilder();
    for (int i = 0; i < array.length; i++) {
      output.append(array[i]);
      if (i != array.length -1) output.append(" ");
    }
    System.out.println(output.toString());
  }
} import java.util.Scanner; Scanner java.util class Main { 
  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    int N = in.nextInt();
    int[] numbers = new int[N];
    for (int i = 0; i < N; i++) {
      numbers[i] = in.nextInt();
    }
    int count = selectionSort(numbers);
    trace(numbers);
    System.out.println(count);
  }
  
  public static int selectionSort(int[] array) {
    int count = 0;
    for (int i = 0; i < array.length; i++) {
      int mini = i;
      for (int j = i; j < array.length; j++) {
        if (array[j] < array[mini]) mini = j;
      }
      if (mini != i ) {
        swap(array, i, mini);
        count++;
      }
    }
    return count;
  }
  
  public static void swap(int[] array, int p, int q) {
    int temp = array[p];
    array[p] = array[q];
    array[q] = temp;
  }
  
  public static void trace(int[] array) {
    StringBuilder output = new StringBuilder();
    for (int i = 0; i < array.length; i++) {
      output.append(array[i]);
      if (i != array.length -1) output.append(" ");
    }
    System.out.println(output.toString());
  }
} Main public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    int N = in.nextInt();
    int[] numbers = new int[N];
    for (int i = 0; i < N; i++) {
      numbers[i] = in.nextInt();
    }
    int count = selectionSort(numbers);
    trace(numbers);
    System.out.println(count);
  } main {
    Scanner in = new Scanner(System.in);
    int N = in.nextInt();
    int[] numbers = new int[N];
    for (int i = 0; i < N; i++) {
      numbers[i] = in.nextInt();
    }
    int count = selectionSort(numbers);
    trace(numbers);
    System.out.println(count);
  } Scanner in = new Scanner(System.in); in new Scanner(System.in) int N = in.nextInt(); N in.nextInt() in.nextInt in int[] numbers = new int[N]; numbers new int[N] N for (int i = 0; i < N; i++) {
      numbers[i] = in.nextInt();
    } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
      numbers[i] = in.nextInt();
    } {
      numbers[i] = in.nextInt();
    } numbers[i] = in.nextInt() numbers[i] numbers i in.nextInt() in.nextInt in int count = selectionSort(numbers); count selectionSort(numbers) selectionSort numbers trace(numbers) trace numbers System.out.println(count) System.out.println System.out System System.out count String[] args args public static int selectionSort(int[] array) {
    int count = 0;
    for (int i = 0; i < array.length; i++) {
      int mini = i;
      for (int j = i; j < array.length; j++) {
        if (array[j] < array[mini]) mini = j;
      }
      if (mini != i ) {
        swap(array, i, mini);
        count++;
      }
    }
    return count;
  } selectionSort {
    int count = 0;
    for (int i = 0; i < array.length; i++) {
      int mini = i;
      for (int j = i; j < array.length; j++) {
        if (array[j] < array[mini]) mini = j;
      }
      if (mini != i ) {
        swap(array, i, mini);
        count++;
      }
    }
    return count;
  } int count = 0; count 0 for (int i = 0; i < array.length; i++) {
      int mini = i;
      for (int j = i; j < array.length; j++) {
        if (array[j] < array[mini]) mini = j;
      }
      if (mini != i ) {
        swap(array, i, mini);
        count++;
      }
    } int i = 0; int i = 0; i 0 i < array.length i array.length array array.length i++ i++ i {
      int mini = i;
      for (int j = i; j < array.length; j++) {
        if (array[j] < array[mini]) mini = j;
      }
      if (mini != i ) {
        swap(array, i, mini);
        count++;
      }
    } {
      int mini = i;
      for (int j = i; j < array.length; j++) {
        if (array[j] < array[mini]) mini = j;
      }
      if (mini != i ) {
        swap(array, i, mini);
        count++;
      }
    } int mini = i; mini i for (int j = i; j < array.length; j++) {
        if (array[j] < array[mini]) mini = j;
      } int j = i; int j = i; j i j < array.length j array.length array array.length j++ j++ j {
        if (array[j] < array[mini]) mini = j;
      } {
        if (array[j] < array[mini]) mini = j;
      } if (array[j] < array[mini]) mini = j; array[j] < array[mini] array[j] array j array[mini] array mini mini = j mini j if (mini != i ) {
        swap(array, i, mini);
        count++;
      } mini != i mini i {
        swap(array, i, mini);
        count++;
      } swap(array, i, mini) swap array i mini count++ count return count; count int[] array array public static void swap(int[] array, int p, int q) {
    int temp = array[p];
    array[p] = array[q];
    array[q] = temp;
  } swap {
    int temp = array[p];
    array[p] = array[q];
    array[q] = temp;
  } int temp = array[p]; temp array[p] array p array[p] = array[q] array[p] array p array[q] array q array[q] = temp array[q] array q temp int[] array array int p p int q q public static void trace(int[] array) {
    StringBuilder output = new StringBuilder();
    for (int i = 0; i < array.length; i++) {
      output.append(array[i]);
      if (i != array.length -1) output.append(" ");
    }
    System.out.println(output.toString());
  } trace {
    StringBuilder output = new StringBuilder();
    for (int i = 0; i < array.length; i++) {
      output.append(array[i]);
      if (i != array.length -1) output.append(" ");
    }
    System.out.println(output.toString());
  } StringBuilder output = new StringBuilder(); output new StringBuilder() for (int i = 0; i < array.length; i++) {
      output.append(array[i]);
      if (i != array.length -1) output.append(" ");
    } int i = 0; int i = 0; i 0 i < array.length i array.length array array.length i++ i++ i {
      output.append(array[i]);
      if (i != array.length -1) output.append(" ");
    } {
      output.append(array[i]);
      if (i != array.length -1) output.append(" ");
    } output.append(array[i]) output.append output array[i] array i if (i != array.length -1) output.append(" "); i != array.length -1 i array.length -1 array.length array array.length 1 output.append(" ") output.append output " " System.out.println(output.toString()) System.out.println System.out System System.out output.toString() output.toString output int[] array array
import java.util.Scanner;

class Main { 
  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    int N = in.nextInt();
    int[] numbers = new int[N];
    for (int i = 0; i < N; i++) {
      numbers[i] = in.nextInt();
    }
    int count = selectionSort(numbers);
    trace(numbers);
    System.out.println(count);
  }
  
  public static int selectionSort(int[] array) {
    int count = 0;
    for (int i = 0; i < array.length; i++) {
      int mini = i;
      for (int j = i; j < array.length; j++) {
        if (array[j] < array[mini]) mini = j;
      }
      if (mini != i ) {
        swap(array, i, mini);
        count++;
      }
    }
    return count;
  }
  
  public static void swap(int[] array, int p, int q) {
    int temp = array[p];
    array[p] = array[q];
    array[q] = temp;
  }
  
  public static void trace(int[] array) {
    StringBuilder output = new StringBuilder();
    for (int i = 0; i < array.length; i++) {
      output.append(array[i]);
      if (i != array.length -1) output.append(" ");
    }
    System.out.println(output.toString());
  }
}