def selectionSort(a):
    sw = 0
    for i in range(len(a)):
        minj = i
        for j in range(i, len(a)):
            if a[j] < a[minj]:
                minj = j
        a[i], a[minj] = a[minj], a[i]
        if i != minj:
            sw += 1
    return a, sw

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

A, sw = selectionSort(A)

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

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

A, sw = selectionSort(A)

print(*A)
print(sw)
