import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);

    int n;
    n = sc.nextInt();

    int a[] = new int[n];
    for (int i = 0; i < n; i++) {
      a[i] = sc.nextInt();
    }

    func(a);

    sc.close();
  }

  private static void func(int a[]) {// 選択ソート
    int minj, copy, times = 0;

    // 選択ソート
    for (int i = 0; i < a.length; i++) {
      minj = i;
      for (int j = i; j < a.length; j++) {// minj の探索
        if (a[j] < a[minj]) minj = j;
      }
      if (a[i] > a[minj]) {// 交換が行われた場合
        copy = a[minj];
        a[minj] = a[i];
        a[i] = copy;
        times++;
      }
    }

    // 回答
    for (int i = 0; i < a.length - 1; i++) {
      System.out.printf("%d ", a[i]);
    }
    System.out.printf("%d\n%d\n", a[a.length - 1], times);
  }
}
 import java.util.Scanner; Scanner java.util public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);

    int n;
    n = sc.nextInt();

    int a[] = new int[n];
    for (int i = 0; i < n; i++) {
      a[i] = sc.nextInt();
    }

    func(a);

    sc.close();
  }

  private static void func(int a[]) {// 選択ソート
    int minj, copy, times = 0;

    // 選択ソート
    for (int i = 0; i < a.length; i++) {
      minj = i;
      for (int j = i; j < a.length; j++) {// minj の探索
        if (a[j] < a[minj]) minj = j;
      }
      if (a[i] > a[minj]) {// 交換が行われた場合
        copy = a[minj];
        a[minj] = a[i];
        a[i] = copy;
        times++;
      }
    }

    // 回答
    for (int i = 0; i < a.length - 1; i++) {
      System.out.printf("%d ", a[i]);
    }
    System.out.printf("%d\n%d\n", a[a.length - 1], times);
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);

    int n;
    n = sc.nextInt();

    int a[] = new int[n];
    for (int i = 0; i < n; i++) {
      a[i] = sc.nextInt();
    }

    func(a);

    sc.close();
  } main {
    Scanner sc = new Scanner(System.in);

    int n;
    n = sc.nextInt();

    int a[] = new int[n];
    for (int i = 0; i < n; i++) {
      a[i] = sc.nextInt();
    }

    func(a);

    sc.close();
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n; n n = sc.nextInt() n sc.nextInt() sc.nextInt sc int a[] = new int[n]; a new int[n] n for (int i = 0; i < n; i++) {
      a[i] = sc.nextInt();
    } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
      a[i] = sc.nextInt();
    } {
      a[i] = sc.nextInt();
    } a[i] = sc.nextInt() a[i] a i sc.nextInt() sc.nextInt sc func(a) func a sc.close() sc.close sc String[] args args private static void func(int a[]) {// 選択ソート
    int minj, copy, times = 0;

    // 選択ソート
    for (int i = 0; i < a.length; i++) {
      minj = i;
      for (int j = i; j < a.length; j++) {// minj の探索
        if (a[j] < a[minj]) minj = j;
      }
      if (a[i] > a[minj]) {// 交換が行われた場合
        copy = a[minj];
        a[minj] = a[i];
        a[i] = copy;
        times++;
      }
    }

    // 回答
    for (int i = 0; i < a.length - 1; i++) {
      System.out.printf("%d ", a[i]);
    }
    System.out.printf("%d\n%d\n", a[a.length - 1], times);
  } func {// 選択ソート
    int minj, copy, times = 0;

    // 選択ソート
    for (int i = 0; i < a.length; i++) {
      minj = i;
      for (int j = i; j < a.length; j++) {// minj の探索
        if (a[j] < a[minj]) minj = j;
      }
      if (a[i] > a[minj]) {// 交換が行われた場合
        copy = a[minj];
        a[minj] = a[i];
        a[i] = copy;
        times++;
      }
    }

    // 回答
    for (int i = 0; i < a.length - 1; i++) {
      System.out.printf("%d ", a[i]);
    }
    System.out.printf("%d\n%d\n", a[a.length - 1], times);
  } int minj minj copy copy times = 0; times 0 for (int i = 0; i < a.length; i++) {
      minj = i;
      for (int j = i; j < a.length; j++) {// minj の探索
        if (a[j] < a[minj]) minj = j;
      }
      if (a[i] > a[minj]) {// 交換が行われた場合
        copy = a[minj];
        a[minj] = a[i];
        a[i] = copy;
        times++;
      }
    } int i = 0; int i = 0; i 0 i < a.length i a.length a a.length i++ i++ i {
      minj = i;
      for (int j = i; j < a.length; j++) {// minj の探索
        if (a[j] < a[minj]) minj = j;
      }
      if (a[i] > a[minj]) {// 交換が行われた場合
        copy = a[minj];
        a[minj] = a[i];
        a[i] = copy;
        times++;
      }
    } {
      minj = i;
      for (int j = i; j < a.length; j++) {// minj の探索
        if (a[j] < a[minj]) minj = j;
      }
      if (a[i] > a[minj]) {// 交換が行われた場合
        copy = a[minj];
        a[minj] = a[i];
        a[i] = copy;
        times++;
      }
    } minj = i minj i for (int j = i; j < a.length; j++) {// minj の探索
        if (a[j] < a[minj]) minj = j;
      } int j = i; int j = i; j i j < a.length j a.length a a.length j++ j++ j {// minj の探索
        if (a[j] < a[minj]) minj = j;
      } {// minj の探索
        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 if (a[i] > a[minj]) {// 交換が行われた場合
        copy = a[minj];
        a[minj] = a[i];
        a[i] = copy;
        times++;
      } a[i] > a[minj] a[i] a i a[minj] a minj {// 交換が行われた場合
        copy = a[minj];
        a[minj] = a[i];
        a[i] = copy;
        times++;
      } copy = a[minj] copy a[minj] a minj a[minj] = a[i] a[minj] a minj a[i] a i a[i] = copy a[i] a i copy times++ times for (int i = 0; i < a.length - 1; i++) {
      System.out.printf("%d ", a[i]);
    } int i = 0; int i = 0; i 0 i < a.length - 1 i a.length - 1 a.length a a.length 1 i++ i++ i {
      System.out.printf("%d ", a[i]);
    } {
      System.out.printf("%d ", a[i]);
    } System.out.printf("%d ", a[i]) System.out.printf System.out System System.out "%d " a[i] a i System.out.printf("%d\n%d\n", a[a.length - 1], times) System.out.printf System.out System System.out "%d\n%d\n" a[a.length - 1] a a.length - 1 a.length a a.length 1 times int a[] a public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);

    int n;
    n = sc.nextInt();

    int a[] = new int[n];
    for (int i = 0; i < n; i++) {
      a[i] = sc.nextInt();
    }

    func(a);

    sc.close();
  }

  private static void func(int a[]) {// 選択ソート
    int minj, copy, times = 0;

    // 選択ソート
    for (int i = 0; i < a.length; i++) {
      minj = i;
      for (int j = i; j < a.length; j++) {// minj の探索
        if (a[j] < a[minj]) minj = j;
      }
      if (a[i] > a[minj]) {// 交換が行われた場合
        copy = a[minj];
        a[minj] = a[i];
        a[i] = copy;
        times++;
      }
    }

    // 回答
    for (int i = 0; i < a.length - 1; i++) {
      System.out.printf("%d ", a[i]);
    }
    System.out.printf("%d\n%d\n", a[a.length - 1], times);
  }
} public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);

    int n;
    n = sc.nextInt();

    int a[] = new int[n];
    for (int i = 0; i < n; i++) {
      a[i] = sc.nextInt();
    }

    func(a);

    sc.close();
  }

  private static void func(int a[]) {// 選択ソート
    int minj, copy, times = 0;

    // 選択ソート
    for (int i = 0; i < a.length; i++) {
      minj = i;
      for (int j = i; j < a.length; j++) {// minj の探索
        if (a[j] < a[minj]) minj = j;
      }
      if (a[i] > a[minj]) {// 交換が行われた場合
        copy = a[minj];
        a[minj] = a[i];
        a[i] = copy;
        times++;
      }
    }

    // 回答
    for (int i = 0; i < a.length - 1; i++) {
      System.out.printf("%d ", a[i]);
    }
    System.out.printf("%d\n%d\n", a[a.length - 1], times);
  }
} Main
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);

    int n;
    n = sc.nextInt();

    int a[] = new int[n];
    for (int i = 0; i < n; i++) {
      a[i] = sc.nextInt();
    }

    func(a);

    sc.close();
  }

  private static void func(int a[]) {// 選択ソート
    int minj, copy, times = 0;

    // 選択ソート
    for (int i = 0; i < a.length; i++) {
      minj = i;
      for (int j = i; j < a.length; j++) {// minj の探索
        if (a[j] < a[minj]) minj = j;
      }
      if (a[i] > a[minj]) {// 交換が行われた場合
        copy = a[minj];
        a[minj] = a[i];
        a[i] = copy;
        times++;
      }
    }

    // 回答
    for (int i = 0; i < a.length - 1; i++) {
      System.out.printf("%d ", a[i]);
    }
    System.out.printf("%d\n%d\n", a[a.length - 1], times);
  }
}

