
def selsort(array):
    counter = 0
    for i in range(len(array)):
        minnum = i
        for c in range(i,len(array)):
            if array[c] < array[minnum]:
                minnum = c
        if minnum != i:
            x = array[i]
            array[i] = array[minnum]
            array[minnum] = x
            counter = counter + 1
    array.append(counter)

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

selsort(arr)
print(' '.join([str(i) for i in arr[:-1]]))
print(arr[-1]) def selsort(array):
    counter = 0
    for i in range(len(array)):
        minnum = i
        for c in range(i,len(array)):
            if array[c] < array[minnum]:
                minnum = c
        if minnum != i:
            x = array[i]
            array[i] = array[minnum]
            array[minnum] = x
            counter = counter + 1
    array.append(counter) selsort counter = 0 counter 0 for i in range(len(array)):
        minnum = i
        for c in range(i,len(array)):
            if array[c] < array[minnum]:
                minnum = c
        if minnum != i:
            x = array[i]
            array[i] = array[minnum]
            array[minnum] = x
            counter = counter + 1
     i range(len(array)) range len(array) len array minnum = i minnum i for c in range(i,len(array)):
            if array[c] < array[minnum]:
                minnum = c
         c range(i,len(array)) range i len(array) len array if array[c] < array[minnum]:
                minnum = c
         array[c] < array[minnum] array[c] array c array[minnum] array minnum minnum = c minnum c if minnum != i:
            x = array[i]
            array[i] = array[minnum]
            array[minnum] = x
            counter = counter + 1
     minnum != i minnum i x = array[i] x array[i] array i array[i] = array[minnum] array[i] array i array[minnum] array minnum array[minnum] = x array[minnum] array minnum x counter = counter + 1 counter counter + 1 counter 1 array.append(counter) array.append array append counter array array 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 arr = [int(i) for i in input().split()] arr [int(i) for i in input().split()] selsort(arr) selsort arr str(i) for i in arr[:-1] for i in arr[:-1] i arr[:-1] arr :-1 -1 for i in arr[:-1] str(i) str i print(' '.join([str(i) for i in arr[:-1]])) print ' '.join([str(i) for i in arr[:-1]]) ' '.join ' ' join [str(i) for i in arr[:-1]] print(arr[-1]) print arr[-1] arr -1 def selsort(array):
    counter = 0
    for i in range(len(array)):
        minnum = i
        for c in range(i,len(array)):
            if array[c] < array[minnum]:
                minnum = c
        if minnum != i:
            x = array[i]
            array[i] = array[minnum]
            array[minnum] = x
            counter = counter + 1
    array.append(counter) def selsort(array):
    counter = 0
    for i in range(len(array)):
        minnum = i
        for c in range(i,len(array)):
            if array[c] < array[minnum]:
                minnum = c
        if minnum != i:
            x = array[i]
            array[i] = array[minnum]
            array[minnum] = x
            counter = counter + 1
    array.append(counter) selsort N = int(input()) int(input()) N arr = [int(i) for i in input().split()] [int(i) for i in input().split()] arr

def selsort(array):
    counter = 0
    for i in range(len(array)):
        minnum = i
        for c in range(i,len(array)):
            if array[c] < array[minnum]:
                minnum = c
        if minnum != i:
            x = array[i]
            array[i] = array[minnum]
            array[minnum] = x
            counter = counter + 1
    array.append(counter)

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

selsort(arr)
print(' '.join([str(i) for i in arr[:-1]]))
print(arr[-1])