def selectionSort(numbers):
    n = len(numbers)
    count = 0
    for i in range(n):
        min_j = i
        for j in range(i + 1, n):
            if numbers[j] < numbers[min_j]:
                min_j = j
        if min_j != i:
            temp = numbers[i]
            numbers[i] = numbers[min_j]
            numbers[min_j] = temp
            count += 1
    return (" ".join(list(map(str, numbers))), count)


def inputInline():
    int(input())
    numbers = list(map(int, input().split(" ")))
    return numbers


result = selectionSort(inputInline())
print(result[0])
print(result[1]) def selectionSort(numbers):
    n = len(numbers)
    count = 0
    for i in range(n):
        min_j = i
        for j in range(i + 1, n):
            if numbers[j] < numbers[min_j]:
                min_j = j
        if min_j != i:
            temp = numbers[i]
            numbers[i] = numbers[min_j]
            numbers[min_j] = temp
            count += 1
    return (" ".join(list(map(str, numbers))), count) selectionSort n = len(numbers) n len(numbers) len numbers count = 0 count 0 for i in range(n):
        min_j = i
        for j in range(i + 1, n):
            if numbers[j] < numbers[min_j]:
                min_j = j
        if min_j != i:
            temp = numbers[i]
            numbers[i] = numbers[min_j]
            numbers[min_j] = temp
            count += 1
     i range(n) range n min_j = i min_j i for j in range(i + 1, n):
            if numbers[j] < numbers[min_j]:
                min_j = j
         j range(i + 1, n) range i + 1 i 1 n if numbers[j] < numbers[min_j]:
                min_j = j
         numbers[j] < numbers[min_j] numbers[j] numbers j numbers[min_j] numbers min_j min_j = j min_j j if min_j != i:
            temp = numbers[i]
            numbers[i] = numbers[min_j]
            numbers[min_j] = temp
            count += 1
     min_j != i min_j i temp = numbers[i] temp numbers[i] numbers i numbers[i] = numbers[min_j] numbers[i] numbers i numbers[min_j] numbers min_j numbers[min_j] = temp numbers[min_j] numbers min_j temp count += 1 count 1 return (" ".join(list(map(str, numbers))), count) (" ".join(list(map(str, numbers))), count) " ".join(list(map(str, numbers))) " ".join " " join list(map(str, numbers)) list map(str, numbers) map str numbers count numbers numbers def inputInline():
    int(input())
    numbers = list(map(int, input().split(" ")))
    return numbers inputInline int(input()) int input() input numbers = list(map(int, input().split(" "))) numbers list(map(int, input().split(" "))) list map(int, input().split(" ")) map int input().split(" ") ().split () input split " " return numbers numbers result = selectionSort(inputInline()) result selectionSort(inputInline()) selectionSort inputInline() inputInline print(result[0]) print result[0] result 0 print(result[1]) print result[1] result 1 def selectionSort(numbers):
    n = len(numbers)
    count = 0
    for i in range(n):
        min_j = i
        for j in range(i + 1, n):
            if numbers[j] < numbers[min_j]:
                min_j = j
        if min_j != i:
            temp = numbers[i]
            numbers[i] = numbers[min_j]
            numbers[min_j] = temp
            count += 1
    return (" ".join(list(map(str, numbers))), count) def selectionSort(numbers):
    n = len(numbers)
    count = 0
    for i in range(n):
        min_j = i
        for j in range(i + 1, n):
            if numbers[j] < numbers[min_j]:
                min_j = j
        if min_j != i:
            temp = numbers[i]
            numbers[i] = numbers[min_j]
            numbers[min_j] = temp
            count += 1
    return (" ".join(list(map(str, numbers))), count) selectionSort def inputInline():
    int(input())
    numbers = list(map(int, input().split(" ")))
    return numbers def inputInline():
    int(input())
    numbers = list(map(int, input().split(" ")))
    return numbers inputInline result = selectionSort(inputInline()) selectionSort(inputInline()) result
def selectionSort(numbers):
    n = len(numbers)
    count = 0
    for i in range(n):
        min_j = i
        for j in range(i + 1, n):
            if numbers[j] < numbers[min_j]:
                min_j = j
        if min_j != i:
            temp = numbers[i]
            numbers[i] = numbers[min_j]
            numbers[min_j] = temp
            count += 1
    return (" ".join(list(map(str, numbers))), count)


def inputInline():
    int(input())
    numbers = list(map(int, input().split(" ")))
    return numbers


result = selectionSort(inputInline())
print(result[0])
print(result[1])