def selection_sort(num_list):
    list_length = len(num_list)
    cnt = 0
    
    for i in range(list_length):
        min_element = i
        for j in range(i+1,list_length):
            if num_list[j] < num_list[min_element]:
                min_element = j
        if i != min_element:
            num_list[i],num_list[min_element] = num_list[min_element],num_list[i]
            cnt += 1
    return num_list,cnt

n = int(input())
num_list = list(map(int,input().split()))
ans_list,cnt = selection_sort(num_list)
str_ans_list = [str(i) for i in ans_list]
print('{}\n{}'.format(' '.join(str_ans_list),cnt)) def selection_sort(num_list):
    list_length = len(num_list)
    cnt = 0
    
    for i in range(list_length):
        min_element = i
        for j in range(i+1,list_length):
            if num_list[j] < num_list[min_element]:
                min_element = j
        if i != min_element:
            num_list[i],num_list[min_element] = num_list[min_element],num_list[i]
            cnt += 1
    return num_list,cnt selection_sort list_length = len(num_list) list_length len(num_list) len num_list cnt = 0 cnt 0 for i in range(list_length):
        min_element = i
        for j in range(i+1,list_length):
            if num_list[j] < num_list[min_element]:
                min_element = j
        if i != min_element:
            num_list[i],num_list[min_element] = num_list[min_element],num_list[i]
            cnt += 1
     i range(list_length) range list_length min_element = i min_element i for j in range(i+1,list_length):
            if num_list[j] < num_list[min_element]:
                min_element = j
         j range(i+1,list_length) range i+1 i 1 list_length if num_list[j] < num_list[min_element]:
                min_element = j
         num_list[j] < num_list[min_element] num_list[j] num_list j num_list[min_element] num_list min_element min_element = j min_element j if i != min_element:
            num_list[i],num_list[min_element] = num_list[min_element],num_list[i]
            cnt += 1
     i != min_element i min_element num_list[i],num_list[min_element] = num_list[min_element],num_list[i] num_list[i] num_list i num_list[min_element] num_list min_element num_list[min_element] num_list min_element num_list[i] num_list i cnt += 1 cnt 1 return num_list,cnt return num_list,cnt num_list cnt num_list num_list n = int(input()) n int(input()) int input() input num_list = list(map(int,input().split())) num_list list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split ans_list,cnt = selection_sort(num_list) ans_list selection_sort(num_list) selection_sort num_list cnt str(i) for i in ans_list for i in ans_list i ans_list for i in ans_list str(i) str i str_ans_list = [str(i) for i in ans_list] str_ans_list [str(i) for i in ans_list] print('{}\n{}'.format(' '.join(str_ans_list),cnt)) print '{}\n{}'.format(' '.join(str_ans_list),cnt) '{}\n{}'.format '{}\n{}' format ' '.join(str_ans_list) ' '.join ' ' join str_ans_list cnt cnt = selection_sort(num_list) selection_sort(num_list) cnt str_ans_list = [str(i) for i in ans_list] [str(i) for i in ans_list] str_ans_list def selection_sort(num_list):
    list_length = len(num_list)
    cnt = 0
    
    for i in range(list_length):
        min_element = i
        for j in range(i+1,list_length):
            if num_list[j] < num_list[min_element]:
                min_element = j
        if i != min_element:
            num_list[i],num_list[min_element] = num_list[min_element],num_list[i]
            cnt += 1
    return num_list,cnt def selection_sort(num_list):
    list_length = len(num_list)
    cnt = 0
    
    for i in range(list_length):
        min_element = i
        for j in range(i+1,list_length):
            if num_list[j] < num_list[min_element]:
                min_element = j
        if i != min_element:
            num_list[i],num_list[min_element] = num_list[min_element],num_list[i]
            cnt += 1
    return num_list,cnt selection_sort n = int(input()) int(input()) n ans_list,cnt = selection_sort(num_list) selection_sort(num_list) ans_list num_list = list(map(int,input().split())) list(map(int,input().split())) num_list
def selection_sort(num_list):
    list_length = len(num_list)
    cnt = 0
    
    for i in range(list_length):
        min_element = i
        for j in range(i+1,list_length):
            if num_list[j] < num_list[min_element]:
                min_element = j
        if i != min_element:
            num_list[i],num_list[min_element] = num_list[min_element],num_list[i]
            cnt += 1
    return num_list,cnt

n = int(input())
num_list = list(map(int,input().split()))
ans_list,cnt = selection_sort(num_list)
str_ans_list = [str(i) for i in ans_list]
print('{}\n{}'.format(' '.join(str_ans_list),cnt))
