def main() :
    n = int(input())
    nums = [int(i) for i in input().split()]
    exchange_count = 0

    for i in range(n) :
        min_idx = nums[i:].index(min(nums[i:]))
        if nums[i] != nums[min_idx + i] :
            exchange_count += 1
        nums[i], nums[min_idx + i] = nums[min_idx + i], nums[i]

    print(" ".join(map(str, nums)))
    print(exchange_count)

if __name__ == '__main__' :
    main() def main() :
    n = int(input())
    nums = [int(i) for i in input().split()]
    exchange_count = 0

    for i in range(n) :
        min_idx = nums[i:].index(min(nums[i:]))
        if nums[i] != nums[min_idx + i] :
            exchange_count += 1
        nums[i], nums[min_idx + i] = nums[min_idx + i], nums[i]

    print(" ".join(map(str, nums)))
    print(exchange_count) main n = int(input()) n 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 nums = [int(i) for i in input().split()] nums [int(i) for i in input().split()] exchange_count = 0 exchange_count 0 for i in range(n) :
        min_idx = nums[i:].index(min(nums[i:]))
        if nums[i] != nums[min_idx + i] :
            exchange_count += 1
        nums[i], nums[min_idx + i] = nums[min_idx + i], nums[i]

     i range(n) range n min_idx = nums[i:].index(min(nums[i:])) min_idx nums[i:].index(min(nums[i:])) [i:].index [i:] nums i: i index min(nums[i:]) min nums[i:] nums i: i if nums[i] != nums[min_idx + i] :
            exchange_count += 1
         nums[i] != nums[min_idx + i] nums[i] nums i nums[min_idx + i] nums min_idx + i min_idx i exchange_count += 1 exchange_count 1 nums[i], nums[min_idx + i] = nums[min_idx + i], nums[i] nums[i] nums i nums[min_idx + i] nums min_idx + i min_idx i nums[min_idx + i] nums min_idx + i min_idx i nums[i] nums i print(" ".join(map(str, nums))) print " ".join(map(str, nums)) " ".join " " join map(str, nums) map str nums print(exchange_count) print exchange_count if __name__ == '__main__' :
    main() __name__ == '__main__' __name__ '__main__' main() main def main() :
    n = int(input())
    nums = [int(i) for i in input().split()]
    exchange_count = 0

    for i in range(n) :
        min_idx = nums[i:].index(min(nums[i:]))
        if nums[i] != nums[min_idx + i] :
            exchange_count += 1
        nums[i], nums[min_idx + i] = nums[min_idx + i], nums[i]

    print(" ".join(map(str, nums)))
    print(exchange_count) def main() :
    n = int(input())
    nums = [int(i) for i in input().split()]
    exchange_count = 0

    for i in range(n) :
        min_idx = nums[i:].index(min(nums[i:]))
        if nums[i] != nums[min_idx + i] :
            exchange_count += 1
        nums[i], nums[min_idx + i] = nums[min_idx + i], nums[i]

    print(" ".join(map(str, nums)))
    print(exchange_count) main
def main() :
    n = int(input())
    nums = [int(i) for i in input().split()]
    exchange_count = 0

    for i in range(n) :
        min_idx = nums[i:].index(min(nums[i:]))
        if nums[i] != nums[min_idx + i] :
            exchange_count += 1
        nums[i], nums[min_idx + i] = nums[min_idx + i], nums[i]

    print(" ".join(map(str, nums)))
    print(exchange_count)

if __name__ == '__main__' :
    main()