<?php
fscanf(STDIN,'%d',$length);
$line = trim(fgets(STDIN));
$arr = explode(' ',$line);

$times=0;
for($i=0;$i<$length;$i++) {
  $min=$i;
  for($j=$i;$j<$length;$j++) {
    if($arr[$j]<$arr[$min]){
      $min=$j;
    }
  }
  if($min==$i){
    continue;
  }
  $temp=$arr[$i];
  $arr[$i]=$arr[$min];
  $arr[$min]= $temp;
  $times++;
}


echo implode(' ',$arr), PHP_EOL,$times;
