# -*- coding:utf-8 -*-

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

def show_list(list):
    i = 0;
    while(i < len(list)-1):
        print(list[i], end=" ")
        i = i + 1
    print(list[i])

num = int(input())
num_list = [int(x) for i, x in enumerate(input().split()) if i < num]
num_swap, num_list = selection_sort(num_list)
show_list(num_list)
print(num_swap) def selection_sort(num_list):
    num_swap = 0
    for i in range(len(num_list)):
        mini = i
        for j in range(i, len(num_list)):
            if num_list[j] < num_list[mini]:
                mini = j
        if i != mini:
            num_list[i], num_list[mini] = num_list[mini], num_list[i]
            num_swap = num_swap + 1
    return num_swap, num_list selection_sort num_swap = 0 num_swap 0 for i in range(len(num_list)):
        mini = i
        for j in range(i, len(num_list)):
            if num_list[j] < num_list[mini]:
                mini = j
        if i != mini:
            num_list[i], num_list[mini] = num_list[mini], num_list[i]
            num_swap = num_swap + 1
     i range(len(num_list)) range len(num_list) len num_list mini = i mini i for j in range(i, len(num_list)):
            if num_list[j] < num_list[mini]:
                mini = j
         j range(i, len(num_list)) range i len(num_list) len num_list if num_list[j] < num_list[mini]:
                mini = j
         num_list[j] < num_list[mini] num_list[j] num_list j num_list[mini] num_list mini mini = j mini j if i != mini:
            num_list[i], num_list[mini] = num_list[mini], num_list[i]
            num_swap = num_swap + 1
     i != mini i mini num_list[i], num_list[mini] = num_list[mini], num_list[i] num_list[i] num_list i num_list[mini] num_list mini num_list[mini] num_list mini num_list[i] num_list i num_swap = num_swap + 1 num_swap num_swap + 1 num_swap 1 return num_swap, num_list return num_swap, num_list num_swap num_list num_list num_list def show_list(list):
    i = 0;
    while(i < len(list)-1):
        print(list[i], end=" ")
        i = i + 1
    print(list[i]) show_list i = 0 i 0 while(i < len(list)-1):
        print(list[i], end=" ")
        i = i + 1
     i < len(list)-1 i len(list)-1 len(list) len list 1 print(list[i], end=" ") print list[i] list i end=" " end " " i = i + 1 i i + 1 i 1 print(list[i]) print list[i] list i list list num = int(input()) num int(input()) int input() input int(x) for i, x in enumerate(input().split()) if i < num for i, x in enumerate(input().split()) if i < num i x enumerate(input().split()) enumerate input().split() ().split () input split i < num i num if i < num int(x) int x num_list = [int(x) for i, x in enumerate(input().split()) if i < num] num_list [int(x) for i, x in enumerate(input().split()) if i < num] num_swap, num_list = selection_sort(num_list) num_swap selection_sort(num_list) selection_sort num_list num_list show_list(num_list) show_list num_list print(num_swap) print num_swap num = int(input()) int(input()) num num_list = selection_sort(num_list) selection_sort(num_list) num_list def show_list(list):
    i = 0;
    while(i < len(list)-1):
        print(list[i], end=" ")
        i = i + 1
    print(list[i]) def show_list(list):
    i = 0;
    while(i < len(list)-1):
        print(list[i], end=" ")
        i = i + 1
    print(list[i]) show_list def selection_sort(num_list):
    num_swap = 0
    for i in range(len(num_list)):
        mini = i
        for j in range(i, len(num_list)):
            if num_list[j] < num_list[mini]:
                mini = j
        if i != mini:
            num_list[i], num_list[mini] = num_list[mini], num_list[i]
            num_swap = num_swap + 1
    return num_swap, num_list def selection_sort(num_list):
    num_swap = 0
    for i in range(len(num_list)):
        mini = i
        for j in range(i, len(num_list)):
            if num_list[j] < num_list[mini]:
                mini = j
        if i != mini:
            num_list[i], num_list[mini] = num_list[mini], num_list[i]
            num_swap = num_swap + 1
    return num_swap, num_list selection_sort num_list = [int(x) for i, x in enumerate(input().split()) if i < num] [int(x) for i, x in enumerate(input().split()) if i < num] num_list num_swap, num_list = selection_sort(num_list) selection_sort(num_list) num_swap
# -*- coding:utf-8 -*-

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

def show_list(list):
    i = 0;
    while(i < len(list)-1):
        print(list[i], end=" ")
        i = i + 1
    print(list[i])

num = int(input())
num_list = [int(x) for i, x in enumerate(input().split()) if i < num]
num_swap, num_list = selection_sort(num_list)
show_list(num_list)
print(num_swap)