# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_2_B&lang=jp
sample_input = list(range(3))
sample_input[0] = '''6
5 6 4 2 1 3'''
sample_input[1] = '''6
5 2 4 6 1 3'''
sample_input[2] = ''''''
give_sample_input = None
if give_sample_input is not None:
    sample_input_list = sample_input[give_sample_input].split('\n')
    def input():
        return sample_input_list.pop(0)
        
# main
def swap_list_item(lst, i, j):
    tmp = lst[i]
    lst[i] = lst[j]
    lst[j] = tmp

num_of_data = int(input())
data_list = list(map(int, input().split()))
swap_count = 0
for i in range(num_of_data):
    minj = i
    for j in range(i, num_of_data):
        if data_list[minj] > data_list[j]:
            minj = j
    if not minj == i:
        swap_list_item(data_list, i, minj)
        swap_count += 1

result = ''
for number in data_list:
    result += str(number) + ' '
print(result.strip())
print(swap_count) sample_input = list(range(3)) sample_input list(range(3)) list range(3) range 3 sample_input[0] = '''6
5 6 4 2 1 3''' sample_input[0] sample_input 0 '''6
5 6 4 2 1 3''' sample_input[1] = '''6
5 2 4 6 1 3''' sample_input[1] sample_input 1 '''6
5 2 4 6 1 3''' sample_input[2] = '''''' sample_input[2] sample_input 2 '''''' give_sample_input = None give_sample_input None if give_sample_input is not None:
    sample_input_list = sample_input[give_sample_input].split('\n')
    def input():
        return sample_input_list.pop(0)
        
# main give_sample_input is not None give_sample_input None sample_input_list = sample_input[give_sample_input].split('\n') sample_input_list sample_input[give_sample_input].split('\n') [give_sample_input].split [give_sample_input] sample_input give_sample_input split '\n' def input():
        return sample_input_list.pop(0)
        
# main input return sample_input_list.pop(0) sample_input_list.pop(0) sample_input_list.pop sample_input_list pop 0 def swap_list_item(lst, i, j):
    tmp = lst[i]
    lst[i] = lst[j]
    lst[j] = tmp swap_list_item tmp = lst[i] tmp lst[i] lst i lst[i] = lst[j] lst[i] lst i lst[j] lst j lst[j] = tmp lst[j] lst j tmp lst lst i i j j num_of_data = int(input()) num_of_data int(input()) int input() input data_list = list(map(int, input().split())) data_list list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split swap_count = 0 swap_count 0 for i in range(num_of_data):
    minj = i
    for j in range(i, num_of_data):
        if data_list[minj] > data_list[j]:
            minj = j
    if not minj == i:
        swap_list_item(data_list, i, minj)
        swap_count += 1 i range(num_of_data) range num_of_data minj = i minj i for j in range(i, num_of_data):
        if data_list[minj] > data_list[j]:
            minj = j
     j range(i, num_of_data) range i num_of_data if data_list[minj] > data_list[j]:
            minj = j
     data_list[minj] > data_list[j] data_list[minj] data_list minj data_list[j] data_list j minj = j minj j if not minj == i:
        swap_list_item(data_list, i, minj)
        swap_count += 1 not minj == i minj == i minj i swap_list_item(data_list, i, minj) swap_list_item data_list i minj swap_count += 1 swap_count 1 result = '' result '' for number in data_list:
    result += str(number) + ' ' number data_list result += str(number) + ' ' result str(number) + ' ' str(number) str number ' ' print(result.strip()) print result.strip() result.strip result strip print(swap_count) print swap_count give_sample_input = None None give_sample_input swap_count = 0 0 swap_count result += str(number) + ' ' str(number) + ' ' result sample_input_list = sample_input[give_sample_input].split('\n') sample_input[give_sample_input].split('\n') sample_input_list minj = j j minj swap_count += 1 1 swap_count num_of_data = int(input()) int(input()) num_of_data result = '' '' result def input():
        return sample_input_list.pop(0)
        
# main def input():
        return sample_input_list.pop(0)
        
# main input def swap_list_item(lst, i, j):
    tmp = lst[i]
    lst[i] = lst[j]
    lst[j] = tmp def swap_list_item(lst, i, j):
    tmp = lst[i]
    lst[i] = lst[j]
    lst[j] = tmp swap_list_item minj = i i minj sample_input = list(range(3)) list(range(3)) sample_input data_list = list(map(int, input().split())) list(map(int, input().split())) data_list
# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_2_B&lang=jp
sample_input = list(range(3))
sample_input[0] = '''6
5 6 4 2 1 3'''
sample_input[1] = '''6
5 2 4 6 1 3'''
sample_input[2] = ''''''
give_sample_input = None
if give_sample_input is not None:
    sample_input_list = sample_input[give_sample_input].split('\n')
    def input():
        return sample_input_list.pop(0)
        
# main
def swap_list_item(lst, i, j):
    tmp = lst[i]
    lst[i] = lst[j]
    lst[j] = tmp

num_of_data = int(input())
data_list = list(map(int, input().split()))
swap_count = 0
for i in range(num_of_data):
    minj = i
    for j in range(i, num_of_data):
        if data_list[minj] > data_list[j]:
            minj = j
    if not minj == i:
        swap_list_item(data_list, i, minj)
        swap_count += 1

result = ''
for number in data_list:
    result += str(number) + ' '
print(result.strip())
print(swap_count)