#!/usr/bin/env python


def selectionSort(line, size):
    """Rerutn sorted list.

    >>> selectionSort([1, 2, 3, 4], 4)
    ([1, 2, 3, 4], 0)

    >>> selectionSort([5,6,4,2,1,3], 6)
    ([1, 2, 3, 4, 5, 6], 4)
    """
    count = 0
    for i in range(0, size):
        minj = i
        for j in range(i, size):
            if line[j] < line[minj]:
                minj = j
        if line[i] != line[minj]:
            tmp = line[i]
            line[i] = line[minj]
            line[minj] = tmp
            count += 1
    return line, count


def main():
    size = int(input())
    line = list(map(int, input().split()))
    ans_list, count = selectionSort(line, size)
    ans = " ".join(map(str, ans_list))
    print(ans)
    print(count)


if __name__ == '__main__':
    import doctest
    doctest.testmod()
    main() def selectionSort(line, size):
    """Rerutn sorted list.

    >>> selectionSort([1, 2, 3, 4], 4)
    ([1, 2, 3, 4], 0)

    >>> selectionSort([5,6,4,2,1,3], 6)
    ([1, 2, 3, 4, 5, 6], 4)
    """
    count = 0
    for i in range(0, size):
        minj = i
        for j in range(i, size):
            if line[j] < line[minj]:
                minj = j
        if line[i] != line[minj]:
            tmp = line[i]
            line[i] = line[minj]
            line[minj] = tmp
            count += 1
    return line, count selectionSort """Rerutn sorted list.

    >>> selectionSort([1, 2, 3, 4], 4)
    ([1, 2, 3, 4], 0)

    >>> selectionSort([5,6,4,2,1,3], 6)
    ([1, 2, 3, 4, 5, 6], 4)
    """ count = 0 count 0 for i in range(0, size):
        minj = i
        for j in range(i, size):
            if line[j] < line[minj]:
                minj = j
        if line[i] != line[minj]:
            tmp = line[i]
            line[i] = line[minj]
            line[minj] = tmp
            count += 1
     i range(0, size) range 0 size minj = i minj i for j in range(i, size):
            if line[j] < line[minj]:
                minj = j
         j range(i, size) range i size if line[j] < line[minj]:
                minj = j
         line[j] < line[minj] line[j] line j line[minj] line minj minj = j minj j if line[i] != line[minj]:
            tmp = line[i]
            line[i] = line[minj]
            line[minj] = tmp
            count += 1
     line[i] != line[minj] line[i] line i line[minj] line minj tmp = line[i] tmp line[i] line i line[i] = line[minj] line[i] line i line[minj] line minj line[minj] = tmp line[minj] line minj tmp count += 1 count 1 return line, count return line, count line count line line size size def main():
    size = int(input())
    line = list(map(int, input().split()))
    ans_list, count = selectionSort(line, size)
    ans = " ".join(map(str, ans_list))
    print(ans)
    print(count) main size = int(input()) size int(input()) int input() input line = list(map(int, input().split())) line list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split ans_list, count = selectionSort(line, size) ans_list selectionSort(line, size) selectionSort line size count ans = " ".join(map(str, ans_list)) ans " ".join(map(str, ans_list)) " ".join " " join map(str, ans_list) map str ans_list print(ans) print ans print(count) print count if __name__ == '__main__':
    import doctest
    doctest.testmod()
    main() __name__ == '__main__' __name__ '__main__' import doctest doctest doctest.testmod() doctest.testmod doctest testmod main() main def selectionSort(line, size):
    """Rerutn sorted list.

    >>> selectionSort([1, 2, 3, 4], 4)
    ([1, 2, 3, 4], 0)

    >>> selectionSort([5,6,4,2,1,3], 6)
    ([1, 2, 3, 4, 5, 6], 4)
    """
    count = 0
    for i in range(0, size):
        minj = i
        for j in range(i, size):
            if line[j] < line[minj]:
                minj = j
        if line[i] != line[minj]:
            tmp = line[i]
            line[i] = line[minj]
            line[minj] = tmp
            count += 1
    return line, count def selectionSort(line, size):
    """Rerutn sorted list.

    >>> selectionSort([1, 2, 3, 4], 4)
    ([1, 2, 3, 4], 0)

    >>> selectionSort([5,6,4,2,1,3], 6)
    ([1, 2, 3, 4, 5, 6], 4)
    """
    count = 0
    for i in range(0, size):
        minj = i
        for j in range(i, size):
            if line[j] < line[minj]:
                minj = j
        if line[i] != line[minj]:
            tmp = line[i]
            line[i] = line[minj]
            line[minj] = tmp
            count += 1
    return line, count selectionSort def main():
    size = int(input())
    line = list(map(int, input().split()))
    ans_list, count = selectionSort(line, size)
    ans = " ".join(map(str, ans_list))
    print(ans)
    print(count) def main():
    size = int(input())
    line = list(map(int, input().split()))
    ans_list, count = selectionSort(line, size)
    ans = " ".join(map(str, ans_list))
    print(ans)
    print(count) main
#!/usr/bin/env python


def selectionSort(line, size):
    """Rerutn sorted list.

    >>> selectionSort([1, 2, 3, 4], 4)
    ([1, 2, 3, 4], 0)

    >>> selectionSort([5,6,4,2,1,3], 6)
    ([1, 2, 3, 4, 5, 6], 4)
    """
    count = 0
    for i in range(0, size):
        minj = i
        for j in range(i, size):
            if line[j] < line[minj]:
                minj = j
        if line[i] != line[minj]:
            tmp = line[i]
            line[i] = line[minj]
            line[minj] = tmp
            count += 1
    return line, count


def main():
    size = int(input())
    line = list(map(int, input().split()))
    ans_list, count = selectionSort(line, size)
    ans = " ".join(map(str, ans_list))
    print(ans)
    print(count)


if __name__ == '__main__':
    import doctest
    doctest.testmod()
    main()