def select_sort(array):
    N = len(array)
    count = 0
    
    for i in range(N - 1):
        min_i = i + array[i:].index(min(array[i:]))
        if i != min_i:
            count += 1
        array[i], array[min_i] = array[min_i], array[i]
        
    return array, count

n = int(input())
array = [int(i) for i in input().split()]
result = select_sort(array)

print(*result[0])
print(result[1]) def select_sort(array):
    N = len(array)
    count = 0
    
    for i in range(N - 1):
        min_i = i + array[i:].index(min(array[i:]))
        if i != min_i:
            count += 1
        array[i], array[min_i] = array[min_i], array[i]
        
    return array, count select_sort N = len(array) N len(array) len array count = 0 count 0 for i in range(N - 1):
        min_i = i + array[i:].index(min(array[i:]))
        if i != min_i:
            count += 1
        array[i], array[min_i] = array[min_i], array[i]
        
     i range(N - 1) range N - 1 N 1 min_i = i + array[i:].index(min(array[i:])) min_i i + array[i:].index(min(array[i:])) i array[i:].index(min(array[i:])) [i:].index [i:] array i: i index min(array[i:]) min array[i:] array i: i if i != min_i:
            count += 1
         i != min_i i min_i count += 1 count 1 array[i], array[min_i] = array[min_i], array[i] array[i] array i array[min_i] array min_i array[min_i] array min_i array[i] array i return array, count return array, count array count 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 array = [int(i) for i in input().split()] array [int(i) for i in input().split()] result = select_sort(array) result select_sort(array) select_sort array print(*result[0]) print *result[0] result[0] result 0 print(result[1]) print result[1] result 1 def select_sort(array):
    N = len(array)
    count = 0
    
    for i in range(N - 1):
        min_i = i + array[i:].index(min(array[i:]))
        if i != min_i:
            count += 1
        array[i], array[min_i] = array[min_i], array[i]
        
    return array, count def select_sort(array):
    N = len(array)
    count = 0
    
    for i in range(N - 1):
        min_i = i + array[i:].index(min(array[i:]))
        if i != min_i:
            count += 1
        array[i], array[min_i] = array[min_i], array[i]
        
    return array, count select_sort n = int(input()) int(input()) n result = select_sort(array) select_sort(array) result array = [int(i) for i in input().split()] [int(i) for i in input().split()] array
def select_sort(array):
    N = len(array)
    count = 0
    
    for i in range(N - 1):
        min_i = i + array[i:].index(min(array[i:]))
        if i != min_i:
            count += 1
        array[i], array[min_i] = array[min_i], array[i]
        
    return array, count

n = int(input())
array = [int(i) for i in input().split()]
result = select_sort(array)

print(*result[0])
print(result[1])