import java.util.*;
class Main{
  public static void main(String args[]){
    int tmp;
    int count = 0;
    int minj;
    Scanner sc = new Scanner(System.in);

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

    for(int i = 0; i<n; i++){
      minj = i;
      for(int j = i; j<n;j++){
        if(Array[j]<Array[minj]){
          minj = j;
        }
      }
      if(i != minj){
        tmp = Array[i];
        Array[i] = Array[minj];
        Array[minj] = tmp;
        count++;
      }
    }
    for(int i = 0; i<n-1; i++){
      System.out.printf("%d ",Array[i]);
    }
    System.out.println(Array[n-1]);
    System.out.println(count);
  }
} import java.util.*; util.* java class Main{
  public static void main(String args[]){
    int tmp;
    int count = 0;
    int minj;
    Scanner sc = new Scanner(System.in);

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

    for(int i = 0; i<n; i++){
      minj = i;
      for(int j = i; j<n;j++){
        if(Array[j]<Array[minj]){
          minj = j;
        }
      }
      if(i != minj){
        tmp = Array[i];
        Array[i] = Array[minj];
        Array[minj] = tmp;
        count++;
      }
    }
    for(int i = 0; i<n-1; i++){
      System.out.printf("%d ",Array[i]);
    }
    System.out.println(Array[n-1]);
    System.out.println(count);
  }
} Main public static void main(String args[]){
    int tmp;
    int count = 0;
    int minj;
    Scanner sc = new Scanner(System.in);

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

    for(int i = 0; i<n; i++){
      minj = i;
      for(int j = i; j<n;j++){
        if(Array[j]<Array[minj]){
          minj = j;
        }
      }
      if(i != minj){
        tmp = Array[i];
        Array[i] = Array[minj];
        Array[minj] = tmp;
        count++;
      }
    }
    for(int i = 0; i<n-1; i++){
      System.out.printf("%d ",Array[i]);
    }
    System.out.println(Array[n-1]);
    System.out.println(count);
  } main {
    int tmp;
    int count = 0;
    int minj;
    Scanner sc = new Scanner(System.in);

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

    for(int i = 0; i<n; i++){
      minj = i;
      for(int j = i; j<n;j++){
        if(Array[j]<Array[minj]){
          minj = j;
        }
      }
      if(i != minj){
        tmp = Array[i];
        Array[i] = Array[minj];
        Array[minj] = tmp;
        count++;
      }
    }
    for(int i = 0; i<n-1; i++){
      System.out.printf("%d ",Array[i]);
    }
    System.out.println(Array[n-1]);
    System.out.println(count);
  } int tmp; tmp int count = 0; count 0 int minj; minj Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int [] Array = new int[n]; Array new int[n] n for(int i = 0; i<n; i++){
      Array[i] = sc.nextInt();
    } int i = 0; int i = 0; i 0 i<n i n i++ i++ i {
      Array[i] = sc.nextInt();
    } {
      Array[i] = sc.nextInt();
    } Array[i] = sc.nextInt() Array[i] Array i sc.nextInt() sc.nextInt sc for(int i = 0; i<n; i++){
      minj = i;
      for(int j = i; j<n;j++){
        if(Array[j]<Array[minj]){
          minj = j;
        }
      }
      if(i != minj){
        tmp = Array[i];
        Array[i] = Array[minj];
        Array[minj] = tmp;
        count++;
      }
    } int i = 0; int i = 0; i 0 i<n i n i++ i++ i {
      minj = i;
      for(int j = i; j<n;j++){
        if(Array[j]<Array[minj]){
          minj = j;
        }
      }
      if(i != minj){
        tmp = Array[i];
        Array[i] = Array[minj];
        Array[minj] = tmp;
        count++;
      }
    } {
      minj = i;
      for(int j = i; j<n;j++){
        if(Array[j]<Array[minj]){
          minj = j;
        }
      }
      if(i != minj){
        tmp = Array[i];
        Array[i] = Array[minj];
        Array[minj] = tmp;
        count++;
      }
    } minj = i minj i for(int j = i; j<n;j++){
        if(Array[j]<Array[minj]){
          minj = j;
        }
      } int j = i; int j = i; j i j<n j n j++ j++ j {
        if(Array[j]<Array[minj]){
          minj = j;
        }
      } {
        if(Array[j]<Array[minj]){
          minj = j;
        }
      } if(Array[j]<Array[minj]){
          minj = j;
        } Array[j]<Array[minj] Array[j] Array j Array[minj] Array minj {
          minj = j;
        } minj = j minj j if(i != minj){
        tmp = Array[i];
        Array[i] = Array[minj];
        Array[minj] = tmp;
        count++;
      } i != minj i minj {
        tmp = Array[i];
        Array[i] = Array[minj];
        Array[minj] = tmp;
        count++;
      } tmp = Array[i] tmp Array[i] Array i Array[i] = Array[minj] Array[i] Array i Array[minj] Array minj Array[minj] = tmp Array[minj] Array minj tmp count++ count for(int i = 0; i<n-1; i++){
      System.out.printf("%d ",Array[i]);
    } int i = 0; int i = 0; i 0 i<n-1 i n-1 n 1 i++ i++ i {
      System.out.printf("%d ",Array[i]);
    } {
      System.out.printf("%d ",Array[i]);
    } System.out.printf("%d ",Array[i]) System.out.printf System.out System System.out "%d " Array[i] Array i System.out.println(Array[n-1]) System.out.println System.out System System.out Array[n-1] Array n-1 n 1 System.out.println(count) System.out.println System.out System System.out count String args[] args
import java.util.*;
class Main{
  public static void main(String args[]){
    int tmp;
    int count = 0;
    int minj;
    Scanner sc = new Scanner(System.in);

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

    for(int i = 0; i<n; i++){
      minj = i;
      for(int j = i; j<n;j++){
        if(Array[j]<Array[minj]){
          minj = j;
        }
      }
      if(i != minj){
        tmp = Array[i];
        Array[i] = Array[minj];
        Array[minj] = tmp;
        count++;
      }
    }
    for(int i = 0; i<n-1; i++){
      System.out.printf("%d ",Array[i]);
    }
    System.out.println(Array[n-1]);
    System.out.println(count);
  }
}
