import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

  public static void main(String[] args) throws IOException {
    
    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      int count=0;
      int n = Integer.parseInt(br.readLine());
      int[] seq = new int[n];
      String[] line = br.readLine().split(" ");
      for (int i=0; i < n; i++) {
        seq[i] = Integer.parseInt(line[i]);
      }

      count = selectionSort(seq, n);

      dispIntArray(seq);
      System.out.println(count);
    }
  }

  static int selectionSort(int a[], int n) {
    int count = 0;

    for(int i=0,min,t; i<n-1; i++ ) {
      min = i;
      for(int j=i+1; j<n; j++ ) {
        if( a[min] > a[j]) min = j;
      }
      if( min != i ) {
        t = a[i]; a[i] = a[min]; a[min] = t;
        count++;
      }
    }

    return count;
  }

  public static void dispIntArray(int a[]) {
    StringBuilder s = new StringBuilder();

    for (int i : a) { s.append(i).append(" "); }
    s.setLength(s.length()-1);

    System.out.println(s);
  }
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {

  public static void main(String[] args) throws IOException {
    
    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      int count=0;
      int n = Integer.parseInt(br.readLine());
      int[] seq = new int[n];
      String[] line = br.readLine().split(" ");
      for (int i=0; i < n; i++) {
        seq[i] = Integer.parseInt(line[i]);
      }

      count = selectionSort(seq, n);

      dispIntArray(seq);
      System.out.println(count);
    }
  }

  static int selectionSort(int a[], int n) {
    int count = 0;

    for(int i=0,min,t; i<n-1; i++ ) {
      min = i;
      for(int j=i+1; j<n; j++ ) {
        if( a[min] > a[j]) min = j;
      }
      if( min != i ) {
        t = a[i]; a[i] = a[min]; a[min] = t;
        count++;
      }
    }

    return count;
  }

  public static void dispIntArray(int a[]) {
    StringBuilder s = new StringBuilder();

    for (int i : a) { s.append(i).append(" "); }
    s.setLength(s.length()-1);

    System.out.println(s);
  }
} Main public static void main(String[] args) throws IOException {
    
    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      int count=0;
      int n = Integer.parseInt(br.readLine());
      int[] seq = new int[n];
      String[] line = br.readLine().split(" ");
      for (int i=0; i < n; i++) {
        seq[i] = Integer.parseInt(line[i]);
      }

      count = selectionSort(seq, n);

      dispIntArray(seq);
      System.out.println(count);
    }
  } main {
    
    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      int count=0;
      int n = Integer.parseInt(br.readLine());
      int[] seq = new int[n];
      String[] line = br.readLine().split(" ");
      for (int i=0; i < n; i++) {
        seq[i] = Integer.parseInt(line[i]);
      }

      count = selectionSort(seq, n);

      dispIntArray(seq);
      System.out.println(count);
    }
  } try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      int count=0;
      int n = Integer.parseInt(br.readLine());
      int[] seq = new int[n];
      String[] line = br.readLine().split(" ");
      for (int i=0; i < n; i++) {
        seq[i] = Integer.parseInt(line[i]);
      }

      count = selectionSort(seq, n);

      dispIntArray(seq);
      System.out.println(count);
    } {

      int count=0;
      int n = Integer.parseInt(br.readLine());
      int[] seq = new int[n];
      String[] line = br.readLine().split(" ");
      for (int i=0; i < n; i++) {
        seq[i] = Integer.parseInt(line[i]);
      }

      count = selectionSort(seq, n);

      dispIntArray(seq);
      System.out.println(count);
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)) BufferedReader br = new BufferedReader(new InputStreamReader(System.in)) new BufferedReader(new InputStreamReader(System.in)) int count=0; count 0 int n = Integer.parseInt(br.readLine()); n Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br int[] seq = new int[n]; seq new int[n] n String[] line = br.readLine().split(" "); line br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " for (int i=0; i < n; i++) {
        seq[i] = Integer.parseInt(line[i]);
      } int i=0; int i=0; i 0 i < n i n i++ i++ i {
        seq[i] = Integer.parseInt(line[i]);
      } {
        seq[i] = Integer.parseInt(line[i]);
      } seq[i] = Integer.parseInt(line[i]) seq[i] seq i Integer.parseInt(line[i]) Integer.parseInt Integer line[i] line i count = selectionSort(seq, n) count selectionSort(seq, n) selectionSort seq n dispIntArray(seq) dispIntArray seq System.out.println(count) System.out.println System.out System System.out count String[] args args static int selectionSort(int a[], int n) {
    int count = 0;

    for(int i=0,min,t; i<n-1; i++ ) {
      min = i;
      for(int j=i+1; j<n; j++ ) {
        if( a[min] > a[j]) min = j;
      }
      if( min != i ) {
        t = a[i]; a[i] = a[min]; a[min] = t;
        count++;
      }
    }

    return count;
  } selectionSort {
    int count = 0;

    for(int i=0,min,t; i<n-1; i++ ) {
      min = i;
      for(int j=i+1; j<n; j++ ) {
        if( a[min] > a[j]) min = j;
      }
      if( min != i ) {
        t = a[i]; a[i] = a[min]; a[min] = t;
        count++;
      }
    }

    return count;
  } int count = 0; count 0 for(int i=0,min,t; i<n-1; i++ ) {
      min = i;
      for(int j=i+1; j<n; j++ ) {
        if( a[min] > a[j]) min = j;
      }
      if( min != i ) {
        t = a[i]; a[i] = a[min]; a[min] = t;
        count++;
      }
    } int i=0,min,t; int i=0 i 0 min min t; t i<n-1 i n-1 n 1 i++ i++ i {
      min = i;
      for(int j=i+1; j<n; j++ ) {
        if( a[min] > a[j]) min = j;
      }
      if( min != i ) {
        t = a[i]; a[i] = a[min]; a[min] = t;
        count++;
      }
    } {
      min = i;
      for(int j=i+1; j<n; j++ ) {
        if( a[min] > a[j]) min = j;
      }
      if( min != i ) {
        t = a[i]; a[i] = a[min]; a[min] = t;
        count++;
      }
    } min = i min i for(int j=i+1; j<n; j++ ) {
        if( a[min] > a[j]) min = j;
      } int j=i+1; int j=i+1; j i+1 i 1 j<n j n j++ j++ j {
        if( a[min] > a[j]) min = j;
      } {
        if( a[min] > a[j]) min = j;
      } if( a[min] > a[j]) min = j; a[min] > a[j] a[min] a min a[j] a j min = j min j if( min != i ) {
        t = a[i]; a[i] = a[min]; a[min] = t;
        count++;
      } min != i min i {
        t = a[i]; a[i] = a[min]; a[min] = t;
        count++;
      } t = a[i] t a[i] a i a[i] = a[min] a[i] a i a[min] a min a[min] = t a[min] a min t count++ count return count; count int a[] a int n n public static void dispIntArray(int a[]) {
    StringBuilder s = new StringBuilder();

    for (int i : a) { s.append(i).append(" "); }
    s.setLength(s.length()-1);

    System.out.println(s);
  } dispIntArray {
    StringBuilder s = new StringBuilder();

    for (int i : a) { s.append(i).append(" "); }
    s.setLength(s.length()-1);

    System.out.println(s);
  } StringBuilder s = new StringBuilder(); s new StringBuilder() for (int i : a) { s.append(i).append(" "); } int i a { s.append(i).append(" "); } { s.append(i).append(" "); } s.append(i).append(" ") s.append(i).append s.append(i) s.append s i " " s.setLength(s.length()-1) s.setLength s s.length()-1 s.length() s.length s 1 System.out.println(s) System.out.println System.out System System.out s int a[] a public class Main {

  public static void main(String[] args) throws IOException {
    
    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      int count=0;
      int n = Integer.parseInt(br.readLine());
      int[] seq = new int[n];
      String[] line = br.readLine().split(" ");
      for (int i=0; i < n; i++) {
        seq[i] = Integer.parseInt(line[i]);
      }

      count = selectionSort(seq, n);

      dispIntArray(seq);
      System.out.println(count);
    }
  }

  static int selectionSort(int a[], int n) {
    int count = 0;

    for(int i=0,min,t; i<n-1; i++ ) {
      min = i;
      for(int j=i+1; j<n; j++ ) {
        if( a[min] > a[j]) min = j;
      }
      if( min != i ) {
        t = a[i]; a[i] = a[min]; a[min] = t;
        count++;
      }
    }

    return count;
  }

  public static void dispIntArray(int a[]) {
    StringBuilder s = new StringBuilder();

    for (int i : a) { s.append(i).append(" "); }
    s.setLength(s.length()-1);

    System.out.println(s);
  }
} public class Main {

  public static void main(String[] args) throws IOException {
    
    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      int count=0;
      int n = Integer.parseInt(br.readLine());
      int[] seq = new int[n];
      String[] line = br.readLine().split(" ");
      for (int i=0; i < n; i++) {
        seq[i] = Integer.parseInt(line[i]);
      }

      count = selectionSort(seq, n);

      dispIntArray(seq);
      System.out.println(count);
    }
  }

  static int selectionSort(int a[], int n) {
    int count = 0;

    for(int i=0,min,t; i<n-1; i++ ) {
      min = i;
      for(int j=i+1; j<n; j++ ) {
        if( a[min] > a[j]) min = j;
      }
      if( min != i ) {
        t = a[i]; a[i] = a[min]; a[min] = t;
        count++;
      }
    }

    return count;
  }

  public static void dispIntArray(int a[]) {
    StringBuilder s = new StringBuilder();

    for (int i : a) { s.append(i).append(" "); }
    s.setLength(s.length()-1);

    System.out.println(s);
  }
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

  public static void main(String[] args) throws IOException {
    
    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      int count=0;
      int n = Integer.parseInt(br.readLine());
      int[] seq = new int[n];
      String[] line = br.readLine().split(" ");
      for (int i=0; i < n; i++) {
        seq[i] = Integer.parseInt(line[i]);
      }

      count = selectionSort(seq, n);

      dispIntArray(seq);
      System.out.println(count);
    }
  }

  static int selectionSort(int a[], int n) {
    int count = 0;

    for(int i=0,min,t; i<n-1; i++ ) {
      min = i;
      for(int j=i+1; j<n; j++ ) {
        if( a[min] > a[j]) min = j;
      }
      if( min != i ) {
        t = a[i]; a[i] = a[min]; a[min] = t;
        count++;
      }
    }

    return count;
  }

  public static void dispIntArray(int a[]) {
    StringBuilder s = new StringBuilder();

    for (int i : a) { s.append(i).append(" "); }
    s.setLength(s.length()-1);

    System.out.println(s);
  }
}
