def do_selection_sort(data, size):
    assert size == len(data), "data size error"
    swap_count = 0
    for i in range(size):
        minj = i
        for j in range(i, size):
            if data[j] < data[minj]:
                minj = j
        temp = data[i]
        data[i] = data[minj]
        data[minj] = temp
        if data[i] != data[minj]:
            swap_count += 1
    return swap_count


if __name__ == '__main__':
    # ??????????????\???
    num = int(input())
    data = [int(x) for x in input().split(' ')]
    #data = [5, 6, 4, 2, 1, 3]
    #data = [5, 2, 4, 6, 1, 3]

    # ???????????????
    result = do_selection_sort(data, num)

    # ???????????????
    print('{0}'.format(' '.join(map(str, data))))
    print('{0}'.format(result)) def do_selection_sort(data, size):
    assert size == len(data), "data size error"
    swap_count = 0
    for i in range(size):
        minj = i
        for j in range(i, size):
            if data[j] < data[minj]:
                minj = j
        temp = data[i]
        data[i] = data[minj]
        data[minj] = temp
        if data[i] != data[minj]:
            swap_count += 1
    return swap_count do_selection_sort assert size == len(data), "data size error" size == len(data) size len(data) len data "data size error" swap_count = 0 swap_count 0 for i in range(size):
        minj = i
        for j in range(i, size):
            if data[j] < data[minj]:
                minj = j
        temp = data[i]
        data[i] = data[minj]
        data[minj] = temp
        if data[i] != data[minj]:
            swap_count += 1
     i range(size) range size minj = i minj i for j in range(i, size):
            if data[j] < data[minj]:
                minj = j
         j range(i, size) range i size if data[j] < data[minj]:
                minj = j
         data[j] < data[minj] data[j] data j data[minj] data minj minj = j minj j temp = data[i] temp data[i] data i data[i] = data[minj] data[i] data i data[minj] data minj data[minj] = temp data[minj] data minj temp if data[i] != data[minj]:
            swap_count += 1
     data[i] != data[minj] data[i] data i data[minj] data minj swap_count += 1 swap_count 1 return swap_count swap_count data data size size if __name__ == '__main__':
    # ??????????????\???
    num = int(input())
    data = [int(x) for x in input().split(' ')]
    #data = [5, 6, 4, 2, 1, 3]
    #data = [5, 2, 4, 6, 1, 3]

    # ???????????????
    result = do_selection_sort(data, num)

    # ???????????????
    print('{0}'.format(' '.join(map(str, data))))
    print('{0}'.format(result)) __name__ == '__main__' __name__ '__main__' num = int(input()) num int(input()) int input() input int(x) for x in input().split(' ') for x in input().split(' ') x input().split(' ') ().split () input split ' ' for x in input().split(' ') int(x) int x data = [int(x) for x in input().split(' ')] data [int(x) for x in input().split(' ')] result = do_selection_sort(data, num) result do_selection_sort(data, num) do_selection_sort data num print('{0}'.format(' '.join(map(str, data)))) print '{0}'.format(' '.join(map(str, data))) '{0}'.format '{0}' format ' '.join(map(str, data)) ' '.join ' ' join map(str, data) map str data print('{0}'.format(result)) print '{0}'.format(result) '{0}'.format '{0}' format result def do_selection_sort(data, size):
    assert size == len(data), "data size error"
    swap_count = 0
    for i in range(size):
        minj = i
        for j in range(i, size):
            if data[j] < data[minj]:
                minj = j
        temp = data[i]
        data[i] = data[minj]
        data[minj] = temp
        if data[i] != data[minj]:
            swap_count += 1
    return swap_count def do_selection_sort(data, size):
    assert size == len(data), "data size error"
    swap_count = 0
    for i in range(size):
        minj = i
        for j in range(i, size):
            if data[j] < data[minj]:
                minj = j
        temp = data[i]
        data[i] = data[minj]
        data[minj] = temp
        if data[i] != data[minj]:
            swap_count += 1
    return swap_count do_selection_sort num = int(input()) int(input()) num data = [int(x) for x in input().split(' ')] [int(x) for x in input().split(' ')] data result = do_selection_sort(data, num) do_selection_sort(data, num) result
def do_selection_sort(data, size):
    assert size == len(data), "data size error"
    swap_count = 0
    for i in range(size):
        minj = i
        for j in range(i, size):
            if data[j] < data[minj]:
                minj = j
        temp = data[i]
        data[i] = data[minj]
        data[minj] = temp
        if data[i] != data[minj]:
            swap_count += 1
    return swap_count


if __name__ == '__main__':
    # ??????????????\???
    num = int(input())
    data = [int(x) for x in input().split(' ')]
    #data = [5, 6, 4, 2, 1, 3]
    #data = [5, 2, 4, 6, 1, 3]

    # ???????????????
    result = do_selection_sort(data, num)

    # ???????????????
    print('{0}'.format(' '.join(map(str, data))))
    print('{0}'.format(result))