#http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_2_B&lang=jp
#???????????????
#?????????????????????????????¨????§???????????????????????¢????????????°????????????
#?¨???????????????°??¢??°???????¢????????????????

def selection_sort(target_list):
    list_length = len(target_list)
    change_count = 0
    for i in range(list_length):
        min_index = i
        for j in range(i, list_length):
            if target_list[j] < target_list[min_index]:
                min_index = j
        else:
            if not i == min_index:
                tmp = target_list[i]
                target_list[i] = target_list[min_index]
                target_list[min_index] = tmp
                change_count += 1
                
    return change_count
def main():
    
    n_list = int(input())
    target_list = [int(n) for n in input().split()]
    cc = selection_sort(target_list)
    print(*target_list)
    print(cc)
    
if __name__ == "__main__":
    main() def selection_sort(target_list):
    list_length = len(target_list)
    change_count = 0
    for i in range(list_length):
        min_index = i
        for j in range(i, list_length):
            if target_list[j] < target_list[min_index]:
                min_index = j
        else:
            if not i == min_index:
                tmp = target_list[i]
                target_list[i] = target_list[min_index]
                target_list[min_index] = tmp
                change_count += 1
                
    return change_count selection_sort list_length = len(target_list) list_length len(target_list) len target_list change_count = 0 change_count 0 for i in range(list_length):
        min_index = i
        for j in range(i, list_length):
            if target_list[j] < target_list[min_index]:
                min_index = j
        else:
            if not i == min_index:
                tmp = target_list[i]
                target_list[i] = target_list[min_index]
                target_list[min_index] = tmp
                change_count += 1
                
     i range(list_length) range list_length min_index = i min_index i for j in range(i, list_length):
            if target_list[j] < target_list[min_index]:
                min_index = j
        else:
            if not i == min_index:
                tmp = target_list[i]
                target_list[i] = target_list[min_index]
                target_list[min_index] = tmp
                change_count += 1
                
     j range(i, list_length) range i list_length if target_list[j] < target_list[min_index]:
                min_index = j
         target_list[j] < target_list[min_index] target_list[j] target_list j target_list[min_index] target_list min_index min_index = j min_index j if not i == min_index:
                tmp = target_list[i]
                target_list[i] = target_list[min_index]
                target_list[min_index] = tmp
                change_count += 1
                
     not i == min_index i == min_index i min_index tmp = target_list[i] tmp target_list[i] target_list i target_list[i] = target_list[min_index] target_list[i] target_list i target_list[min_index] target_list min_index target_list[min_index] = tmp target_list[min_index] target_list min_index tmp change_count += 1 change_count 1 return change_count change_count target_list target_list def main():
    
    n_list = int(input())
    target_list = [int(n) for n in input().split()]
    cc = selection_sort(target_list)
    print(*target_list)
    print(cc)
     main n_list = int(input()) n_list int(input()) int input() input int(n) for n in input().split() for n in input().split() n input().split() ().split () input split for n in input().split() int(n) int n target_list = [int(n) for n in input().split()] target_list [int(n) for n in input().split()] cc = selection_sort(target_list) cc selection_sort(target_list) selection_sort target_list print(*target_list) print *target_list target_list print(cc) print cc if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def main():
    
    n_list = int(input())
    target_list = [int(n) for n in input().split()]
    cc = selection_sort(target_list)
    print(*target_list)
    print(cc)
     def main():
    
    n_list = int(input())
    target_list = [int(n) for n in input().split()]
    cc = selection_sort(target_list)
    print(*target_list)
    print(cc)
     main def selection_sort(target_list):
    list_length = len(target_list)
    change_count = 0
    for i in range(list_length):
        min_index = i
        for j in range(i, list_length):
            if target_list[j] < target_list[min_index]:
                min_index = j
        else:
            if not i == min_index:
                tmp = target_list[i]
                target_list[i] = target_list[min_index]
                target_list[min_index] = tmp
                change_count += 1
                
    return change_count def selection_sort(target_list):
    list_length = len(target_list)
    change_count = 0
    for i in range(list_length):
        min_index = i
        for j in range(i, list_length):
            if target_list[j] < target_list[min_index]:
                min_index = j
        else:
            if not i == min_index:
                tmp = target_list[i]
                target_list[i] = target_list[min_index]
                target_list[min_index] = tmp
                change_count += 1
                
    return change_count selection_sort
#http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_2_B&lang=jp
#???????????????
#?????????????????????????????¨????§???????????????????????¢????????????°????????????
#?¨???????????????°??¢??°???????¢????????????????

def selection_sort(target_list):
    list_length = len(target_list)
    change_count = 0
    for i in range(list_length):
        min_index = i
        for j in range(i, list_length):
            if target_list[j] < target_list[min_index]:
                min_index = j
        else:
            if not i == min_index:
                tmp = target_list[i]
                target_list[i] = target_list[min_index]
                target_list[min_index] = tmp
                change_count += 1
                
    return change_count
def main():
    
    n_list = int(input())
    target_list = [int(n) for n in input().split()]
    cc = selection_sort(target_list)
    print(*target_list)
    print(cc)
    
if __name__ == "__main__":
    main()