# -*- coding: utf 8 -*-
# Selection Sort
# 2019. 4/22

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

    return A, sw

if __name__ == "__main__":
    N = int(input())
    A = list(map(int, input().split()))

    A_sorted, sw = selectionSort(A, N)

    for i in range(0, N - 1):
        print(A[i], end=" ")
    print(A[N - 1])
    print(sw)
 def selectionSort(A, N):
    sw = 0
    for i in range(0, int(N) - 1):
        minj = i
        for j in range(i, int(N)):
            if A[j] < A[minj]:
                minj = j
        A[i], A[minj] = A[minj], A[i]
        if minj != i:
            sw = sw + 1

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

     i range(0, int(N) - 1) range 0 int(N) - 1 int(N) int N 1 minj = i minj i for j in range(i, int(N)):
            if A[j] < A[minj]:
                minj = j
         j range(i, int(N)) range i int(N) int N if A[j] < A[minj]:
                minj = j
         A[j] < A[minj] A[j] A j A[minj] A minj minj = j minj j A[i], A[minj] = A[minj], A[i] A[i] A i A[minj] A minj A[minj] A minj A[i] A i if minj != i:
            sw = sw + 1

     minj != i minj i sw = sw + 1 sw sw + 1 sw 1 return A, sw return A, sw A sw A A N N if __name__ == "__main__":
    N = int(input())
    A = list(map(int, input().split()))

    A_sorted, sw = selectionSort(A, N)

    for i in range(0, N - 1):
        print(A[i], end=" ")
    print(A[N - 1])
    print(sw) __name__ == "__main__" __name__ "__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_sorted, sw = selectionSort(A, N) A_sorted selectionSort(A, N) selectionSort A N sw for i in range(0, N - 1):
        print(A[i], end=" ")
     i range(0, N - 1) range 0 N - 1 N 1 print(A[i], end=" ") print A[i] A i end=" " end " " print(A[N - 1]) print A[N - 1] A N - 1 N 1 print(sw) print sw def selectionSort(A, N):
    sw = 0
    for i in range(0, int(N) - 1):
        minj = i
        for j in range(i, int(N)):
            if A[j] < A[minj]:
                minj = j
        A[i], A[minj] = A[minj], A[i]
        if minj != i:
            sw = sw + 1

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

    return A, sw selectionSort N = int(input()) int(input()) N A = list(map(int, input().split())) list(map(int, input().split())) A sw = selectionSort(A, N) selectionSort(A, N) sw A_sorted, sw = selectionSort(A, N) selectionSort(A, N) A_sorted
# -*- coding: utf 8 -*-
# Selection Sort
# 2019. 4/22

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

    return A, sw

if __name__ == "__main__":
    N = int(input())
    A = list(map(int, input().split()))

    A_sorted, sw = selectionSort(A, N)

    for i in range(0, N - 1):
        print(A[i], end=" ")
    print(A[N - 1])
    print(sw)

