def main():
    N = int(input())
    A = tuple(map(int, input().split()))

    a = list(A)
    ans, n = selectionSort(a, N)
    print(*ans, sep=' ')
    print(n)

def selectionSort(a, n):
    k = 0
    for i in range(n - 1):
        minj = i
        for j in range(i + 1, n):
            if a[j] < a[minj]:
                minj = j
        a[i], a[minj] = a[minj], a[i]
        if a[i] != a[minj]:
            k += 1
    return a, k

main() def main():
    N = int(input())
    A = tuple(map(int, input().split()))

    a = list(A)
    ans, n = selectionSort(a, N)
    print(*ans, sep=' ')
    print(n) main N = int(input()) N int(input()) int input() input A = tuple(map(int, input().split())) A tuple(map(int, input().split())) tuple map(int, input().split()) map int input().split() ().split () input split a = list(A) a list(A) list A ans, n = selectionSort(a, N) ans selectionSort(a, N) selectionSort a N n print(*ans, sep=' ') print *ans ans sep=' ' sep ' ' print(n) print n def selectionSort(a, n):
    k = 0
    for i in range(n - 1):
        minj = i
        for j in range(i + 1, n):
            if a[j] < a[minj]:
                minj = j
        a[i], a[minj] = a[minj], a[i]
        if a[i] != a[minj]:
            k += 1
    return a, k selectionSort k = 0 k 0 for i in range(n - 1):
        minj = i
        for j in range(i + 1, n):
            if a[j] < a[minj]:
                minj = j
        a[i], a[minj] = a[minj], a[i]
        if a[i] != a[minj]:
            k += 1
     i range(n - 1) range n - 1 n 1 minj = i minj i for j in range(i + 1, n):
            if a[j] < a[minj]:
                minj = j
         j range(i + 1, n) range i + 1 i 1 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 a[i] != a[minj]:
            k += 1
     a[i] != a[minj] a[i] a i a[minj] a minj k += 1 k 1 return a, k return a, k a k a a n n main() main def main():
    N = int(input())
    A = tuple(map(int, input().split()))

    a = list(A)
    ans, n = selectionSort(a, N)
    print(*ans, sep=' ')
    print(n) def main():
    N = int(input())
    A = tuple(map(int, input().split()))

    a = list(A)
    ans, n = selectionSort(a, N)
    print(*ans, sep=' ')
    print(n) main def selectionSort(a, n):
    k = 0
    for i in range(n - 1):
        minj = i
        for j in range(i + 1, n):
            if a[j] < a[minj]:
                minj = j
        a[i], a[minj] = a[minj], a[i]
        if a[i] != a[minj]:
            k += 1
    return a, k def selectionSort(a, n):
    k = 0
    for i in range(n - 1):
        minj = i
        for j in range(i + 1, n):
            if a[j] < a[minj]:
                minj = j
        a[i], a[minj] = a[minj], a[i]
        if a[i] != a[minj]:
            k += 1
    return a, k selectionSort
def main():
    N = int(input())
    A = tuple(map(int, input().split()))

    a = list(A)
    ans, n = selectionSort(a, N)
    print(*ans, sep=' ')
    print(n)

def selectionSort(a, n):
    k = 0
    for i in range(n - 1):
        minj = i
        for j in range(i + 1, n):
            if a[j] < a[minj]:
                minj = j
        a[i], a[minj] = a[minj], a[i]
        if a[i] != a[minj]:
            k += 1
    return a, k

main()