def selection_sort(a, n):
    counter = 0
    for i in range(n):
        minj = i
        for j in range(i, n):
            if a[j] < a[minj]:
                minj = j
        if i != minj:
            counter += 1
            tmp = a[i]
            a[i] = a[minj]
            a[minj] = tmp
    return counter


def print_list_split_whitespace(a):
    for x in a[:-1]:
        print(x, end=' ')
    print(a[-1])


n = int(input())
a = input().split()
for i in range(n):
    a[i] = int(a[i])

counter = selection_sort(a, n)
print_list_split_whitespace(a)
print(counter) def selection_sort(a, n):
    counter = 0
    for i in range(n):
        minj = i
        for j in range(i, n):
            if a[j] < a[minj]:
                minj = j
        if i != minj:
            counter += 1
            tmp = a[i]
            a[i] = a[minj]
            a[minj] = tmp
    return counter selection_sort counter = 0 counter 0 for i in range(n):
        minj = i
        for j in range(i, n):
            if a[j] < a[minj]:
                minj = j
        if i != minj:
            counter += 1
            tmp = a[i]
            a[i] = a[minj]
            a[minj] = tmp
     i range(n) range n minj = i minj i for j in range(i, n):
            if a[j] < a[minj]:
                minj = j
         j range(i, n) range i n if a[j] < a[minj]:
                minj = j
         a[j] < a[minj] a[j] a j a[minj] a minj minj = j minj j if i != minj:
            counter += 1
            tmp = a[i]
            a[i] = a[minj]
            a[minj] = tmp
     i != minj i minj counter += 1 counter 1 tmp = a[i] tmp a[i] a i a[i] = a[minj] a[i] a i a[minj] a minj a[minj] = tmp a[minj] a minj tmp return counter counter a a n n def print_list_split_whitespace(a):
    for x in a[:-1]:
        print(x, end=' ')
    print(a[-1]) print_list_split_whitespace for x in a[:-1]:
        print(x, end=' ')
     x a[:-1] a :-1 -1 print(x, end=' ') print x end=' ' end ' ' print(a[-1]) print a[-1] a -1 a a n = int(input()) n int(input()) int input() input a = input().split() a input().split() ().split () input split for i in range(n):
    a[i] = int(a[i]) i range(n) range n a[i] = int(a[i]) a[i] a i int(a[i]) int a[i] a i counter = selection_sort(a, n) counter selection_sort(a, n) selection_sort a n print_list_split_whitespace(a) print_list_split_whitespace a print(counter) print counter n = int(input()) int(input()) n counter = selection_sort(a, n) selection_sort(a, n) counter def selection_sort(a, n):
    counter = 0
    for i in range(n):
        minj = i
        for j in range(i, n):
            if a[j] < a[minj]:
                minj = j
        if i != minj:
            counter += 1
            tmp = a[i]
            a[i] = a[minj]
            a[minj] = tmp
    return counter def selection_sort(a, n):
    counter = 0
    for i in range(n):
        minj = i
        for j in range(i, n):
            if a[j] < a[minj]:
                minj = j
        if i != minj:
            counter += 1
            tmp = a[i]
            a[i] = a[minj]
            a[minj] = tmp
    return counter selection_sort a = input().split() input().split() a def print_list_split_whitespace(a):
    for x in a[:-1]:
        print(x, end=' ')
    print(a[-1]) def print_list_split_whitespace(a):
    for x in a[:-1]:
        print(x, end=' ')
    print(a[-1]) print_list_split_whitespace
def selection_sort(a, n):
    counter = 0
    for i in range(n):
        minj = i
        for j in range(i, n):
            if a[j] < a[minj]:
                minj = j
        if i != minj:
            counter += 1
            tmp = a[i]
            a[i] = a[minj]
            a[minj] = tmp
    return counter


def print_list_split_whitespace(a):
    for x in a[:-1]:
        print(x, end=' ')
    print(a[-1])


n = int(input())
a = input().split()
for i in range(n):
    a[i] = int(a[i])

counter = selection_sort(a, n)
print_list_split_whitespace(a)
print(counter)
