def selection_sort(A):
    count = 0
    for i in range(len(A)):
        minj = i
        for j in range(i, len(A)):
            if A[j] < A[minj]:
                minj = j
        if minj != i:
            A[i], A[minj] = A[minj], A[i]
            count += 1
    return A, count

if __name__ == '__main__':
    n = int(input())
    A = [int(x) for x in input().split()]
    result_A, count = selection_sort(A)
    print(*result_A)
    print(count)
 def selection_sort(A):
    count = 0
    for i in range(len(A)):
        minj = i
        for j in range(i, len(A)):
            if A[j] < A[minj]:
                minj = j
        if minj != i:
            A[i], A[minj] = A[minj], A[i]
            count += 1
    return A, count selection_sort count = 0 count 0 for i in range(len(A)):
        minj = i
        for j in range(i, len(A)):
            if A[j] < A[minj]:
                minj = j
        if minj != i:
            A[i], A[minj] = A[minj], A[i]
            count += 1
     i range(len(A)) range len(A) len A minj = i minj i for j in range(i, len(A)):
            if A[j] < A[minj]:
                minj = j
         j range(i, len(A)) range i len(A) len A if A[j] < A[minj]:
                minj = j
         A[j] < A[minj] A[j] A j A[minj] A minj minj = j minj j if minj != i:
            A[i], A[minj] = A[minj], A[i]
            count += 1
     minj != i minj i A[i], A[minj] = A[minj], A[i] A[i] A i A[minj] A minj A[minj] A minj A[i] A i count += 1 count 1 return A, count return A, count A count A A if __name__ == '__main__':
    n = int(input())
    A = [int(x) for x in input().split()]
    result_A, count = selection_sort(A)
    print(*result_A)
    print(count) __name__ == '__main__' __name__ '__main__' n = int(input()) n int(input()) int input() input int(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) int x A = [int(x) for x in input().split()] A [int(x) for x in input().split()] result_A, count = selection_sort(A) result_A selection_sort(A) selection_sort A count print(*result_A) print *result_A result_A print(count) print count n = int(input()) int(input()) n result_A, count = selection_sort(A) selection_sort(A) result_A count = selection_sort(A) selection_sort(A) count def selection_sort(A):
    count = 0
    for i in range(len(A)):
        minj = i
        for j in range(i, len(A)):
            if A[j] < A[minj]:
                minj = j
        if minj != i:
            A[i], A[minj] = A[minj], A[i]
            count += 1
    return A, count def selection_sort(A):
    count = 0
    for i in range(len(A)):
        minj = i
        for j in range(i, len(A)):
            if A[j] < A[minj]:
                minj = j
        if minj != i:
            A[i], A[minj] = A[minj], A[i]
            count += 1
    return A, count selection_sort A = [int(x) for x in input().split()] [int(x) for x in input().split()] A
def selection_sort(A):
    count = 0
    for i in range(len(A)):
        minj = i
        for j in range(i, len(A)):
            if A[j] < A[minj]:
                minj = j
        if minj != i:
            A[i], A[minj] = A[minj], A[i]
            count += 1
    return A, count

if __name__ == '__main__':
    n = int(input())
    A = [int(x) for x in input().split()]
    result_A, count = selection_sort(A)
    print(*result_A)
    print(count)

