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