def selectionSort(n, A):
    cnt =0
    for i in range(n):
        minj = i
        for j in range(i,n):
            if A[minj] > A[j]:
                minj = j
        if i != minj:
            A[i],A[minj] = A[minj],A[i]
            cnt += 1
    print(*A)
    print(cnt)

if __name__ == '__main__':
    n = int(input())
    A = list(map(int, input().split()))
    selectionSort(n,A) def selectionSort(n, A):
    cnt =0
    for i in range(n):
        minj = i
        for j in range(i,n):
            if A[minj] > A[j]:
                minj = j
        if i != minj:
            A[i],A[minj] = A[minj],A[i]
            cnt += 1
    print(*A)
    print(cnt) selectionSort cnt =0 cnt 0 for i in range(n):
        minj = i
        for j in range(i,n):
            if A[minj] > A[j]:
                minj = j
        if i != minj:
            A[i],A[minj] = A[minj],A[i]
            cnt += 1
     i range(n) range n minj = i minj i for j in range(i,n):
            if A[minj] > A[j]:
                minj = j
         j range(i,n) range i n if A[minj] > A[j]:
                minj = j
         A[minj] > A[j] A[minj] A minj A[j] A j minj = j minj j if i != minj:
            A[i],A[minj] = A[minj],A[i]
            cnt += 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 cnt += 1 cnt 1 print(*A) print *A A print(cnt) print cnt n n A A if __name__ == '__main__':
    n = int(input())
    A = list(map(int, input().split()))
    selectionSort(n,A) __name__ == '__main__' __name__ '__main__' 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(n,A) selectionSort n A n = int(input()) int(input()) n def selectionSort(n, A):
    cnt =0
    for i in range(n):
        minj = i
        for j in range(i,n):
            if A[minj] > A[j]:
                minj = j
        if i != minj:
            A[i],A[minj] = A[minj],A[i]
            cnt += 1
    print(*A)
    print(cnt) def selectionSort(n, A):
    cnt =0
    for i in range(n):
        minj = i
        for j in range(i,n):
            if A[minj] > A[j]:
                minj = j
        if i != minj:
            A[i],A[minj] = A[minj],A[i]
            cnt += 1
    print(*A)
    print(cnt) selectionSort A = list(map(int, input().split())) list(map(int, input().split())) A
def selectionSort(n, A):
    cnt =0
    for i in range(n):
        minj = i
        for j in range(i,n):
            if A[minj] > A[j]:
                minj = j
        if i != minj:
            A[i],A[minj] = A[minj],A[i]
            cnt += 1
    print(*A)
    print(cnt)

if __name__ == '__main__':
    n = int(input())
    A = list(map(int, input().split()))
    selectionSort(n,A)