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

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

A ,count = selectionSort(A)
print(' '.join([str(i) for i in A]))
print(count) 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(A):
    count = 0
    for i in range(len(A)):
        minj = i
        for j in range(i, len(A)):
            if A[j] < A[minj]:
                minj = j
        if i != minj:
            tmp = A[i]
            A[i] = A[minj]
            A[minj] = tmp
            count += 1
    return A, count selectionSort count = 0 count 0 for i in range(len(A)):
        minj = i
        for j in range(i, len(A)):
            if A[j] < A[minj]:
                minj = j
        if i != minj:
            tmp = A[i]
            A[i] = A[minj]
            A[minj] = tmp
            count += 1
     i range(len(A)) range len(A) len A minj = i minj i for j in range(i, len(A)):
            if A[j] < A[minj]:
                minj = j
         j range(i, len(A)) range i len(A) len A if A[j] < A[minj]:
                minj = j
         A[j] < A[minj] A[j] A j A[minj] A minj minj = j minj j if i != minj:
            tmp = A[i]
            A[i] = A[minj]
            A[minj] = tmp
            count += 1
     i != minj i minj tmp = A[i] tmp A[i] A i A[i] = A[minj] A[i] A i A[minj] A minj A[minj] = tmp A[minj] A minj tmp count += 1 count 1 return A, count return A, count A count A A A ,count = selectionSort(A) A selectionSort(A) selectionSort A count str(i) for i in A for i in A i A for i in A str(i) str i print(' '.join([str(i) for i in A])) print ' '.join([str(i) for i in A]) ' '.join ' ' join [str(i) for i in A] print(count) print count def selectionSort(A):
    count = 0
    for i in range(len(A)):
        minj = i
        for j in range(i, len(A)):
            if A[j] < A[minj]:
                minj = j
        if i != minj:
            tmp = A[i]
            A[i] = A[minj]
            A[minj] = tmp
            count += 1
    return A, count def selectionSort(A):
    count = 0
    for i in range(len(A)):
        minj = i
        for j in range(i, len(A)):
            if A[j] < A[minj]:
                minj = j
        if i != minj:
            tmp = A[i]
            A[i] = A[minj]
            A[minj] = tmp
            count += 1
    return A, count selectionSort A ,count = selectionSort(A) selectionSort(A) A count = selectionSort(A) selectionSort(A) count N = int(input()) int(input()) N A = [int(i) for i in input().split()] [int(i) for i in input().split()] A
N = int(input())
A = [int(i) for i in input().split()]

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

A ,count = selectionSort(A)
print(' '.join([str(i) for i in A]))
print(count)