import java.util.Scanner;

public class Main {
  
  public static void Print_Array(int[] A){
    int n = A.length;
    for(int i=0;i<n-1;i++){
      System.out.print(A[i] + " ");
    }
    System.out.println(A[n-1]);
  }
  
  public static void Sellection_Sort(int[] A){
    int minj;
    int count = 0;
    for(int i=0;i<A.length;i++){
      minj = i;
      for(int j=i+1;j<A.length;j++){
        if(A[j]<A[minj]){
          minj = j;
        }
      }
      if(i != minj){
        swap(A, i, minj);
        count++;
      }
    }
    Print_Array(A);
    System.out.println(count);
  }

  public static void swap(int[] A, int a, int b){
    int m = A[a];
    A[a] = A[b];
    A[b] = m;
  }
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] A = new int[N];
    for(int i=0;i<N;i++){
      A[i] = sc.nextInt();
    }
    sc.close();
    Sellection_Sort(A);
  }
} import java.util.Scanner; Scanner java.util public class Main {
  
  public static void Print_Array(int[] A){
    int n = A.length;
    for(int i=0;i<n-1;i++){
      System.out.print(A[i] + " ");
    }
    System.out.println(A[n-1]);
  }
  
  public static void Sellection_Sort(int[] A){
    int minj;
    int count = 0;
    for(int i=0;i<A.length;i++){
      minj = i;
      for(int j=i+1;j<A.length;j++){
        if(A[j]<A[minj]){
          minj = j;
        }
      }
      if(i != minj){
        swap(A, i, minj);
        count++;
      }
    }
    Print_Array(A);
    System.out.println(count);
  }

  public static void swap(int[] A, int a, int b){
    int m = A[a];
    A[a] = A[b];
    A[b] = m;
  }
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] A = new int[N];
    for(int i=0;i<N;i++){
      A[i] = sc.nextInt();
    }
    sc.close();
    Sellection_Sort(A);
  }
} Main public static void Print_Array(int[] A){
    int n = A.length;
    for(int i=0;i<n-1;i++){
      System.out.print(A[i] + " ");
    }
    System.out.println(A[n-1]);
  } Print_Array {
    int n = A.length;
    for(int i=0;i<n-1;i++){
      System.out.print(A[i] + " ");
    }
    System.out.println(A[n-1]);
  } int n = A.length; n A.length A A.length for(int i=0;i<n-1;i++){
      System.out.print(A[i] + " ");
    } int i=0; int i=0; i 0 i<n-1 i n-1 n 1 i++ i++ i {
      System.out.print(A[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[n-1]) System.out.println System.out System System.out A[n-1] A n-1 n 1 int[] A A public static void Sellection_Sort(int[] A){
    int minj;
    int count = 0;
    for(int i=0;i<A.length;i++){
      minj = i;
      for(int j=i+1;j<A.length;j++){
        if(A[j]<A[minj]){
          minj = j;
        }
      }
      if(i != minj){
        swap(A, i, minj);
        count++;
      }
    }
    Print_Array(A);
    System.out.println(count);
  } Sellection_Sort {
    int minj;
    int count = 0;
    for(int i=0;i<A.length;i++){
      minj = i;
      for(int j=i+1;j<A.length;j++){
        if(A[j]<A[minj]){
          minj = j;
        }
      }
      if(i != minj){
        swap(A, i, minj);
        count++;
      }
    }
    Print_Array(A);
    System.out.println(count);
  } int minj; minj int count = 0; count 0 for(int i=0;i<A.length;i++){
      minj = i;
      for(int j=i+1;j<A.length;j++){
        if(A[j]<A[minj]){
          minj = j;
        }
      }
      if(i != minj){
        swap(A, i, minj);
        count++;
      }
    } 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+1;j<A.length;j++){
        if(A[j]<A[minj]){
          minj = j;
        }
      }
      if(i != minj){
        swap(A, i, minj);
        count++;
      }
    } {
      minj = i;
      for(int j=i+1;j<A.length;j++){
        if(A[j]<A[minj]){
          minj = j;
        }
      }
      if(i != minj){
        swap(A, i, minj);
        count++;
      }
    } minj = i minj i for(int j=i+1;j<A.length;j++){
        if(A[j]<A[minj]){
          minj = j;
        }
      } int j=i+1; int j=i+1; j i+1 i 1 j<A.length j A.length A A.length j++ j++ j {
        if(A[j]<A[minj]){
          minj = j;
        }
      } {
        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 minj j if(i != minj){
        swap(A, i, minj);
        count++;
      } i != minj i minj {
        swap(A, i, minj);
        count++;
      } swap(A, i, minj) swap A i minj count++ count Print_Array(A) Print_Array A System.out.println(count) System.out.println System.out System System.out count int[] A A public static void swap(int[] A, int a, int b){
    int m = A[a];
    A[a] = A[b];
    A[b] = m;
  } swap {
    int m = A[a];
    A[a] = A[b];
    A[b] = m;
  } int m = A[a]; m A[a] A a A[a] = A[b] A[a] A a A[b] A b A[b] = m A[b] A b m int[] A A int a a int b b public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] A = new int[N];
    for(int i=0;i<N;i++){
      A[i] = sc.nextInt();
    }
    sc.close();
    Sellection_Sort(A);
  } main {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] A = new int[N];
    for(int i=0;i<N;i++){
      A[i] = sc.nextInt();
    }
    sc.close();
    Sellection_Sort(A);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int 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 sc.close() sc.close sc Sellection_Sort(A) Sellection_Sort A String[] args args public class Main {
  
  public static void Print_Array(int[] A){
    int n = A.length;
    for(int i=0;i<n-1;i++){
      System.out.print(A[i] + " ");
    }
    System.out.println(A[n-1]);
  }
  
  public static void Sellection_Sort(int[] A){
    int minj;
    int count = 0;
    for(int i=0;i<A.length;i++){
      minj = i;
      for(int j=i+1;j<A.length;j++){
        if(A[j]<A[minj]){
          minj = j;
        }
      }
      if(i != minj){
        swap(A, i, minj);
        count++;
      }
    }
    Print_Array(A);
    System.out.println(count);
  }

  public static void swap(int[] A, int a, int b){
    int m = A[a];
    A[a] = A[b];
    A[b] = m;
  }
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] A = new int[N];
    for(int i=0;i<N;i++){
      A[i] = sc.nextInt();
    }
    sc.close();
    Sellection_Sort(A);
  }
} public class Main {
  
  public static void Print_Array(int[] A){
    int n = A.length;
    for(int i=0;i<n-1;i++){
      System.out.print(A[i] + " ");
    }
    System.out.println(A[n-1]);
  }
  
  public static void Sellection_Sort(int[] A){
    int minj;
    int count = 0;
    for(int i=0;i<A.length;i++){
      minj = i;
      for(int j=i+1;j<A.length;j++){
        if(A[j]<A[minj]){
          minj = j;
        }
      }
      if(i != minj){
        swap(A, i, minj);
        count++;
      }
    }
    Print_Array(A);
    System.out.println(count);
  }

  public static void swap(int[] A, int a, int b){
    int m = A[a];
    A[a] = A[b];
    A[b] = m;
  }
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] A = new int[N];
    for(int i=0;i<N;i++){
      A[i] = sc.nextInt();
    }
    sc.close();
    Sellection_Sort(A);
  }
} Main
import java.util.Scanner;

public class Main {
  
  public static void Print_Array(int[] A){
    int n = A.length;
    for(int i=0;i<n-1;i++){
      System.out.print(A[i] + " ");
    }
    System.out.println(A[n-1]);
  }
  
  public static void Sellection_Sort(int[] A){
    int minj;
    int count = 0;
    for(int i=0;i<A.length;i++){
      minj = i;
      for(int j=i+1;j<A.length;j++){
        if(A[j]<A[minj]){
          minj = j;
        }
      }
      if(i != minj){
        swap(A, i, minj);
        count++;
      }
    }
    Print_Array(A);
    System.out.println(count);
  }

  public static void swap(int[] A, int a, int b){
    int m = A[a];
    A[a] = A[b];
    A[b] = m;
  }
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] A = new int[N];
    for(int i=0;i<N;i++){
      A[i] = sc.nextInt();
    }
    sc.close();
    Sellection_Sort(A);
  }
}
