import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int x = Integer.parseInt(sc.next());
    int[] a = new int[x];
    for(int i = 0; i < x; i++){
      a[i] = Integer.parseInt(sc.next());
    }
    int count = 0;
    int tmp = 0;
    for(int i = 0; i < x; i++){
      int min_j = i;
      for(int j = i; j < x; j++){
        if(a[j] < a[min_j]){
          tmp = j;
          j = min_j;
          min_j = tmp;
        }
      }
      if(min_j != i){
        count++;
        tmp = a[min_j];
        a[min_j] = a[i];
        a[i] = tmp;
      }
    }
    for(int i = 0; i < (x - 1); i++){
      System.out.printf("%d ", a[i]);
    }
    System.out.printf("%d\n%d\n", a[x - 1], count);
  }
} import java.util.Scanner; Scanner java.util public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int x = Integer.parseInt(sc.next());
    int[] a = new int[x];
    for(int i = 0; i < x; i++){
      a[i] = Integer.parseInt(sc.next());
    }
    int count = 0;
    int tmp = 0;
    for(int i = 0; i < x; i++){
      int min_j = i;
      for(int j = i; j < x; j++){
        if(a[j] < a[min_j]){
          tmp = j;
          j = min_j;
          min_j = tmp;
        }
      }
      if(min_j != i){
        count++;
        tmp = a[min_j];
        a[min_j] = a[i];
        a[i] = tmp;
      }
    }
    for(int i = 0; i < (x - 1); i++){
      System.out.printf("%d ", a[i]);
    }
    System.out.printf("%d\n%d\n", a[x - 1], count);
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int x = Integer.parseInt(sc.next());
    int[] a = new int[x];
    for(int i = 0; i < x; i++){
      a[i] = Integer.parseInt(sc.next());
    }
    int count = 0;
    int tmp = 0;
    for(int i = 0; i < x; i++){
      int min_j = i;
      for(int j = i; j < x; j++){
        if(a[j] < a[min_j]){
          tmp = j;
          j = min_j;
          min_j = tmp;
        }
      }
      if(min_j != i){
        count++;
        tmp = a[min_j];
        a[min_j] = a[i];
        a[i] = tmp;
      }
    }
    for(int i = 0; i < (x - 1); i++){
      System.out.printf("%d ", a[i]);
    }
    System.out.printf("%d\n%d\n", a[x - 1], count);
  } main {
    Scanner sc = new Scanner(System.in);
    int x = Integer.parseInt(sc.next());
    int[] a = new int[x];
    for(int i = 0; i < x; i++){
      a[i] = Integer.parseInt(sc.next());
    }
    int count = 0;
    int tmp = 0;
    for(int i = 0; i < x; i++){
      int min_j = i;
      for(int j = i; j < x; j++){
        if(a[j] < a[min_j]){
          tmp = j;
          j = min_j;
          min_j = tmp;
        }
      }
      if(min_j != i){
        count++;
        tmp = a[min_j];
        a[min_j] = a[i];
        a[i] = tmp;
      }
    }
    for(int i = 0; i < (x - 1); i++){
      System.out.printf("%d ", a[i]);
    }
    System.out.printf("%d\n%d\n", a[x - 1], count);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int x = Integer.parseInt(sc.next()); x Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int[] a = new int[x]; a new int[x] x for(int i = 0; i < x; i++){
      a[i] = Integer.parseInt(sc.next());
    } int i = 0; int i = 0; i 0 i < x i x i++ i++ i {
      a[i] = Integer.parseInt(sc.next());
    } {
      a[i] = Integer.parseInt(sc.next());
    } a[i] = Integer.parseInt(sc.next()) a[i] a i Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int count = 0; count 0 int tmp = 0; tmp 0 for(int i = 0; i < x; i++){
      int min_j = i;
      for(int j = i; j < x; j++){
        if(a[j] < a[min_j]){
          tmp = j;
          j = min_j;
          min_j = tmp;
        }
      }
      if(min_j != i){
        count++;
        tmp = a[min_j];
        a[min_j] = a[i];
        a[i] = tmp;
      }
    } int i = 0; int i = 0; i 0 i < x i x i++ i++ i {
      int min_j = i;
      for(int j = i; j < x; j++){
        if(a[j] < a[min_j]){
          tmp = j;
          j = min_j;
          min_j = tmp;
        }
      }
      if(min_j != i){
        count++;
        tmp = a[min_j];
        a[min_j] = a[i];
        a[i] = tmp;
      }
    } {
      int min_j = i;
      for(int j = i; j < x; j++){
        if(a[j] < a[min_j]){
          tmp = j;
          j = min_j;
          min_j = tmp;
        }
      }
      if(min_j != i){
        count++;
        tmp = a[min_j];
        a[min_j] = a[i];
        a[i] = tmp;
      }
    } int min_j = i; min_j i for(int j = i; j < x; j++){
        if(a[j] < a[min_j]){
          tmp = j;
          j = min_j;
          min_j = tmp;
        }
      } int j = i; int j = i; j i j < x j x j++ j++ j {
        if(a[j] < a[min_j]){
          tmp = j;
          j = min_j;
          min_j = tmp;
        }
      } {
        if(a[j] < a[min_j]){
          tmp = j;
          j = min_j;
          min_j = tmp;
        }
      } if(a[j] < a[min_j]){
          tmp = j;
          j = min_j;
          min_j = tmp;
        } a[j] < a[min_j] a[j] a j a[min_j] a min_j {
          tmp = j;
          j = min_j;
          min_j = tmp;
        } tmp = j tmp j j = min_j j min_j min_j = tmp min_j tmp if(min_j != i){
        count++;
        tmp = a[min_j];
        a[min_j] = a[i];
        a[i] = tmp;
      } min_j != i min_j i {
        count++;
        tmp = a[min_j];
        a[min_j] = a[i];
        a[i] = tmp;
      } count++ count tmp = a[min_j] tmp a[min_j] a min_j a[min_j] = a[i] a[min_j] a min_j a[i] a i a[i] = tmp a[i] a i tmp for(int i = 0; i < (x - 1); i++){
      System.out.printf("%d ", a[i]);
    } int i = 0; int i = 0; i 0 i < (x - 1) i (x - 1) x 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[x - 1], count) System.out.printf System.out System System.out "%d\n%d\n" a[x - 1] a x - 1 x 1 count String[] args args public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int x = Integer.parseInt(sc.next());
    int[] a = new int[x];
    for(int i = 0; i < x; i++){
      a[i] = Integer.parseInt(sc.next());
    }
    int count = 0;
    int tmp = 0;
    for(int i = 0; i < x; i++){
      int min_j = i;
      for(int j = i; j < x; j++){
        if(a[j] < a[min_j]){
          tmp = j;
          j = min_j;
          min_j = tmp;
        }
      }
      if(min_j != i){
        count++;
        tmp = a[min_j];
        a[min_j] = a[i];
        a[i] = tmp;
      }
    }
    for(int i = 0; i < (x - 1); i++){
      System.out.printf("%d ", a[i]);
    }
    System.out.printf("%d\n%d\n", a[x - 1], count);
  }
} public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int x = Integer.parseInt(sc.next());
    int[] a = new int[x];
    for(int i = 0; i < x; i++){
      a[i] = Integer.parseInt(sc.next());
    }
    int count = 0;
    int tmp = 0;
    for(int i = 0; i < x; i++){
      int min_j = i;
      for(int j = i; j < x; j++){
        if(a[j] < a[min_j]){
          tmp = j;
          j = min_j;
          min_j = tmp;
        }
      }
      if(min_j != i){
        count++;
        tmp = a[min_j];
        a[min_j] = a[i];
        a[i] = tmp;
      }
    }
    for(int i = 0; i < (x - 1); i++){
      System.out.printf("%d ", a[i]);
    }
    System.out.printf("%d\n%d\n", a[x - 1], count);
  }
} Main
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int x = Integer.parseInt(sc.next());
    int[] a = new int[x];
    for(int i = 0; i < x; i++){
      a[i] = Integer.parseInt(sc.next());
    }
    int count = 0;
    int tmp = 0;
    for(int i = 0; i < x; i++){
      int min_j = i;
      for(int j = i; j < x; j++){
        if(a[j] < a[min_j]){
          tmp = j;
          j = min_j;
          min_j = tmp;
        }
      }
      if(min_j != i){
        count++;
        tmp = a[min_j];
        a[min_j] = a[i];
        a[i] = tmp;
      }
    }
    for(int i = 0; i < (x - 1); i++){
      System.out.printf("%d ", a[i]);
    }
    System.out.printf("%d\n%d\n", a[x - 1], count);
  }
}
