def selectionSort(N, A):
    count = 0
    for i in range(N):
        minj = i
        for j in range(i, N):
            if A[j] < A[minj]:
                minj = j
        if i != minj:
            k = A[i]
            A[i] = A[minj]
            A[minj] = k
            count += 1
    print(" ".join(map(str, A)))
    print(count)


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


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