# -*- coding: utf-8 -*-


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

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

    return A, count

if __name__ == '__main__':

    N = int(input())
    A = [int(a) for a in input().split(" ")]

    A, count = selectionSort(A, N)
    print(" ".join(map(str, A)))
    print(count)
 def selectionSort(A, N):
    count = 0
        
    for i in range(N):
        minj = i
        for j in range(i, N):
            if A[j] < A[minj]:
                minj = j
        if minj != i:
            count += 1

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

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

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

     i range(N) range N 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 minj != i:
            count += 1

         minj != i minj i count += 1 count 1 A[i], A[minj] = A[minj], A[i] A[i] A i A[minj] A minj A[minj] A minj A[i] A i return A, count return A, count A count A A N N if __name__ == '__main__':

    N = int(input())
    A = [int(a) for a in input().split(" ")]

    A, count = selectionSort(A, N)
    print(" ".join(map(str, A)))
    print(count) __name__ == '__main__' __name__ '__main__' N = int(input()) N int(input()) int input() input int(a) for a in input().split(" ") for a in input().split(" ") a input().split(" ") ().split () input split " " for a in input().split(" ") int(a) int a A = [int(a) for a in input().split(" ")] A [int(a) for a in input().split(" ")] A, count = selectionSort(A, N) A selectionSort(A, N) selectionSort A N count print(" ".join(map(str, A))) print " ".join(map(str, A)) " ".join " " join map(str, A) map str A print(count) print count N = int(input()) int(input()) N A = [int(a) for a in input().split(" ")] [int(a) for a in input().split(" ")] A count = selectionSort(A, N) selectionSort(A, N) count def selectionSort(A, N):
    count = 0
        
    for i in range(N):
        minj = i
        for j in range(i, N):
            if A[j] < A[minj]:
                minj = j
        if minj != i:
            count += 1

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

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

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

    return A, count selectionSort A, count = selectionSort(A, N) selectionSort(A, N) A
# -*- coding: utf-8 -*-


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

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

    return A, count

if __name__ == '__main__':

    N = int(input())
    A = [int(a) for a in input().split(" ")]

    A, count = selectionSort(A, N)
    print(" ".join(map(str, A)))
    print(count)

