input()
num_list = raw_input().split()
num_list = map(int, num_list)

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

count = 0 
count, num_list = selection_sort(num_list, count)
num_list = map(str, num_list)
print " ".join(num_list)
print count input() input num_list = raw_input().split() num_list raw_input().split() ().split () raw_input split num_list = map(int, num_list) num_list map(int, num_list) map int num_list def selection_sort(num_list, count): 
    for i in range(0, len(num_list)):
        minj = i 
        for j in range(i, len(num_list)):
            if num_list[j] < num_list[minj]:
                minj = j 
                temp = num_list[minj]
        if minj != i:
            num_list[minj] = num_list[i]
            num_list[i]= temp
            count += 1
        i += 1
    return count, num_list selection_sort for i in range(0, len(num_list)):
        minj = i 
        for j in range(i, len(num_list)):
            if num_list[j] < num_list[minj]:
                minj = j 
                temp = num_list[minj]
        if minj != i:
            num_list[minj] = num_list[i]
            num_list[i]= temp
            count += 1
        i += 1
     i range(0, len(num_list)) range 0 len(num_list) len num_list minj = i minj i for j in range(i, len(num_list)):
            if num_list[j] < num_list[minj]:
                minj = j 
                temp = num_list[minj]
         j range(i, len(num_list)) range i len(num_list) len num_list if num_list[j] < num_list[minj]:
                minj = j 
                temp = num_list[minj]
         num_list[j] < num_list[minj] num_list[j] num_list j num_list[minj] num_list minj minj = j minj j temp = num_list[minj] temp num_list[minj] num_list minj if minj != i:
            num_list[minj] = num_list[i]
            num_list[i]= temp
            count += 1
         minj != i minj i num_list[minj] = num_list[i] num_list[minj] num_list minj num_list[i] num_list i num_list[i]= temp num_list[i] num_list i temp count += 1 count 1 i += 1 i 1 return count, num_list return count, num_list count num_list num_list num_list count count count = 0 count 0 count, num_list = selection_sort(num_list, count) count selection_sort(num_list, count) selection_sort num_list count num_list num_list = map(str, num_list) num_list map(str, num_list) map str num_list print " ".join(num_list) " ".join " " join num_list print num_list = map(int, num_list) map(int, num_list) num_list num_list = map(str, num_list) map(str, num_list) num_list count, num_list = selection_sort(num_list, count) selection_sort(num_list, count) count num_list = raw_input().split() raw_input().split() num_list num_list = selection_sort(num_list, count) selection_sort(num_list, count) num_list def selection_sort(num_list, count): 
    for i in range(0, len(num_list)):
        minj = i 
        for j in range(i, len(num_list)):
            if num_list[j] < num_list[minj]:
                minj = j 
                temp = num_list[minj]
        if minj != i:
            num_list[minj] = num_list[i]
            num_list[i]= temp
            count += 1
        i += 1
    return count, num_list def selection_sort(num_list, count): 
    for i in range(0, len(num_list)):
        minj = i 
        for j in range(i, len(num_list)):
            if num_list[j] < num_list[minj]:
                minj = j 
                temp = num_list[minj]
        if minj != i:
            num_list[minj] = num_list[i]
            num_list[i]= temp
            count += 1
        i += 1
    return count, num_list selection_sort count = 0 0 count
input()
num_list = raw_input().split()
num_list = map(int, num_list)

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

count = 0 
count, num_list = selection_sort(num_list, count)
num_list = map(str, num_list)
print " ".join(num_list)
print count