def selection_sort(array):
    count_swap = 0
    for i in range(len(array)):
        minj = i
        for j in range(i + 1,len(array)):
            if array[j] < array[minj]:
                minj = j
        if array[minj] is not array[i]:
            tmp = array[minj]
            array[minj] = array[i]
            array[i] = tmp
            count_swap += 1
    return count_swap


def print_array(array):
     print(str(array)[1:-1].replace(', ', ' '))


def main():
    N = int(input())
    array = [int(s) for s in input().split(' ')]
    count = selection_sort(array)
    print_array(array)
    print(count)

if __name__ == '__main__':
    main() def selection_sort(array):
    count_swap = 0
    for i in range(len(array)):
        minj = i
        for j in range(i + 1,len(array)):
            if array[j] < array[minj]:
                minj = j
        if array[minj] is not array[i]:
            tmp = array[minj]
            array[minj] = array[i]
            array[i] = tmp
            count_swap += 1
    return count_swap selection_sort count_swap = 0 count_swap 0 for i in range(len(array)):
        minj = i
        for j in range(i + 1,len(array)):
            if array[j] < array[minj]:
                minj = j
        if array[minj] is not array[i]:
            tmp = array[minj]
            array[minj] = array[i]
            array[i] = tmp
            count_swap += 1
     i range(len(array)) range len(array) len array minj = i minj i for j in range(i + 1,len(array)):
            if array[j] < array[minj]:
                minj = j
         j range(i + 1,len(array)) range i + 1 i 1 len(array) len array if array[j] < array[minj]:
                minj = j
         array[j] < array[minj] array[j] array j array[minj] array minj minj = j minj j if array[minj] is not array[i]:
            tmp = array[minj]
            array[minj] = array[i]
            array[i] = tmp
            count_swap += 1
     array[minj] is not array[i] array[minj] array minj array[i] array i tmp = array[minj] tmp array[minj] array minj array[minj] = array[i] array[minj] array minj array[i] array i array[i] = tmp array[i] array i tmp count_swap += 1 count_swap 1 return count_swap count_swap array array def print_array(array):
     print(str(array)[1:-1].replace(', ', ' ')) print_array print(str(array)[1:-1].replace(', ', ' ')) print str(array)[1:-1].replace(', ', ' ') [1:-1].replace [1:-1] (array) str array 1:-1 1 -1 replace ', ' ' ' array array def main():
    N = int(input())
    array = [int(s) for s in input().split(' ')]
    count = selection_sort(array)
    print_array(array)
    print(count) main N = int(input()) N int(input()) int input() input int(s) for s in input().split(' ') for s in input().split(' ') s input().split(' ') ().split () input split ' ' for s in input().split(' ') int(s) int s array = [int(s) for s in input().split(' ')] array [int(s) for s in input().split(' ')] count = selection_sort(array) count selection_sort(array) selection_sort array print_array(array) print_array array print(count) print count if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    N = int(input())
    array = [int(s) for s in input().split(' ')]
    count = selection_sort(array)
    print_array(array)
    print(count) def main():
    N = int(input())
    array = [int(s) for s in input().split(' ')]
    count = selection_sort(array)
    print_array(array)
    print(count) main def print_array(array):
     print(str(array)[1:-1].replace(', ', ' ')) def print_array(array):
     print(str(array)[1:-1].replace(', ', ' ')) print_array def selection_sort(array):
    count_swap = 0
    for i in range(len(array)):
        minj = i
        for j in range(i + 1,len(array)):
            if array[j] < array[minj]:
                minj = j
        if array[minj] is not array[i]:
            tmp = array[minj]
            array[minj] = array[i]
            array[i] = tmp
            count_swap += 1
    return count_swap def selection_sort(array):
    count_swap = 0
    for i in range(len(array)):
        minj = i
        for j in range(i + 1,len(array)):
            if array[j] < array[minj]:
                minj = j
        if array[minj] is not array[i]:
            tmp = array[minj]
            array[minj] = array[i]
            array[i] = tmp
            count_swap += 1
    return count_swap selection_sort
def selection_sort(array):
    count_swap = 0
    for i in range(len(array)):
        minj = i
        for j in range(i + 1,len(array)):
            if array[j] < array[minj]:
                minj = j
        if array[minj] is not array[i]:
            tmp = array[minj]
            array[minj] = array[i]
            array[i] = tmp
            count_swap += 1
    return count_swap


def print_array(array):
     print(str(array)[1:-1].replace(', ', ' '))


def main():
    N = int(input())
    array = [int(s) for s in input().split(' ')]
    count = selection_sort(array)
    print_array(array)
    print(count)

if __name__ == '__main__':
    main()