def show(array):
    for i in range(len(array)):
        if i != len(array) - 1:
            print(array[i], end=' ')
        else:
            print(array[i])


def selectionSort(array):
    count = 0 
    for i in range(len(array)):
        minj = i 
        flag = False
        for j in range(i, len(array)):
            if array[j] < array[minj]:
                minj = j 
                flag = True
        if flag and i != minj:
            array[i], array[minj] = [array[minj], array[i]]
            count += 1
    
    show(array)
    print(count)
    

input()
array = [int(x) for x in input().split()]
selectionSort(array)

 def show(array):
    for i in range(len(array)):
        if i != len(array) - 1:
            print(array[i], end=' ')
        else:
            print(array[i]) show for i in range(len(array)):
        if i != len(array) - 1:
            print(array[i], end=' ')
        else:
            print(array[i]) i range(len(array)) range len(array) len array if i != len(array) - 1:
            print(array[i], end=' ')
        else:
            print(array[i]) i != len(array) - 1 i len(array) - 1 len(array) len array 1 print(array[i], end=' ') print array[i] array i end=' ' end ' ' print(array[i]) print array[i] array i array array def selectionSort(array):
    count = 0 
    for i in range(len(array)):
        minj = i 
        flag = False
        for j in range(i, len(array)):
            if array[j] < array[minj]:
                minj = j 
                flag = True
        if flag and i != minj:
            array[i], array[minj] = [array[minj], array[i]]
            count += 1
    
    show(array)
    print(count)
     selectionSort count = 0 count 0 for i in range(len(array)):
        minj = i 
        flag = False
        for j in range(i, len(array)):
            if array[j] < array[minj]:
                minj = j 
                flag = True
        if flag and i != minj:
            array[i], array[minj] = [array[minj], array[i]]
            count += 1
    
     i range(len(array)) range len(array) len array minj = i minj i flag = False flag False for j in range(i, len(array)):
            if array[j] < array[minj]:
                minj = j 
                flag = True
         j range(i, len(array)) range i len(array) len array if array[j] < array[minj]:
                minj = j 
                flag = True
         array[j] < array[minj] array[j] array j array[minj] array minj minj = j minj j flag = True flag True if flag and i != minj:
            array[i], array[minj] = [array[minj], array[i]]
            count += 1
    
     flag and i != minj flag i != minj i minj array[i], array[minj] = [array[minj], array[i]] array[i] array i [array[minj], array[i]] array[minj] array minj array[i] array i array[minj] array minj count += 1 count 1 show(array) show array print(count) print count array array 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 array = [int(x) for x in input().split()] array [int(x) for x in input().split()] selectionSort(array) selectionSort array def selectionSort(array):
    count = 0 
    for i in range(len(array)):
        minj = i 
        flag = False
        for j in range(i, len(array)):
            if array[j] < array[minj]:
                minj = j 
                flag = True
        if flag and i != minj:
            array[i], array[minj] = [array[minj], array[i]]
            count += 1
    
    show(array)
    print(count)
     def selectionSort(array):
    count = 0 
    for i in range(len(array)):
        minj = i 
        flag = False
        for j in range(i, len(array)):
            if array[j] < array[minj]:
                minj = j 
                flag = True
        if flag and i != minj:
            array[i], array[minj] = [array[minj], array[i]]
            count += 1
    
    show(array)
    print(count)
     selectionSort def show(array):
    for i in range(len(array)):
        if i != len(array) - 1:
            print(array[i], end=' ')
        else:
            print(array[i]) def show(array):
    for i in range(len(array)):
        if i != len(array) - 1:
            print(array[i], end=' ')
        else:
            print(array[i]) show array = [int(x) for x in input().split()] [int(x) for x in input().split()] array
def show(array):
    for i in range(len(array)):
        if i != len(array) - 1:
            print(array[i], end=' ')
        else:
            print(array[i])


def selectionSort(array):
    count = 0 
    for i in range(len(array)):
        minj = i 
        flag = False
        for j in range(i, len(array)):
            if array[j] < array[minj]:
                minj = j 
                flag = True
        if flag and i != minj:
            array[i], array[minj] = [array[minj], array[i]]
            count += 1
    
    show(array)
    print(count)
    

input()
array = [int(x) for x in input().split()]
selectionSort(array)


