# -*- coding: utf-8 -*-


def selection_sort(A, N):
    for i in xrange(N):
        minj = i
        change = 0
        for j in xrange(i, N):
            if A[j] < A[minj]:
                minj = j
                temp = A[minj]
                A[minj] = A[j]
                A[j] = temp
                change += 1


if __name__ == "__main__":
    N = input()
    A = map(int, raw_input().split())
    result, change = selection_sort(A, N)
    print ' '.join(map(str, result))
    print change