#include <stdio.h>
#define MAX 100



int count=0;

void SelectionSort(int[],int);
void swap(int[],int,int);

int main(void){

  int i,n;
  int sr[MAX];

  scanf("%d",&n);

  for(i=0;i<n;i++)
    scanf("%d",&sr[i]);

  SelectionSort(sr,n);

  for(i=0;i<n-1;i++)
    printf("%d ",sr[i]);
  printf("%d\n",sr[i]);

  printf("%d\n",count/2);

  return 0;
}

void SelectionSort(int sr[],int n){

  int i,j;
  int mini;

  count = 0;

  for(i=0;i<n;i++){
    mini = i;
    for(j=i+1;j<n;j++){
      if(sr[j] < sr[mini]){
        mini = j;
      }
    }
    swap(sr,i,mini);
    count++;
  }
}

void swap(int sr[],int i,int mini){

  int tmp;

  tmp = sr[i];
  sr[i] = sr[mini];
  sr[mini] = tmp;
 }