#coding:utf-8
n = int(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]) n = int(input()) n 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 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) selectionSort count = 0 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
     i range(len(ary)) range len(ary) len ary minj = i minj i for j in range(i, len(ary)):
            if ary[minj] > ary[j]:
                minj = j
         j range(i, len(ary)) range i len(ary) len ary if ary[minj] > ary[j]:
                minj = j
         ary[minj] > ary[j] ary[minj] ary minj ary[j] ary j minj = j minj j if minj != i:
            ary[minj], ary[i] = ary[i], ary[minj]
            count += 1
     minj != i minj i ary[minj], ary[i] = ary[i], ary[minj] ary[minj] ary minj ary[i] ary i ary[i] ary i ary[minj] ary minj count += 1 count 1 return (ary, count) (ary, count) ary count ary ary result = selectionSort(numbers) result selectionSort(numbers) selectionSort numbers print(*result[0]) print *result[0] result[0] result 0 print(result[1]) print result[1] result 1 result = selectionSort(numbers) selectionSort(numbers) result n = int(input()) int(input()) n numbers = list(map(int, input().split())) list(map(int, input().split())) numbers 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) 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) selectionSort
#coding:utf-8
n = int(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])