# -*- coding: utf-8 -*-

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

def main():
    input_num = int(input())
    input_list = [int(i) for i in input().split()]

    ans_list, count = selection_sort(input_list, input_num)
    for i in range(input_num):
        if i != 0:
            print(" ", end="")
        print(ans_list[i], end='')
    print()
    print(count)

if __name__ == '__main__':
    main() def selection_sort(a, n):
    count = 0
    for i in range(n):
        minj = i
        for j in range(i+1, n):
            if a[j] < a[minj]:
                minj = j
        a[i], a[minj] = a[minj], a[i]
        if a[i] != a[minj]:
            count += 1
    return a, count selection_sort count = 0 count 0 for i in range(n):
        minj = i
        for j in range(i+1, n):
            if a[j] < a[minj]:
                minj = j
        a[i], a[minj] = a[minj], a[i]
        if a[i] != a[minj]:
            count += 1
     i range(n) range n minj = i minj i for j in range(i+1, n):
            if a[j] < a[minj]:
                minj = j
         j range(i+1, n) range i+1 i 1 n if a[j] < a[minj]:
                minj = j
         a[j] < a[minj] a[j] a j a[minj] a minj minj = j minj j a[i], a[minj] = a[minj], a[i] a[i] a i a[minj] a minj a[minj] a minj a[i] a i if a[i] != a[minj]:
            count += 1
     a[i] != a[minj] a[i] a i a[minj] a minj count += 1 count 1 return a, count return a, count a count a a n n def main():
    input_num = int(input())
    input_list = [int(i) for i in input().split()]

    ans_list, count = selection_sort(input_list, input_num)
    for i in range(input_num):
        if i != 0:
            print(" ", end="")
        print(ans_list[i], end='')
    print()
    print(count) main input_num = int(input()) input_num int(input()) int input() input int(i) for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() int(i) int i input_list = [int(i) for i in input().split()] input_list [int(i) for i in input().split()] ans_list, count = selection_sort(input_list, input_num) ans_list selection_sort(input_list, input_num) selection_sort input_list input_num count for i in range(input_num):
        if i != 0:
            print(" ", end="")
        print(ans_list[i], end='')
     i range(input_num) range input_num if i != 0:
            print(" ", end="")
         i != 0 i 0 print(" ", end="") print " " end="" end "" print(ans_list[i], end='') print ans_list[i] ans_list i end='' end '' print() print print(count) print count if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    input_num = int(input())
    input_list = [int(i) for i in input().split()]

    ans_list, count = selection_sort(input_list, input_num)
    for i in range(input_num):
        if i != 0:
            print(" ", end="")
        print(ans_list[i], end='')
    print()
    print(count) def main():
    input_num = int(input())
    input_list = [int(i) for i in input().split()]

    ans_list, count = selection_sort(input_list, input_num)
    for i in range(input_num):
        if i != 0:
            print(" ", end="")
        print(ans_list[i], end='')
    print()
    print(count) main def selection_sort(a, n):
    count = 0
    for i in range(n):
        minj = i
        for j in range(i+1, n):
            if a[j] < a[minj]:
                minj = j
        a[i], a[minj] = a[minj], a[i]
        if a[i] != a[minj]:
            count += 1
    return a, count def selection_sort(a, n):
    count = 0
    for i in range(n):
        minj = i
        for j in range(i+1, n):
            if a[j] < a[minj]:
                minj = j
        a[i], a[minj] = a[minj], a[i]
        if a[i] != a[minj]:
            count += 1
    return a, count selection_sort
# -*- coding: utf-8 -*-

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

def main():
    input_num = int(input())
    input_list = [int(i) for i in input().split()]

    ans_list, count = selection_sort(input_list, input_num)
    for i in range(input_num):
        if i != 0:
            print(" ", end="")
        print(ans_list[i], end='')
    print()
    print(count)

if __name__ == '__main__':
    main()