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

    print(*A)
    print(count)

arr_length = int(input())
arr_num = [int(i) for i in input().split(" ")]

selectionSort(arr_num, arr_length) def selectionSort(A, N):
    count = 0
    for i in range(N):
        minj = i
        for j in range(i, N):
            if A[j] < A[minj]:
                minj = j
        if minj != i:
            count += 1
            A[i], A[minj] = A[minj], A[i]

    print(*A)
    print(count) selectionSort count = 0 count 0 for i in range(N):
        minj = i
        for j in range(i, N):
            if A[j] < A[minj]:
                minj = j
        if minj != i:
            count += 1
            A[i], A[minj] = A[minj], A[i]

     i range(N) range N minj = i minj i for j in range(i, N):
            if A[j] < A[minj]:
                minj = j
         j range(i, N) range i N 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:
            count += 1
            A[i], A[minj] = A[minj], A[i]

     minj != i minj i count += 1 count 1 A[i], A[minj] = A[minj], A[i] A[i] A i A[minj] A minj A[minj] A minj A[i] A i print(*A) print *A A print(count) print count A A N N arr_length = int(input()) arr_length int(input()) int input() input int(i) for i in input().split(" ") for i in input().split(" ") i input().split(" ") ().split () input split " " for i in input().split(" ") int(i) int i arr_num = [int(i) for i in input().split(" ")] arr_num [int(i) for i in input().split(" ")] selectionSort(arr_num, arr_length) selectionSort arr_num arr_length def selectionSort(A, N):
    count = 0
    for i in range(N):
        minj = i
        for j in range(i, N):
            if A[j] < A[minj]:
                minj = j
        if minj != i:
            count += 1
            A[i], A[minj] = A[minj], A[i]

    print(*A)
    print(count) def selectionSort(A, N):
    count = 0
    for i in range(N):
        minj = i
        for j in range(i, N):
            if A[j] < A[minj]:
                minj = j
        if minj != i:
            count += 1
            A[i], A[minj] = A[minj], A[i]

    print(*A)
    print(count) selectionSort arr_num = [int(i) for i in input().split(" ")] [int(i) for i in input().split(" ")] arr_num arr_length = int(input()) int(input()) arr_length
def selectionSort(A, N):
    count = 0
    for i in range(N):
        minj = i
        for j in range(i, N):
            if A[j] < A[minj]:
                minj = j
        if minj != i:
            count += 1
            A[i], A[minj] = A[minj], A[i]

    print(*A)
    print(count)

arr_length = int(input())
arr_num = [int(i) for i in input().split(" ")]

selectionSort(arr_num, arr_length)