let content = '';
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', buf => {
  content += buf;
});

process.stdin.on('end', () => {
  let [, nums] = content
    .trim()
    .split('\n')
    .map(line => line.split(' ').map(n => +n));
  selectionSort(nums);
});

const selectionSort = nums => {
  let cnt = 0;
  for (let i = 0; i < nums.length; i++) {
    let minIdx = i;
    for (let j = i; j < nums.length; j++) {
      if (nums[minIdx] > nums[j]) {
        minIdx = j;
      }
    }
    
    if (nums[minIdx] !== nums[i]) {
      let tmp = nums[minIdx];
      nums[minIdx] = nums[i];
      nums[i] = tmp;
      cnt++;
    }
  }

  console.log(nums.join(' '));
  console.log(cnt);
};
