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

def SelectionSort(N, A):
    cnt = 0
    for i in range(N):
        min_i = i
        for j in range(i, N):
            if A[j] < A[min_i]:
                min_i = j
        if i != min_i:
            A[i], A[min_i] = A[min_i], A[i]
            cnt += 1
    return A, cnt
    
res = SelectionSort(N, A)
print(" ".join(map(str, res[0])))
print(res[1]) 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()] def SelectionSort(N, A):
    cnt = 0
    for i in range(N):
        min_i = i
        for j in range(i, N):
            if A[j] < A[min_i]:
                min_i = j
        if i != min_i:
            A[i], A[min_i] = A[min_i], A[i]
            cnt += 1
    return A, cnt
     SelectionSort cnt = 0 cnt 0 for i in range(N):
        min_i = i
        for j in range(i, N):
            if A[j] < A[min_i]:
                min_i = j
        if i != min_i:
            A[i], A[min_i] = A[min_i], A[i]
            cnt += 1
     i range(N) range N min_i = i min_i i for j in range(i, N):
            if A[j] < A[min_i]:
                min_i = j
         j range(i, N) range i N if A[j] < A[min_i]:
                min_i = j
         A[j] < A[min_i] A[j] A j A[min_i] A min_i min_i = j min_i j if i != min_i:
            A[i], A[min_i] = A[min_i], A[i]
            cnt += 1
     i != min_i i min_i A[i], A[min_i] = A[min_i], A[i] A[i] A i A[min_i] A min_i A[min_i] A min_i A[i] A i cnt += 1 cnt 1 return A, cnt return A, cnt A cnt N N A A res = SelectionSort(N, A) res SelectionSort(N, A) SelectionSort N A print(" ".join(map(str, res[0]))) print " ".join(map(str, res[0])) " ".join " " join map(str, res[0]) map str res[0] res 0 print(res[1]) print res[1] res 1 A = [int(i) for i in input().split()] [int(i) for i in input().split()] A def SelectionSort(N, A):
    cnt = 0
    for i in range(N):
        min_i = i
        for j in range(i, N):
            if A[j] < A[min_i]:
                min_i = j
        if i != min_i:
            A[i], A[min_i] = A[min_i], A[i]
            cnt += 1
    return A, cnt
     def SelectionSort(N, A):
    cnt = 0
    for i in range(N):
        min_i = i
        for j in range(i, N):
            if A[j] < A[min_i]:
                min_i = j
        if i != min_i:
            A[i], A[min_i] = A[min_i], A[i]
            cnt += 1
    return A, cnt
     SelectionSort res = SelectionSort(N, A) SelectionSort(N, A) res N = int(input()) int(input()) N
N = int(input())
A = [int(i) for i in input().split()]

def SelectionSort(N, A):
    cnt = 0
    for i in range(N):
        min_i = i
        for j in range(i, N):
            if A[j] < A[min_i]:
                min_i = j
        if i != min_i:
            A[i], A[min_i] = A[min_i], A[i]
            cnt += 1
    return A, cnt
    
res = SelectionSort(N, A)
print(" ".join(map(str, res[0])))
print(res[1])