//AOJ ALDS1_2_B
#include <stdio.h>

int main () {
	int n,o,minj,j,i,x,count = 0;

	scanf("%d", &n);
	int a[n];

	for (i = 0; i < n; i++) {
			minj = i;

			for (j = i; j < (n -1); j++) {
				if (a[j] < a[minj]) {
					minj = j;
					x = i;
					a[i] = a[minj];
					a[minj] = a[x];
					count++;
				}
			}

	}

	for (i = 0; i < n; i++) {
		if (i != (n -1)) printf("%d ", a[n]);
		else printf("%d\n", a[n]);
	}

	printf("%d\n", count);


	return 0;
}
