// ConsoleApplication2.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

int selectionSort(int *, int);

int main()
{
	int i, j, sum,sei[100], num;
	scanf("%d",&sum);

	for (i = 0; i < sum; i++)
	{
		scanf("%d",sei[i]);
	}

	num = selectionSort(sei,sum);

	for (i = 0; i < sum; i++)
	{
		printf("%d",sei[i]);
		if (i >= sum - 1)break;
		printf(" ");
	}
	printf("\n%d\n",num);
    return 0;
}

int selectionSort(int A[], int N)
{
	int i, j, k,minj,tmp;
	static int NUM = 0;

	for (i = 0; i < N - 1; i++)
	{
		minj = i;
		for (j = i; j < N - 1; j++)
		{
			if (A[j] < A[minj])
			{
				minj = j;
			}
		}
		tmp = A[i];
		A[i] = A[minj];
		A[minj] = tmp;
		NUM++;
	}
	return NUM;
}