def main():

    N = int(eval(input()))

    A = list(map(int, input().split(' ')))



    A, count = selectionSort(A, N)



    print((' '.join([str(a) for a in A])))

    print(count)



def selectionSort(A, N):

    count = 0



    for i in range(0, N-1):

        minj = i



        for j in range(i, N):

            if A[j] < A[minj]:

                minj = j



        if i != minj:

            A[i], A[minj] = A[minj], A[i]

            count += 1



    return A, count



if __name__ == '__main__':

    main()
def selection_sort(nums, n):

    c = 0



    for i in range(n):

        minj = i



        for j in range(i, n):

            if nums[j] < nums[minj]:

                minj = j



        if i != minj:

            nums[i], nums[minj] = nums[minj], nums[i]

            c += 1



    return (c, nums)



def main():

    n = int(eval(input()))

    nums = [int(x) for x in input().split()]



    c, nums = selection_sort(nums, n)



    print((" ".join([str(x) for x in nums])))

    print(c)



if __name__ == '__main__':

    main()



def main():
    N = int(eval(input()))
    A = list(map(int, input().split(" ")))
    A, count = selectionSort(A, N)
    print((" ".join([str(a) for a in A])))
    print(count)


def selectionSort(A, N):
    count = 0
    for i in range(0, N - 1):
        minj = i
        for j in range(i, N):
            if A[j] < A[minj]:
                minj = j
        if i != minj:
            A[i], A[minj] = A[minj], A[i]
            count += 1
    return A, count


if __name__ == "__main__":
    main()

def selection_sort(nums, n):
    c = 0
    for i in range(n):
        minj = i
        for j in range(i, n):
            if nums[j] < nums[minj]:
                minj = j
        if i != minj:
            nums[i], nums[minj] = nums[minj], nums[i]
            c += 1
    return (c, nums)


def main():
    n = int(eval(input()))
    nums = [int(x) for x in input().split()]
    c, nums = selection_sort(nums, n)
    print((" ".join([str(x) for x in nums])))
    print(c)


if __name__ == "__main__":
    main()

-def main(): -    N = int(eval(input())) -    A = list(map(int, input().split(" "))) -    A, count = selectionSort(A, N) -    print((" ".join([str(a) for a in A]))) -    print(count) +def selection_sort(nums, n): +    c = 0 +    for i in range(n): +        minj = i +        for j in range(i, n): +            if nums[j] < nums[minj]: +                minj = j +        if i != minj: +            nums[i], nums[minj] = nums[minj], nums[i] +            c += 1 +    return (c, nums) -def selectionSort(A, N): -    count = 0 -    for i in range(0, N - 1): -        minj = i -        for j in range(i, N): -            if A[j] < A[minj]: -                minj = j -        if i != minj: -            A[i], A[minj] = A[minj], A[i] -            count += 1 -    return A, count +def main(): +    n = int(eval(input())) +    nums = [int(x) for x in input().split()] +    c, nums = selection_sort(nums, n) +    print((" ".join([str(x) for x in nums]))) +    print(c)