from typing import List


def selection_sort(A: List[int]) -> int:
    cnt = 0
    for i in range(len(A)):
        min_j = i
        for j in range(i, len(A)):
            if A[j] < A[min_j]:
                min_j = j
        if min_j != i:
            cnt += 1
        A[i], A[min_j] = A[min_j], A[i]
    return cnt


N = int(input())
A = [int(i) for i in input().split()]
cnt = selection_sort(A)
print(' '.join(map(str, A)))
print(cnt) from typing import List def selection_sort(A: List[int]) -> int:
    cnt = 0
    for i in range(len(A)):
        min_j = i
        for j in range(i, len(A)):
            if A[j] < A[min_j]:
                min_j = j
        if min_j != i:
            cnt += 1
        A[i], A[min_j] = A[min_j], A[i]
    return cnt selection_sort cnt = 0 cnt 0 for i in range(len(A)):
        min_j = i
        for j in range(i, len(A)):
            if A[j] < A[min_j]:
                min_j = j
        if min_j != i:
            cnt += 1
        A[i], A[min_j] = A[min_j], A[i]
     i range(len(A)) range len(A) len A min_j = i min_j i for j in range(i, len(A)):
            if A[j] < A[min_j]:
                min_j = j
         j range(i, len(A)) range i len(A) len A if A[j] < A[min_j]:
                min_j = j
         A[j] < A[min_j] A[j] A j A[min_j] A min_j min_j = j min_j j if min_j != i:
            cnt += 1
         min_j != i min_j i cnt += 1 cnt 1 A[i], A[min_j] = A[min_j], A[i] A[i] A i A[min_j] A min_j A[min_j] A min_j A[i] A i return cnt cnt A: List[int] A 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 A = [int(i) for i in input().split()] A [int(i) for i in input().split()] cnt = selection_sort(A) cnt selection_sort(A) selection_sort A print(' '.join(map(str, A))) print ' '.join(map(str, A)) ' '.join ' ' join map(str, A) map str A print(cnt) print cnt def selection_sort(A: List[int]) -> int:
    cnt = 0
    for i in range(len(A)):
        min_j = i
        for j in range(i, len(A)):
            if A[j] < A[min_j]:
                min_j = j
        if min_j != i:
            cnt += 1
        A[i], A[min_j] = A[min_j], A[i]
    return cnt def selection_sort(A: List[int]) -> int:
    cnt = 0
    for i in range(len(A)):
        min_j = i
        for j in range(i, len(A)):
            if A[j] < A[min_j]:
                min_j = j
        if min_j != i:
            cnt += 1
        A[i], A[min_j] = A[min_j], A[i]
    return cnt selection_sort A = [int(i) for i in input().split()] [int(i) for i in input().split()] A N = int(input()) int(input()) N cnt = selection_sort(A) selection_sort(A) cnt
from typing import List


def selection_sort(A: List[int]) -> int:
    cnt = 0
    for i in range(len(A)):
        min_j = i
        for j in range(i, len(A)):
            if A[j] < A[min_j]:
                min_j = j
        if min_j != i:
            cnt += 1
        A[i], A[min_j] = A[min_j], A[i]
    return cnt


N = int(input())
A = [int(i) for i in input().split()]
cnt = selection_sort(A)
print(' '.join(map(str, A)))
print(cnt)
