import sys

ERROR_INPUT = 'input is invalid'


def main():
    n = get_length()
    arr = get_array(length=n)

    sourtLi, count = selectionSort(li=arr, length=n)
    print(*sourtLi)
    print(count)
    return 0


def get_length():
    n = int(input())
    if n < 0 or n > 100:
        print(ERROR_INPUT)
        sys.exit(1)
    else:
        return n


def get_array(length):
    nums = input().split(' ')
    return [str2int(string=n) for n in nums]


def str2int(string):
    n = int(string)
    if n < 0 or n > 100:
        print(ERROR_INPUT)
        sys.exit(1)
    else:
        return n


def selectionSort(li, length):
    count = 0

    for i in range(0, length - 1):
        min_index = i
        for j in range(i, length):
            if li[j] < li[min_index]:
                min_index = j

        if i != min_index:
            li[i], li[min_index] = li[min_index], li[i]
            count += 1

    return li, count


main() import sys sys ERROR_INPUT = 'input is invalid' ERROR_INPUT 'input is invalid' def main():
    n = get_length()
    arr = get_array(length=n)

    sourtLi, count = selectionSort(li=arr, length=n)
    print(*sourtLi)
    print(count)
    return 0 main n = get_length() n get_length() get_length arr = get_array(length=n) arr get_array(length=n) get_array length=n length n sourtLi, count = selectionSort(li=arr, length=n) sourtLi selectionSort(li=arr, length=n) selectionSort li=arr li arr length=n length n count print(*sourtLi) print *sourtLi sourtLi print(count) print count return 0 0 def get_length():
    n = int(input())
    if n < 0 or n > 100:
        print(ERROR_INPUT)
        sys.exit(1)
    else:
        return n get_length n = int(input()) n int(input()) int input() input if n < 0 or n > 100:
        print(ERROR_INPUT)
        sys.exit(1)
    else:
        return n n < 0 or n > 100 n < 0 n 0 n > 100 n 100 print(ERROR_INPUT) print ERROR_INPUT sys.exit(1) sys.exit sys exit 1 return n n def get_array(length):
    nums = input().split(' ')
    return [str2int(string=n) for n in nums] get_array nums = input().split(' ') nums input().split(' ') ().split () input split ' ' str2int(string=n) for n in nums for n in nums n nums for n in nums str2int(string=n) str2int string=n string n return [str2int(string=n) for n in nums] [str2int(string=n) for n in nums] length length def str2int(string):
    n = int(string)
    if n < 0 or n > 100:
        print(ERROR_INPUT)
        sys.exit(1)
    else:
        return n str2int n = int(string) n int(string) int string if n < 0 or n > 100:
        print(ERROR_INPUT)
        sys.exit(1)
    else:
        return n n < 0 or n > 100 n < 0 n 0 n > 100 n 100 print(ERROR_INPUT) print ERROR_INPUT sys.exit(1) sys.exit sys exit 1 return n n string string def selectionSort(li, length):
    count = 0

    for i in range(0, length - 1):
        min_index = i
        for j in range(i, length):
            if li[j] < li[min_index]:
                min_index = j

        if i != min_index:
            li[i], li[min_index] = li[min_index], li[i]
            count += 1

    return li, count selectionSort count = 0 count 0 for i in range(0, length - 1):
        min_index = i
        for j in range(i, length):
            if li[j] < li[min_index]:
                min_index = j

        if i != min_index:
            li[i], li[min_index] = li[min_index], li[i]
            count += 1

     i range(0, length - 1) range 0 length - 1 length 1 min_index = i min_index i for j in range(i, length):
            if li[j] < li[min_index]:
                min_index = j

         j range(i, length) range i length if li[j] < li[min_index]:
                min_index = j

         li[j] < li[min_index] li[j] li j li[min_index] li min_index min_index = j min_index j if i != min_index:
            li[i], li[min_index] = li[min_index], li[i]
            count += 1

     i != min_index i min_index li[i], li[min_index] = li[min_index], li[i] li[i] li i li[min_index] li min_index li[min_index] li min_index li[i] li i count += 1 count 1 return li, count return li, count li count li li length length main() main def get_length():
    n = int(input())
    if n < 0 or n > 100:
        print(ERROR_INPUT)
        sys.exit(1)
    else:
        return n def get_length():
    n = int(input())
    if n < 0 or n > 100:
        print(ERROR_INPUT)
        sys.exit(1)
    else:
        return n get_length def get_array(length):
    nums = input().split(' ')
    return [str2int(string=n) for n in nums] def get_array(length):
    nums = input().split(' ')
    return [str2int(string=n) for n in nums] get_array ERROR_INPUT = 'input is invalid' 'input is invalid' ERROR_INPUT def main():
    n = get_length()
    arr = get_array(length=n)

    sourtLi, count = selectionSort(li=arr, length=n)
    print(*sourtLi)
    print(count)
    return 0 def main():
    n = get_length()
    arr = get_array(length=n)

    sourtLi, count = selectionSort(li=arr, length=n)
    print(*sourtLi)
    print(count)
    return 0 main def selectionSort(li, length):
    count = 0

    for i in range(0, length - 1):
        min_index = i
        for j in range(i, length):
            if li[j] < li[min_index]:
                min_index = j

        if i != min_index:
            li[i], li[min_index] = li[min_index], li[i]
            count += 1

    return li, count def selectionSort(li, length):
    count = 0

    for i in range(0, length - 1):
        min_index = i
        for j in range(i, length):
            if li[j] < li[min_index]:
                min_index = j

        if i != min_index:
            li[i], li[min_index] = li[min_index], li[i]
            count += 1

    return li, count selectionSort def str2int(string):
    n = int(string)
    if n < 0 or n > 100:
        print(ERROR_INPUT)
        sys.exit(1)
    else:
        return n def str2int(string):
    n = int(string)
    if n < 0 or n > 100:
        print(ERROR_INPUT)
        sys.exit(1)
    else:
        return n str2int
import sys

ERROR_INPUT = 'input is invalid'


def main():
    n = get_length()
    arr = get_array(length=n)

    sourtLi, count = selectionSort(li=arr, length=n)
    print(*sourtLi)
    print(count)
    return 0


def get_length():
    n = int(input())
    if n < 0 or n > 100:
        print(ERROR_INPUT)
        sys.exit(1)
    else:
        return n


def get_array(length):
    nums = input().split(' ')
    return [str2int(string=n) for n in nums]


def str2int(string):
    n = int(string)
    if n < 0 or n > 100:
        print(ERROR_INPUT)
        sys.exit(1)
    else:
        return n


def selectionSort(li, length):
    count = 0

    for i in range(0, length - 1):
        min_index = i
        for j in range(i, length):
            if li[j] < li[min_index]:
                min_index = j

        if i != min_index:
            li[i], li[min_index] = li[min_index], li[i]
            count += 1

    return li, count


main()