def sSort(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 minj != i:
            count += 1
        tmp = A[i]
        A[i] = A[minj]
        A[minj] = tmp
    return A, count

if __name__ == '__main__':
    length = input()
    data = [int(x) for x in input().split()]
    data_s, c = sSort(data)
    print (' '.join([str(x) for x in data_s]))
    print (c) def sSort(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 minj != i:
            count += 1
        tmp = A[i]
        A[i] = A[minj]
        A[minj] = tmp
    return A, count sSort 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 minj != i:
            count += 1
        tmp = A[i]
        A[i] = A[minj]
        A[minj] = tmp
     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 minj != i:
            count += 1
         minj != i minj i count += 1 count 1 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 return A, count return A, count A count A A if __name__ == '__main__':
    length = input()
    data = [int(x) for x in input().split()]
    data_s, c = sSort(data)
    print (' '.join([str(x) for x in data_s]))
    print (c) __name__ == '__main__' __name__ '__main__' length = input() length input() input int(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) int x data = [int(x) for x in input().split()] data [int(x) for x in input().split()] data_s, c = sSort(data) data_s sSort(data) sSort data c str(x) for x in data_s for x in data_s x data_s for x in data_s str(x) str x print (' '.join([str(x) for x in data_s])) print ' '.join([str(x) for x in data_s]) ' '.join ' ' join [str(x) for x in data_s] print (c) print c c = sSort(data) sSort(data) c data_s, c = sSort(data) sSort(data) data_s def sSort(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 minj != i:
            count += 1
        tmp = A[i]
        A[i] = A[minj]
        A[minj] = tmp
    return A, count def sSort(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 minj != i:
            count += 1
        tmp = A[i]
        A[i] = A[minj]
        A[minj] = tmp
    return A, count sSort length = input() input() length data = [int(x) for x in input().split()] [int(x) for x in input().split()] data
def sSort(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 minj != i:
            count += 1
        tmp = A[i]
        A[i] = A[minj]
        A[minj] = tmp
    return A, count

if __name__ == '__main__':
    length = input()
    data = [int(x) for x in input().split()]
    data_s, c = sSort(data)
    print (' '.join([str(x) for x in data_s]))
    print (c)
