import java.util.Scanner;

class Main {
  public static void main(String... args) {
    Scanner sc = new Scanner(System.in);
    int size = sc.nextInt();
    int[] array = new int[size];
    for (int i = 0; i < size; i++) {
      array[i] = sc.nextInt();
    }

    int count = 0;
    for (int i = 0; i < size - 1; i++) {
      int min = i;
      for (int j = i; j < size; j++) {
        if (array[j] < array[min]) {
          min = j;
        }
      }
      if (min != i) {
        swap(array, min, i);
        count++;
      }
    }

    for (int i = 0; i < size - 1; i++) {
      System.out.print(array[i] + " ");
    }
    System.out.println(array[size - 1]);
    System.out.println(count);
  }

  public static void swap(int[] array, int min, int i) {
    int tmp = array[i];
    array[i] = array[min];
    array[min] = tmp;
  }
}
 import java.util.Scanner; Scanner java.util class Main {
  public static void main(String... args) {
    Scanner sc = new Scanner(System.in);
    int size = sc.nextInt();
    int[] array = new int[size];
    for (int i = 0; i < size; i++) {
      array[i] = sc.nextInt();
    }

    int count = 0;
    for (int i = 0; i < size - 1; i++) {
      int min = i;
      for (int j = i; j < size; j++) {
        if (array[j] < array[min]) {
          min = j;
        }
      }
      if (min != i) {
        swap(array, min, i);
        count++;
      }
    }

    for (int i = 0; i < size - 1; i++) {
      System.out.print(array[i] + " ");
    }
    System.out.println(array[size - 1]);
    System.out.println(count);
  }

  public static void swap(int[] array, int min, int i) {
    int tmp = array[i];
    array[i] = array[min];
    array[min] = tmp;
  }
} Main public static void main(String... args) {
    Scanner sc = new Scanner(System.in);
    int size = sc.nextInt();
    int[] array = new int[size];
    for (int i = 0; i < size; i++) {
      array[i] = sc.nextInt();
    }

    int count = 0;
    for (int i = 0; i < size - 1; i++) {
      int min = i;
      for (int j = i; j < size; j++) {
        if (array[j] < array[min]) {
          min = j;
        }
      }
      if (min != i) {
        swap(array, min, i);
        count++;
      }
    }

    for (int i = 0; i < size - 1; i++) {
      System.out.print(array[i] + " ");
    }
    System.out.println(array[size - 1]);
    System.out.println(count);
  } main {
    Scanner sc = new Scanner(System.in);
    int size = sc.nextInt();
    int[] array = new int[size];
    for (int i = 0; i < size; i++) {
      array[i] = sc.nextInt();
    }

    int count = 0;
    for (int i = 0; i < size - 1; i++) {
      int min = i;
      for (int j = i; j < size; j++) {
        if (array[j] < array[min]) {
          min = j;
        }
      }
      if (min != i) {
        swap(array, min, i);
        count++;
      }
    }

    for (int i = 0; i < size - 1; i++) {
      System.out.print(array[i] + " ");
    }
    System.out.println(array[size - 1]);
    System.out.println(count);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int size = sc.nextInt(); size sc.nextInt() sc.nextInt sc int[] array = new int[size]; array new int[size] size for (int i = 0; i < size; i++) {
      array[i] = sc.nextInt();
    } int i = 0; int i = 0; i 0 i < size i size i++ i++ i {
      array[i] = sc.nextInt();
    } {
      array[i] = sc.nextInt();
    } array[i] = sc.nextInt() array[i] array i sc.nextInt() sc.nextInt sc int count = 0; count 0 for (int i = 0; i < size - 1; i++) {
      int min = i;
      for (int j = i; j < size; j++) {
        if (array[j] < array[min]) {
          min = j;
        }
      }
      if (min != i) {
        swap(array, min, i);
        count++;
      }
    } int i = 0; int i = 0; i 0 i < size - 1 i size - 1 size 1 i++ i++ i {
      int min = i;
      for (int j = i; j < size; j++) {
        if (array[j] < array[min]) {
          min = j;
        }
      }
      if (min != i) {
        swap(array, min, i);
        count++;
      }
    } {
      int min = i;
      for (int j = i; j < size; j++) {
        if (array[j] < array[min]) {
          min = j;
        }
      }
      if (min != i) {
        swap(array, min, i);
        count++;
      }
    } int min = i; min i for (int j = i; j < size; j++) {
        if (array[j] < array[min]) {
          min = j;
        }
      } int j = i; int j = i; j i j < size j size j++ j++ j {
        if (array[j] < array[min]) {
          min = j;
        }
      } {
        if (array[j] < array[min]) {
          min = j;
        }
      } if (array[j] < array[min]) {
          min = j;
        } array[j] < array[min] array[j] array j array[min] array min {
          min = j;
        } min = j min j if (min != i) {
        swap(array, min, i);
        count++;
      } min != i min i {
        swap(array, min, i);
        count++;
      } swap(array, min, i) swap array min i count++ count for (int i = 0; i < size - 1; i++) {
      System.out.print(array[i] + " ");
    } int i = 0; int i = 0; i 0 i < size - 1 i size - 1 size 1 i++ i++ i {
      System.out.print(array[i] + " ");
    } {
      System.out.print(array[i] + " ");
    } System.out.print(array[i] + " ") System.out.print System.out System System.out array[i] + " " array[i] array i " " System.out.println(array[size - 1]) System.out.println System.out System System.out array[size - 1] array size - 1 size 1 System.out.println(count) System.out.println System.out System System.out count String... args args public static void swap(int[] array, int min, int i) {
    int tmp = array[i];
    array[i] = array[min];
    array[min] = tmp;
  } swap {
    int tmp = array[i];
    array[i] = array[min];
    array[min] = tmp;
  } int tmp = array[i]; tmp array[i] array i array[i] = array[min] array[i] array i array[min] array min array[min] = tmp array[min] array min tmp int[] array array int min min int i i
import java.util.Scanner;

class Main {
  public static void main(String... args) {
    Scanner sc = new Scanner(System.in);
    int size = sc.nextInt();
    int[] array = new int[size];
    for (int i = 0; i < size; i++) {
      array[i] = sc.nextInt();
    }

    int count = 0;
    for (int i = 0; i < size - 1; i++) {
      int min = i;
      for (int j = i; j < size; j++) {
        if (array[j] < array[min]) {
          min = j;
        }
      }
      if (min != i) {
        swap(array, min, i);
        count++;
      }
    }

    for (int i = 0; i < size - 1; i++) {
      System.out.print(array[i] + " ");
    }
    System.out.println(array[size - 1]);
    System.out.println(count);
  }

  public static void swap(int[] array, int min, int i) {
    int tmp = array[i];
    array[i] = array[min];
    array[min] = tmp;
  }
}

