def SelectionSort(A, n):
    sw = 0
    for i in xrange(n):
        minj = i
        for j in xrange(i, n):
            if A[j] < A[minj]:
                minj = j
        temp = A[minj]
        A[minj] = A[i]
        A[i] = temp
        if i != minj:
            sw += 1
    return sw

def printArray(A, n):
    for i in xrange(n):
        if i < n-1:
            print A[i],
        else:
            print A[i]

n = input()
arr = map(int, raw_input().split())
cnt = SelectionSort(arr, n)
printArray(arr, n) 
print cnt def SelectionSort(A, n):
    sw = 0
    for i in xrange(n):
        minj = i
        for j in xrange(i, n):
            if A[j] < A[minj]:
                minj = j
        temp = A[minj]
        A[minj] = A[i]
        A[i] = temp
        if i != minj:
            sw += 1
    return sw SelectionSort sw = 0 sw 0 for i in xrange(n):
        minj = i
        for j in xrange(i, n):
            if A[j] < A[minj]:
                minj = j
        temp = A[minj]
        A[minj] = A[i]
        A[i] = temp
        if i != minj:
            sw += 1
     i xrange(n) xrange n minj = i minj i for j in xrange(i, n):
            if A[j] < A[minj]:
                minj = j
         j xrange(i, n) xrange i n if A[j] < A[minj]:
                minj = j
         A[j] < A[minj] A[j] A j A[minj] A minj minj = j minj j temp = A[minj] temp A[minj] A minj A[minj] = A[i] A[minj] A minj A[i] A i A[i] = temp A[i] A i temp if i != minj:
            sw += 1
     i != minj i minj sw += 1 sw 1 return sw sw A A n n def printArray(A, n):
    for i in xrange(n):
        if i < n-1:
            print A[i],
        else:
            print A[i] printArray for i in xrange(n):
        if i < n-1:
            print A[i],
        else:
            print A[i] i xrange(n) xrange n if i < n-1:
            print A[i],
        else:
            print A[i] i < n-1 i n-1 n 1 print A[i] A i print A[i] A i A A n n n = input() n input() input arr = map(int, raw_input().split()) arr map(int, raw_input().split()) map int raw_input().split() ().split () raw_input split cnt = SelectionSort(arr, n) cnt SelectionSort(arr, n) SelectionSort arr n printArray(arr, n) printArray arr n print def SelectionSort(A, n):
    sw = 0
    for i in xrange(n):
        minj = i
        for j in xrange(i, n):
            if A[j] < A[minj]:
                minj = j
        temp = A[minj]
        A[minj] = A[i]
        A[i] = temp
        if i != minj:
            sw += 1
    return sw def SelectionSort(A, n):
    sw = 0
    for i in xrange(n):
        minj = i
        for j in xrange(i, n):
            if A[j] < A[minj]:
                minj = j
        temp = A[minj]
        A[minj] = A[i]
        A[i] = temp
        if i != minj:
            sw += 1
    return sw SelectionSort def printArray(A, n):
    for i in xrange(n):
        if i < n-1:
            print A[i],
        else:
            print A[i] def printArray(A, n):
    for i in xrange(n):
        if i < n-1:
            print A[i],
        else:
            print A[i] printArray n = input() input() n cnt = SelectionSort(arr, n) SelectionSort(arr, n) cnt arr = map(int, raw_input().split()) map(int, raw_input().split()) arr
def SelectionSort(A, n):
    sw = 0
    for i in xrange(n):
        minj = i
        for j in xrange(i, n):
            if A[j] < A[minj]:
                minj = j
        temp = A[minj]
        A[minj] = A[i]
        A[i] = temp
        if i != minj:
            sw += 1
    return sw

def printArray(A, n):
    for i in xrange(n):
        if i < n-1:
            print A[i],
        else:
            print A[i]

n = input()
arr = map(int, raw_input().split())
cnt = SelectionSort(arr, n)
printArray(arr, n) 
print cnt