def SelectionSort(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 i != minj:
            A[i], A[minj] = A[minj], A[i]
            count += 1
    print(" ".join(map(str, A)))
    print(count)


n = int(input())
A = list(map(int, input().split()))

SelectionSort(A) def SelectionSort(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 i != minj:
            A[i], A[minj] = A[minj], A[i]
            count += 1
    print(" ".join(map(str, A)))
    print(count) SelectionSort 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 i != minj:
            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 i != minj:
            A[i], A[minj] = A[minj], A[i]
            count += 1
     i != minj i minj 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 print(" ".join(map(str, A))) print " ".join(map(str, A)) " ".join " " join map(str, A) map str A print(count) print 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 SelectionSort(A) SelectionSort A def SelectionSort(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 i != minj:
            A[i], A[minj] = A[minj], A[i]
            count += 1
    print(" ".join(map(str, A)))
    print(count) def SelectionSort(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 i != minj:
            A[i], A[minj] = A[minj], A[i]
            count += 1
    print(" ".join(map(str, A)))
    print(count) SelectionSort A = list(map(int, input().split())) list(map(int, input().split())) A n = int(input()) int(input()) n
def SelectionSort(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 i != minj:
            A[i], A[minj] = A[minj], A[i]
            count += 1
    print(" ".join(map(str, A)))
    print(count)


n = int(input())
A = list(map(int, input().split()))

SelectionSort(A)