import std.stdio, std.string, std.array, std.conv;

int selectionSort(int n, int[] x) {
    int cnt = 0;
    foreach (i; 0 .. n-1) {
        int minj = i;
        foreach (j; i .. n) {
            if (x[j] < x[minj]) minj = j;
        }
        if (i != minj) {
            int t = x[i];
            x[i] = x[minj];
            x[minj] = t;
            if (i != minj) ++cnt;
        }
    }
    return cnt;
}

void main() {
    int n = readln.chomp.to!int;
    int[] a = readln.chomp.split.to!(int[]);
    int times = selectionSort(n, a);
    foreach (i, x; a) {
        x.write;
        if (i != n - 1) " ".write;
        else writeln;
    }
    times.writeln;
}
