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

if __name__ == '__main__':
    n = int(input())
    array, count = selection_sort(list(map(int, input().split())))
    print(' '.join(map(str, array)))
    print(count) def selection_sort(A):
    count = 0
    for i in range(len(A)):
        min_j = i
        for j in range(i, len(A)):
            if A[j] < A[min_j]:
                min_j = j
        if i != min_j:
            A[i], A[min_j] = A[min_j], A[i]
            count += 1
    return A, count selection_sort count = 0 count 0 for i in range(len(A)):
        min_j = i
        for j in range(i, len(A)):
            if A[j] < A[min_j]:
                min_j = j
        if i != min_j:
            A[i], A[min_j] = A[min_j], A[i]
            count += 1
     i range(len(A)) range len(A) len A min_j = i min_j i for j in range(i, len(A)):
            if A[j] < A[min_j]:
                min_j = j
         j range(i, len(A)) range i len(A) len A if A[j] < A[min_j]:
                min_j = j
         A[j] < A[min_j] A[j] A j A[min_j] A min_j min_j = j min_j j if i != min_j:
            A[i], A[min_j] = A[min_j], A[i]
            count += 1
     i != min_j i min_j A[i], A[min_j] = A[min_j], A[i] A[i] A i A[min_j] A min_j A[min_j] A min_j A[i] A i count += 1 count 1 return A, count return A, count A count A A if __name__ == '__main__':
    n = int(input())
    array, count = selection_sort(list(map(int, input().split())))
    print(' '.join(map(str, array)))
    print(count) __name__ == '__main__' __name__ '__main__' n = int(input()) n int(input()) int input() input array, count = selection_sort(list(map(int, input().split()))) array selection_sort(list(map(int, input().split()))) selection_sort list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split count print(' '.join(map(str, array))) print ' '.join(map(str, array)) ' '.join ' ' join map(str, array) map str array print(count) print count count = selection_sort(list(map(int, input().split()))) selection_sort(list(map(int, input().split()))) count def selection_sort(A):
    count = 0
    for i in range(len(A)):
        min_j = i
        for j in range(i, len(A)):
            if A[j] < A[min_j]:
                min_j = j
        if i != min_j:
            A[i], A[min_j] = A[min_j], A[i]
            count += 1
    return A, count def selection_sort(A):
    count = 0
    for i in range(len(A)):
        min_j = i
        for j in range(i, len(A)):
            if A[j] < A[min_j]:
                min_j = j
        if i != min_j:
            A[i], A[min_j] = A[min_j], A[i]
            count += 1
    return A, count selection_sort n = int(input()) int(input()) n array, count = selection_sort(list(map(int, input().split()))) selection_sort(list(map(int, input().split()))) array
def selection_sort(A):
    count = 0
    for i in range(len(A)):
        min_j = i
        for j in range(i, len(A)):
            if A[j] < A[min_j]:
                min_j = j
        if i != min_j:
            A[i], A[min_j] = A[min_j], A[i]
            count += 1
    return A, count

if __name__ == '__main__':
    n = int(input())
    array, count = selection_sort(list(map(int, input().split())))
    print(' '.join(map(str, array)))
    print(count)