def selectionSort(lst, n):
    cnt = 0
    for i in range(0, n):
        minj = i
        for j in range(i, n):
            if lst[j] < lst[minj]:
                minj = j

        if i != minj:
            tmp = lst[i]
            lst[i] = lst[minj]
            lst[minj] = tmp
            cnt += 1
    return (lst, cnt)


if __name__ == "__main__":
    n = int(input())
    lst = [int(n) for n in input().split()]
    result, cnt = selectionSort(lst, n)
    print(" ".join(str(n) for n in result))
    print(cnt) def selectionSort(lst, n):
    cnt = 0
    for i in range(0, n):
        minj = i
        for j in range(i, n):
            if lst[j] < lst[minj]:
                minj = j

        if i != minj:
            tmp = lst[i]
            lst[i] = lst[minj]
            lst[minj] = tmp
            cnt += 1
    return (lst, cnt) selectionSort cnt = 0 cnt 0 for i in range(0, n):
        minj = i
        for j in range(i, n):
            if lst[j] < lst[minj]:
                minj = j

        if i != minj:
            tmp = lst[i]
            lst[i] = lst[minj]
            lst[minj] = tmp
            cnt += 1
     i range(0, n) range 0 n minj = i minj i for j in range(i, n):
            if lst[j] < lst[minj]:
                minj = j

         j range(i, n) range i n if lst[j] < lst[minj]:
                minj = j

         lst[j] < lst[minj] lst[j] lst j lst[minj] lst minj minj = j minj j if i != minj:
            tmp = lst[i]
            lst[i] = lst[minj]
            lst[minj] = tmp
            cnt += 1
     i != minj i minj tmp = lst[i] tmp lst[i] lst i lst[i] = lst[minj] lst[i] lst i lst[minj] lst minj lst[minj] = tmp lst[minj] lst minj tmp cnt += 1 cnt 1 return (lst, cnt) (lst, cnt) lst cnt lst lst n n if __name__ == "__main__":
    n = int(input())
    lst = [int(n) for n in input().split()]
    result, cnt = selectionSort(lst, n)
    print(" ".join(str(n) for n in result))
    print(cnt) __name__ == "__main__" __name__ "__main__" n = int(input()) n int(input()) int input() input int(n) for n in input().split() for n in input().split() n input().split() ().split () input split for n in input().split() int(n) int n lst = [int(n) for n in input().split()] lst [int(n) for n in input().split()] result, cnt = selectionSort(lst, n) result selectionSort(lst, n) selectionSort lst n cnt print(" ".join(str(n) for n in result)) print " ".join(str(n) for n in result) " ".join " " join str(n) str n print(cnt) print cnt n = int(input()) int(input()) n cnt = selectionSort(lst, n) selectionSort(lst, n) cnt result, cnt = selectionSort(lst, n) selectionSort(lst, n) result lst = [int(n) for n in input().split()] [int(n) for n in input().split()] lst def selectionSort(lst, n):
    cnt = 0
    for i in range(0, n):
        minj = i
        for j in range(i, n):
            if lst[j] < lst[minj]:
                minj = j

        if i != minj:
            tmp = lst[i]
            lst[i] = lst[minj]
            lst[minj] = tmp
            cnt += 1
    return (lst, cnt) def selectionSort(lst, n):
    cnt = 0
    for i in range(0, n):
        minj = i
        for j in range(i, n):
            if lst[j] < lst[minj]:
                minj = j

        if i != minj:
            tmp = lst[i]
            lst[i] = lst[minj]
            lst[minj] = tmp
            cnt += 1
    return (lst, cnt) selectionSort
def selectionSort(lst, n):
    cnt = 0
    for i in range(0, n):
        minj = i
        for j in range(i, n):
            if lst[j] < lst[minj]:
                minj = j

        if i != minj:
            tmp = lst[i]
            lst[i] = lst[minj]
            lst[minj] = tmp
            cnt += 1
    return (lst, cnt)


if __name__ == "__main__":
    n = int(input())
    lst = [int(n) for n in input().split()]
    result, cnt = selectionSort(lst, n)
    print(" ".join(str(n) for n in result))
    print(cnt)