#coding:utf-8

n = int(eval(input()))

numbers = list(map(int, input().split()))



def selectionSort(ary):

    count = 0

    for i in range(len(ary)):

        minj = i

        for j in range(i, len(ary)):

            if ary[minj] > ary[j]:

                minj = j

        if minj != i:

            ary[minj], ary[i] = ary[i], ary[minj]

            count += 1

    return (ary, count)



result = selectionSort(numbers)

print((*result[0]))

print((result[1]))
#coding:utf-8

#1_2_B

def selection_sort(ary, n):

    count = 0

    for i in range(n):

        minj = i

        for j in range(i, n):

            if ary[minj] > ary[j]:

                minj = j

        if ary[minj] != ary[i]:

            ary[minj], ary[i] = ary[i], ary[minj]

            count += 1

    print((*ary))

    print(count)



n = int(eval(input()))

selection_sort(list(map(int, input().split())), n)
# coding:utf-8
n = int(eval(input()))
numbers = list(map(int, input().split()))


def selectionSort(ary):
    count = 0
    for i in range(len(ary)):
        minj = i
        for j in range(i, len(ary)):
            if ary[minj] > ary[j]:
                minj = j
        if minj != i:
            ary[minj], ary[i] = ary[i], ary[minj]
            count += 1
    return (ary, count)


result = selectionSort(numbers)
print((*result[0]))
print((result[1]))

# coding:utf-8
# 1_2_B
def selection_sort(ary, n):
    count = 0
    for i in range(n):
        minj = i
        for j in range(i, n):
            if ary[minj] > ary[j]:
                minj = j
        if ary[minj] != ary[i]:
            ary[minj], ary[i] = ary[i], ary[minj]
            count += 1
    print((*ary))
    print(count)


n = int(eval(input()))
selection_sort(list(map(int, input().split())), n)

-n = int(eval(input())) -numbers = list(map(int, input().split())) +# 1_2_B +def selection_sort(ary, n): +    count = 0 +    for i in range(n): +        minj = i +        for j in range(i, n): +            if ary[minj] > ary[j]: +                minj = j +        if ary[minj] != ary[i]: +            ary[minj], ary[i] = ary[i], ary[minj] +            count += 1 +    print((*ary)) +    print(count) -def selectionSort(ary): -    count = 0 -    for i in range(len(ary)): -        minj = i -        for j in range(i, len(ary)): -            if ary[minj] > ary[j]: -                minj = j -        if minj != i: -            ary[minj], ary[i] = ary[i], ary[minj] -            count += 1 -    return (ary, count) - - -result = selectionSort(numbers) -print((*result[0])) -print((result[1])) +n = int(eval(input())) +selection_sort(list(map(int, input().split())), n)