#include "stdafx.h"
#include<iostream>
using namespace std;

int selectionSort(int A[], int N) {
	int sw;
	for (int i = 0; i < N - 1; i++) {
		int min = A[i];
		for (int j = i; j < N; j++) {
			if (A[j] < min) min = A[j];
		}
		swap(min, A[i]);
		if (A[i] != min) sw++;
	}
	return sw;
}

int main()
{
	int A[100], N;
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	int sw = selectionSort(A, N);

	for (int i = 0; i < N; i++) {
		if (i > 0) cout << " ";
		cout << A[i];
	}
	cout << endl;
	cout << sw;
    return 0;
}