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

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

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