#include <stdio.h>
 
int SelectionSort(int a[100], int n);
 
int main()
{
    int a[100], n, i, c;
 
    scanf("%d", &n);
    for (i = 0; i < n; i++)
        scanf("%d", &a[i]);
 
    c = SelectionSort(a, n);
 
    for (i = 0; i < n; i++) {
        if (i == n - 1) {
            printf("%d\n", a[i]);
        } else {
            printf("%d ", a[i]);
        }
    }
    printf("%d\n", c);
 
    return 0;
}
 
int SelectionSort(int a[100], int n) {
    int i, j, x;
    int c = 0;
    for (i = 0; i < n - 1; i++) {
        if (a[i] != i + 1) {
            for (j = i + 1; j < n; j++) {
                if (a[j] == i + 1)
                    break;
            }
            x = a[j];
            a[j] = a[i];
            a[i] = x;
            c += 1;
        }
    }
    return c;
}