import std.stdio;
import std.string;
import std.algorithm;
import std.conv;

void selectionSortWithCount(ref int[] arr, out int cnt)
{
  for (auto i = 0; i < arr.length; i++) {
    int min = i;
    for (auto j = i; j < arr.length; j++) {
      if (arr[j] < arr[min]) {
        min = j;
      }
    }
    swap(arr[i], arr[min]);
    if (i != min) cnt++;
  }
}


void main(string[] args)
{
  int n = to!int(strip(readln()));
  int[] arr = to!(int[])(split(readln()));
  int cnt;
  selectionSortWithCount(arr, cnt);
  writeln(join(arr.map!(text), " "));
  writeln(cnt);
}