# inputList = list(map(int, '''6
# 5 6 4 2 1 3'''.split()))
# N = inputList.pop(0)


def formatting(nums):
    for i in range(len(nums)):
        if i != len(nums) - 1:
            print(nums[i], end=' ')
        else:
            print(nums[i])


def selectionSort(A, N):
    count = 0
    for i in range(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

    formatting(A)
    print(count)



N = int(input())
inputList = list(map(int, input().split()))

selectionSort(inputList, N)
 def formatting(nums):
    for i in range(len(nums)):
        if i != len(nums) - 1:
            print(nums[i], end=' ')
        else:
            print(nums[i]) formatting for i in range(len(nums)):
        if i != len(nums) - 1:
            print(nums[i], end=' ')
        else:
            print(nums[i]) i range(len(nums)) range len(nums) len nums if i != len(nums) - 1:
            print(nums[i], end=' ')
        else:
            print(nums[i]) i != len(nums) - 1 i len(nums) - 1 len(nums) len nums 1 print(nums[i], end=' ') print nums[i] nums i end=' ' end ' ' print(nums[i]) print nums[i] nums i nums nums def selectionSort(A, N):
    count = 0
    for i in range(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

    formatting(A)
    print(count) selectionSort count = 0 count 0 for i in range(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

     i range(N - 1) range N - 1 N 1 minJ = i minJ i for j in range(i, N):
            if A[j] < A[minJ]:
                minJ = j

         j range(i, N) range i N if A[j] < A[minJ]:
                minJ = j

         A[j] < A[minJ] A[j] A j A[minJ] A minJ minJ = j minJ j if i != minJ:
            A[i], A[minJ] = A[minJ], A[i]
            count += 1

     i != minJ i minJ A[i], A[minJ] = A[minJ], A[i] A[i] A i A[minJ] A minJ A[minJ] A minJ A[i] A i count += 1 count 1 formatting(A) formatting A print(count) print count A A N N N = int(input()) N int(input()) int input() input inputList = list(map(int, input().split())) inputList list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split selectionSort(inputList, N) selectionSort inputList N def formatting(nums):
    for i in range(len(nums)):
        if i != len(nums) - 1:
            print(nums[i], end=' ')
        else:
            print(nums[i]) def formatting(nums):
    for i in range(len(nums)):
        if i != len(nums) - 1:
            print(nums[i], end=' ')
        else:
            print(nums[i]) formatting N = int(input()) int(input()) N def selectionSort(A, N):
    count = 0
    for i in range(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

    formatting(A)
    print(count) def selectionSort(A, N):
    count = 0
    for i in range(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

    formatting(A)
    print(count) selectionSort inputList = list(map(int, input().split())) list(map(int, input().split())) inputList
# inputList = list(map(int, '''6
# 5 6 4 2 1 3'''.split()))
# N = inputList.pop(0)


def formatting(nums):
    for i in range(len(nums)):
        if i != len(nums) - 1:
            print(nums[i], end=' ')
        else:
            print(nums[i])


def selectionSort(A, N):
    count = 0
    for i in range(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

    formatting(A)
    print(count)



N = int(input())
inputList = list(map(int, input().split()))

selectionSort(inputList, N)

