import sys

def swap(a, i, j):
    tmp = a[j]
    a[j] = a[i]
    a[i] = tmp

def list_to_string(a):
    s = ""
    for n in a:
        s += str(n) + " "
    return s.strip()

num = int(sys.stdin.readline().strip())

array = map(lambda x: int(x), sys.stdin.readline().strip().split(" "))

swap_num = 0

for start_index in range(0, len(array)):
    min_index = start_index
    for index in range(start_index, len(array)):
        if array[min_index] > array[index]:
            min_index = index
    if min_index != start_index:
        swap(array, min_index, start_index)
        swap_num += 1
        

print list_to_string(array)
print str(swap_num) import sys sys def swap(a, i, j):
    tmp = a[j]
    a[j] = a[i]
    a[i] = tmp swap tmp = a[j] tmp a[j] a j a[j] = a[i] a[j] a j a[i] a i a[i] = tmp a[i] a i tmp a a i i j j def list_to_string(a):
    s = ""
    for n in a:
        s += str(n) + " "
    return s.strip() list_to_string s = "" s "" for n in a:
        s += str(n) + " "
     n a s += str(n) + " " s str(n) + " " str(n) str n " " return s.strip() s.strip() s.strip s strip a a num = int(sys.stdin.readline().strip()) num int(sys.stdin.readline().strip()) int sys.stdin.readline().strip() sys.stdin.readline().strip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline strip array = map(lambda x: int(x), sys.stdin.readline().strip().split(" ")) array map(lambda x: int(x), sys.stdin.readline().strip().split(" ")) map lambda x: int(x) int(x) int x x sys.stdin.readline().strip().split(" ") sys.stdin.readline().strip().split sys.stdin.readline().strip() sys.stdin.readline().strip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline strip split " " swap_num = 0 swap_num 0 for start_index in range(0, len(array)):
    min_index = start_index
    for index in range(start_index, len(array)):
        if array[min_index] > array[index]:
            min_index = index
    if min_index != start_index:
        swap(array, min_index, start_index)
        swap_num += 1
         start_index range(0, len(array)) range 0 len(array) len array min_index = start_index min_index start_index for index in range(start_index, len(array)):
        if array[min_index] > array[index]:
            min_index = index
     index range(start_index, len(array)) range start_index len(array) len array if array[min_index] > array[index]:
            min_index = index
     array[min_index] > array[index] array[min_index] array min_index array[index] array index min_index = index min_index index if min_index != start_index:
        swap(array, min_index, start_index)
        swap_num += 1
         min_index != start_index min_index start_index swap(array, min_index, start_index) swap array min_index start_index swap_num += 1 swap_num 1 print list_to_string(array) list_to_string array print str(swap_num) str swap_num def list_to_string(a):
    s = ""
    for n in a:
        s += str(n) + " "
    return s.strip() def list_to_string(a):
    s = ""
    for n in a:
        s += str(n) + " "
    return s.strip() list_to_string swap_num += 1 1 swap_num min_index = start_index start_index min_index num = int(sys.stdin.readline().strip()) int(sys.stdin.readline().strip()) num array = map(lambda x: int(x), sys.stdin.readline().strip().split(" ")) map(lambda x: int(x), sys.stdin.readline().strip().split(" ")) array swap_num = 0 0 swap_num def swap(a, i, j):
    tmp = a[j]
    a[j] = a[i]
    a[i] = tmp def swap(a, i, j):
    tmp = a[j]
    a[j] = a[i]
    a[i] = tmp swap min_index = index index min_index
import sys

def swap(a, i, j):
    tmp = a[j]
    a[j] = a[i]
    a[i] = tmp

def list_to_string(a):
    s = ""
    for n in a:
        s += str(n) + " "
    return s.strip()

num = int(sys.stdin.readline().strip())

array = map(lambda x: int(x), sys.stdin.readline().strip().split(" "))

swap_num = 0

for start_index in range(0, len(array)):
    min_index = start_index
    for index in range(start_index, len(array)):
        if array[min_index] > array[index]:
            min_index = index
    if min_index != start_index:
        swap(array, min_index, start_index)
        swap_num += 1
        

print list_to_string(array)
print str(swap_num)