Write a program of the Selection Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode:                 SelectionSort(A) 1 for i = 0 to A.length-1 2     mini = i 3     for j = i to A.length-1 4         if A[j] < A[mini] 5             mini = j 6     swap A[i] and A[mini]   Note that, indices for array elements are based on 0-origin.  Your program should also print the number of swap operations defined in line 6 of the pseudocode in the case where i ≠ mini.
# inputList = list(map(int, '''6
# 5 6 4 2 1 3'''.split()))
# N = inputList.pop(0)


def formatting(nums):
    for i in range(len(nums)):
        if i != len(nums) - 1:
            print(nums[i], end=' ')
        else:
            print(nums[i])


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

    formatting(A)
    print(count)



N = int(input())
inputList = list(map(int, input().split()))

selectionSort(inputList, N)


# inputList = list(map(int, '''6
# 5 6 4 2 1 3'''.split()))
# N = inputList.pop(0)


def formatting(nums):
    for i in range(len(nums)):
        if i != len(nums) - 1:
            print(nums[i], end=' ')
        else:
            print(nums[i])


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

        if i != minJ:
            A[i], A[minJ] = A[minJ], A[i]
            count += 1

    formatting(A)
    print(count)



N = int(input())
inputList = list(map(int, input().split()))

selectionSort(inputList, N)

