#!/usr/bin/python3
# -*- coding: utf-8 -*-

import sys

def selection_sort(A):
    swap_count = 0
    for i in range(len(A)):
        mini = i
        min_val = min(A[i:])
        min_index = A[i:].index(min_val) + i

        if A[min_index] < A[i]:
            swap_count += 1
            A[min_index], A[i] = A[i], A[min_index]

    return swap_count


n = int(sys.stdin.readline())
A = list(map(int, sys.stdin.readline().split()))

swap_count = selection_sort(A)
s_list = list(map(str, A))
print(' '.join(s_list))
print(swap_count)
 import sys sys def selection_sort(A):
    swap_count = 0
    for i in range(len(A)):
        mini = i
        min_val = min(A[i:])
        min_index = A[i:].index(min_val) + i

        if A[min_index] < A[i]:
            swap_count += 1
            A[min_index], A[i] = A[i], A[min_index]

    return swap_count selection_sort swap_count = 0 swap_count 0 for i in range(len(A)):
        mini = i
        min_val = min(A[i:])
        min_index = A[i:].index(min_val) + i

        if A[min_index] < A[i]:
            swap_count += 1
            A[min_index], A[i] = A[i], A[min_index]

     i range(len(A)) range len(A) len A mini = i mini i min_val = min(A[i:]) min_val min(A[i:]) min A[i:] A i: i min_index = A[i:].index(min_val) + i min_index A[i:].index(min_val) + i A[i:].index(min_val) [i:].index [i:] A i: i index min_val i if A[min_index] < A[i]:
            swap_count += 1
            A[min_index], A[i] = A[i], A[min_index]

     A[min_index] < A[i] A[min_index] A min_index A[i] A i swap_count += 1 swap_count 1 A[min_index], A[i] = A[i], A[min_index] A[min_index] A min_index A[i] A i A[i] A i A[min_index] A min_index return swap_count swap_count A A n = int(sys.stdin.readline()) n int(sys.stdin.readline()) int sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline A = list(map(int, sys.stdin.readline().split())) A list(map(int, sys.stdin.readline().split())) list map(int, sys.stdin.readline().split()) map int sys.stdin.readline().split() sys.stdin.readline().split sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline split swap_count = selection_sort(A) swap_count selection_sort(A) selection_sort A s_list = list(map(str, A)) s_list list(map(str, A)) list map(str, A) map str A print(' '.join(s_list)) print ' '.join(s_list) ' '.join ' ' join s_list print(swap_count) print swap_count def selection_sort(A):
    swap_count = 0
    for i in range(len(A)):
        mini = i
        min_val = min(A[i:])
        min_index = A[i:].index(min_val) + i

        if A[min_index] < A[i]:
            swap_count += 1
            A[min_index], A[i] = A[i], A[min_index]

    return swap_count def selection_sort(A):
    swap_count = 0
    for i in range(len(A)):
        mini = i
        min_val = min(A[i:])
        min_index = A[i:].index(min_val) + i

        if A[min_index] < A[i]:
            swap_count += 1
            A[min_index], A[i] = A[i], A[min_index]

    return swap_count selection_sort A = list(map(int, sys.stdin.readline().split())) list(map(int, sys.stdin.readline().split())) A swap_count = selection_sort(A) selection_sort(A) swap_count s_list = list(map(str, A)) list(map(str, A)) s_list n = int(sys.stdin.readline()) int(sys.stdin.readline()) n
#!/usr/bin/python3
# -*- coding: utf-8 -*-

import sys

def selection_sort(A):
    swap_count = 0
    for i in range(len(A)):
        mini = i
        min_val = min(A[i:])
        min_index = A[i:].index(min_val) + i

        if A[min_index] < A[i]:
            swap_count += 1
            A[min_index], A[i] = A[i], A[min_index]

    return swap_count


n = int(sys.stdin.readline())
A = list(map(int, sys.stdin.readline().split()))

swap_count = selection_sort(A)
s_list = list(map(str, A))
print(' '.join(s_list))
print(swap_count)

