n = int(eval(input()))

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

c = 0

for i in range(n):

    minj = i

    for j in range(i,n):

        if A[j] < A[minj]:

            minj = j

    if minj != i:

        t = A[i]

        A[i] = A[minj]

        A[minj] = t

        c += 1

	

print((" ".join(map(str,A))))

print(c)
def selectionSort(a):

    count = 0

    for i in range(len(a)):

        mini = i

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

            if a[j] < a[mini]:

                mini = j

        if i != mini:

            ret = a[i]

            a[i] = a[mini]

            a[mini] = ret

            count += 1

    print((" ".join(map(str,a))))

    print(count)

n = int(eval(input()))

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

selectionSort(a)
n = int(eval(input()))
A = list(map(int, input().split()))
c = 0
for i in range(n):
    minj = i
    for j in range(i, n):
        if A[j] < A[minj]:
            minj = j
    if minj != i:
        t = A[i]
        A[i] = A[minj]
        A[minj] = t
        c += 1
print((" ".join(map(str, A))))
print(c)

def selectionSort(a):
    count = 0
    for i in range(len(a)):
        mini = i
        for j in range(i, len(a)):
            if a[j] < a[mini]:
                mini = j
        if i != mini:
            ret = a[i]
            a[i] = a[mini]
            a[mini] = ret
            count += 1
    print((" ".join(map(str, a))))
    print(count)


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

+def selectionSort(a): +    count = 0 +    for i in range(len(a)): +        mini = i +        for j in range(i, len(a)): +            if a[j] < a[mini]: +                mini = j +        if i != mini: +            ret = a[i] +            a[i] = a[mini] +            a[mini] = ret +            count += 1 +    print((" ".join(map(str, a)))) +    print(count) + + -A = list(map(int, input().split())) -c = 0 -for i in range(n): -    minj = i -    for j in range(i, n): -        if A[j] < A[minj]: -            minj = j -    if minj != i: -        t = A[i] -        A[i] = A[minj] -        A[minj] = t -        c += 1 -print((" ".join(map(str, A)))) -print(c) +a = list(map(int, input().split())) +selectionSort(a)