import java.util.Scanner;

class Main{
  static void trace(int[] a){
    int i;
    for(i = 0; i < a.length - 1; i++)
      System.out.print(a[i] + " ");
    System.out.println(a[i]);
  }

  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 count = 0;
    for(int i = 0; i < a.length; i++){
      int m = i;
      for(int j = i; j < a.length; j++){
        if(a[j] < a[m])
          m = j;
        }
      if(m != i){
        int tmp = a[i];
        a[i] = a[m];
        a[m] = tmp;
        count++;
      }
    }

    trace(a);
    System.out.println(count);

  }
} import java.util.Scanner; Scanner java.util class Main{
  static void trace(int[] a){
    int i;
    for(i = 0; i < a.length - 1; i++)
      System.out.print(a[i] + " ");
    System.out.println(a[i]);
  }

  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 count = 0;
    for(int i = 0; i < a.length; i++){
      int m = i;
      for(int j = i; j < a.length; j++){
        if(a[j] < a[m])
          m = j;
        }
      if(m != i){
        int tmp = a[i];
        a[i] = a[m];
        a[m] = tmp;
        count++;
      }
    }

    trace(a);
    System.out.println(count);

  }
} Main static void trace(int[] a){
    int i;
    for(i = 0; i < a.length - 1; i++)
      System.out.print(a[i] + " ");
    System.out.println(a[i]);
  } trace {
    int i;
    for(i = 0; i < a.length - 1; i++)
      System.out.print(a[i] + " ");
    System.out.println(a[i]);
  } int i; i for(i = 0; i < a.length - 1; i++)
      System.out.print(a[i] + " "); i = 0; i = 0 i 0 i < a.length - 1 i a.length - 1 a.length a a.length 1 i++ i++ i System.out.print(a[i] + " "); System.out.print(a[i] + " ") System.out.print System.out System System.out a[i] + " " a[i] a i " " System.out.println(a[i]) System.out.println System.out System System.out a[i] a i int[] a a 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 count = 0;
    for(int i = 0; i < a.length; i++){
      int m = i;
      for(int j = i; j < a.length; j++){
        if(a[j] < a[m])
          m = j;
        }
      if(m != i){
        int tmp = a[i];
        a[i] = a[m];
        a[m] = tmp;
        count++;
      }
    }

    trace(a);
    System.out.println(count);

  } 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 count = 0;
    for(int i = 0; i < a.length; i++){
      int m = i;
      for(int j = i; j < a.length; j++){
        if(a[j] < a[m])
          m = j;
        }
      if(m != i){
        int tmp = a[i];
        a[i] = a[m];
        a[m] = tmp;
        count++;
      }
    }

    trace(a);
    System.out.println(count);

  } 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 count = 0; count 0 for(int i = 0; i < a.length; i++){
      int m = i;
      for(int j = i; j < a.length; j++){
        if(a[j] < a[m])
          m = j;
        }
      if(m != i){
        int tmp = a[i];
        a[i] = a[m];
        a[m] = tmp;
        count++;
      }
    } int i = 0; int i = 0; i 0 i < a.length i a.length a a.length i++ i++ i {
      int m = i;
      for(int j = i; j < a.length; j++){
        if(a[j] < a[m])
          m = j;
        }
      if(m != i){
        int tmp = a[i];
        a[i] = a[m];
        a[m] = tmp;
        count++;
      }
    } {
      int m = i;
      for(int j = i; j < a.length; j++){
        if(a[j] < a[m])
          m = j;
        }
      if(m != i){
        int tmp = a[i];
        a[i] = a[m];
        a[m] = tmp;
        count++;
      }
    } int m = i; m i for(int j = i; j < a.length; j++){
        if(a[j] < a[m])
          m = j;
        } int j = i; int j = i; j i j < a.length j a.length a a.length j++ j++ j {
        if(a[j] < a[m])
          m = j;
        } {
        if(a[j] < a[m])
          m = j;
        } if(a[j] < a[m])
          m = j; a[j] < a[m] a[j] a j a[m] a m m = j m j if(m != i){
        int tmp = a[i];
        a[i] = a[m];
        a[m] = tmp;
        count++;
      } m != i m i {
        int tmp = a[i];
        a[i] = a[m];
        a[m] = tmp;
        count++;
      } int tmp = a[i]; tmp a[i] a i a[i] = a[m] a[i] a i a[m] a m a[m] = tmp a[m] a m tmp count++ count trace(a) trace a System.out.println(count) System.out.println System.out System System.out count String[] args args
import java.util.Scanner;

class Main{
  static void trace(int[] a){
    int i;
    for(i = 0; i < a.length - 1; i++)
      System.out.print(a[i] + " ");
    System.out.println(a[i]);
  }

  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 count = 0;
    for(int i = 0; i < a.length; i++){
      int m = i;
      for(int j = i; j < a.length; j++){
        if(a[j] < a[m])
          m = j;
        }
      if(m != i){
        int tmp = a[i];
        a[i] = a[m];
        a[m] = tmp;
        count++;
      }
    }

    trace(a);
    System.out.println(count);

  }
}