def selection_sort(A):
    count = 0
    for i in range(len(A)):
        min_value = A[i]
        min_value_index = i
        # print('- i:', i, 'A[i]', A[i], '-')
        for j in range(i, len(A)):
            # print('j:', j, 'A[j]:', A[j])
            
            if A[j] < min_value:
                min_value = A[j]
                min_value_index = j
        # print('min_value', min_value, 'min_value_index', min_value_index)
        if i != min_value_index:
            count += 1
            A[i], A[min_value_index] = A[min_value_index], A[i]
            # print('swap!', A)
        
    return count

n = int(input())
A = list(map(int, input().split()))
count = selection_sort(A)
print(*A)
print(count) def selection_sort(A):
    count = 0
    for i in range(len(A)):
        min_value = A[i]
        min_value_index = i
        # print('- i:', i, 'A[i]', A[i], '-')
        for j in range(i, len(A)):
            # print('j:', j, 'A[j]:', A[j])
            
            if A[j] < min_value:
                min_value = A[j]
                min_value_index = j
        # print('min_value', min_value, 'min_value_index', min_value_index)
        if i != min_value_index:
            count += 1
            A[i], A[min_value_index] = A[min_value_index], A[i]
            # print('swap!', A)
        
    return count selection_sort count = 0 count 0 for i in range(len(A)):
        min_value = A[i]
        min_value_index = i
        # print('- i:', i, 'A[i]', A[i], '-')
        for j in range(i, len(A)):
            # print('j:', j, 'A[j]:', A[j])
            
            if A[j] < min_value:
                min_value = A[j]
                min_value_index = j
        # print('min_value', min_value, 'min_value_index', min_value_index)
        if i != min_value_index:
            count += 1
            A[i], A[min_value_index] = A[min_value_index], A[i]
            # print('swap!', A)
        
     i range(len(A)) range len(A) len A min_value = A[i] min_value A[i] A i min_value_index = i min_value_index i for j in range(i, len(A)):
            # print('j:', j, 'A[j]:', A[j])
            
            if A[j] < min_value:
                min_value = A[j]
                min_value_index = j
        # print('min_value', min_value, 'min_value_index', min_value_index)
         j range(i, len(A)) range i len(A) len A if A[j] < min_value:
                min_value = A[j]
                min_value_index = j
        # print('min_value', min_value, 'min_value_index', min_value_index)
         A[j] < min_value A[j] A j min_value min_value = A[j] min_value A[j] A j min_value_index = j min_value_index j if i != min_value_index:
            count += 1
            A[i], A[min_value_index] = A[min_value_index], A[i]
            # print('swap!', A)
        
     i != min_value_index i min_value_index count += 1 count 1 A[i], A[min_value_index] = A[min_value_index], A[i] A[i] A i A[min_value_index] A min_value_index A[min_value_index] A min_value_index A[i] A i return count count A A n = int(input()) n int(input()) int input() input A = list(map(int, input().split())) A list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split count = selection_sort(A) count selection_sort(A) selection_sort A print(*A) print *A A print(count) print count A = list(map(int, input().split())) list(map(int, input().split())) A n = int(input()) int(input()) n def selection_sort(A):
    count = 0
    for i in range(len(A)):
        min_value = A[i]
        min_value_index = i
        # print('- i:', i, 'A[i]', A[i], '-')
        for j in range(i, len(A)):
            # print('j:', j, 'A[j]:', A[j])
            
            if A[j] < min_value:
                min_value = A[j]
                min_value_index = j
        # print('min_value', min_value, 'min_value_index', min_value_index)
        if i != min_value_index:
            count += 1
            A[i], A[min_value_index] = A[min_value_index], A[i]
            # print('swap!', A)
        
    return count def selection_sort(A):
    count = 0
    for i in range(len(A)):
        min_value = A[i]
        min_value_index = i
        # print('- i:', i, 'A[i]', A[i], '-')
        for j in range(i, len(A)):
            # print('j:', j, 'A[j]:', A[j])
            
            if A[j] < min_value:
                min_value = A[j]
                min_value_index = j
        # print('min_value', min_value, 'min_value_index', min_value_index)
        if i != min_value_index:
            count += 1
            A[i], A[min_value_index] = A[min_value_index], A[i]
            # print('swap!', A)
        
    return count selection_sort count = selection_sort(A) selection_sort(A) count
def selection_sort(A):
    count = 0
    for i in range(len(A)):
        min_value = A[i]
        min_value_index = i
        # print('- i:', i, 'A[i]', A[i], '-')
        for j in range(i, len(A)):
            # print('j:', j, 'A[j]:', A[j])
            
            if A[j] < min_value:
                min_value = A[j]
                min_value_index = j
        # print('min_value', min_value, 'min_value_index', min_value_index)
        if i != min_value_index:
            count += 1
            A[i], A[min_value_index] = A[min_value_index], A[i]
            # print('swap!', A)
        
    return count

n = int(input())
A = list(map(int, input().split()))
count = selection_sort(A)
print(*A)
print(count)
