#include <bits/stdc++.h>
class SelectionSort {
 private:
  std::vector<int> dataSet;
  int changeCount;

 public:
  SelectionSort(std::vector<int> vec);
  void dataSort();
  void showVector();
  int getChangeCount();
};
SelectionSort::SelectionSort(std::vector<int> vec) {
  this->dataSet = vec;
  this->changeCount = 0;
}
void SelectionSort::dataSort() {
  for (int i = 0; i < dataSet.size(); ++i) {
    int min_index = i;
    for (int j = i + 1; j < dataSet.size(); ++j) {
      if (dataSet[min_index] > dataSet[j]) {
        min_index = j;
      }
    }
    if (min_index != i) {
      int tmp = dataSet[i];
      dataSet[i] = dataSet[min_index];
      dataSet[min_index] = tmp;
      changeCount++;
    }
  }
}
void SelectionSort::showVector() {
  for (int i = 0; i < dataSet.size(); i++) {
    std::cout << (i ? " " : "") << dataSet[i];
  }
  std::cout << std::endl;
}
int SelectionSort::getChangeCount() { return this->changeCount; }
int main() {
  int line;
  std::cin >> line;
  std::vector<int> vec;
  int input;
  int input_count;
  while (std::cin >> input) {
    vec.push_back(input);
    input_count++;
    if (input_count >= line) {
      break;
    }
  }
  SelectionSort ss = SelectionSort(vec);
  ss.dataSort();
  ss.showVector();
  std::cout << ss.getChangeCount() << std::endl;
  return 0;
}
