def main():
    N = int(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 main():
    N = int(input())
    A = list(map(int, input().split(' ')))

    A, count = selectionSort(A, N)

    print(' '.join([str(a) for a in A]))
    print(count) main N = int(input()) N int(input()) int input() input A = list(map(int, input().split(' '))) A list(map(int, input().split(' '))) list map(int, input().split(' ')) map int input().split(' ') ().split () input split ' ' A, count = selectionSort(A, N) A selectionSort(A, N) selectionSort A N count str(a) for a in A for a in A a A for a in A str(a) str a print(' '.join([str(a) for a in A])) print ' '.join([str(a) for a in A]) ' '.join ' ' join [str(a) for a in A] print(count) 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 selectionSort count = 0 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

     i range(0, N-1) range 0 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 return A, count return A, count A count A A N N if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    N = int(input())
    A = list(map(int, input().split(' ')))

    A, count = selectionSort(A, N)

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

    A, count = selectionSort(A, N)

    print(' '.join([str(a) for a in A]))
    print(count) main 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 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 selectionSort
def main():
    N = int(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()