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.
def selection_sort(A, N):
    sw = 0
    for i in range(N):
        minj = i
        for j in range(i, N):
            if A[j] < A[minj]:
                minj = j
        A[i], A[minj] = A[minj], A[i]
        sw += 1
    return sw


def main():
    N = int(input().rstrip())
    A = list(map(int, input().rstrip().split()))
    
    sw = selection_sort(A, N)
    
    print(' '.join(map(str, A)))
    print(sw)
    
    
if __name__ == '__main__':
    main()
def selection_sort(A, N):
    sw = 0
    for i in range(N):
        minj = i
        for j in range(i, N):
            if A[j] < A[minj]:
                minj = j
        if minj != i:
            sw += 1
            A[i], A[minj] = A[minj], A[i]
    return sw


def main():
    N = int(input().rstrip())
    A = list(map(int, input().rstrip().split()))
    
    sw = selection_sort(A, N)
    
    print(' '.join(map(str, A)))
    print(sw)
    
    
if __name__ == '__main__':
    main()