# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_2_B
# Selection Sort
# Result:
import sys

nums_len = int(sys.stdin.readline())
nums_str = sys.stdin.readline().split(' ')
nums = map(int, nums_str)

swap_count = 0
for i in range(0, nums_len):
    minj = i
    for j in range(i, nums_len):
        if nums[j] < nums[minj]:
            minj = j
    if minj != i:
        v = nums[i]
        nums[i] = nums[minj]
        nums[minj] = v
        swap_count += 1

print ' '.join(map(str, nums))
print swap_count import sys sys nums_len = int(sys.stdin.readline()) nums_len int(sys.stdin.readline()) int sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline nums_str = sys.stdin.readline().split(' ') nums_str sys.stdin.readline().split(' ') sys.stdin.readline().split sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline split ' ' nums = map(int, nums_str) nums map(int, nums_str) map int nums_str swap_count = 0 swap_count 0 for i in range(0, nums_len):
    minj = i
    for j in range(i, nums_len):
        if nums[j] < nums[minj]:
            minj = j
    if minj != i:
        v = nums[i]
        nums[i] = nums[minj]
        nums[minj] = v
        swap_count += 1 i range(0, nums_len) range 0 nums_len minj = i minj i for j in range(i, nums_len):
        if nums[j] < nums[minj]:
            minj = j
     j range(i, nums_len) range i nums_len if nums[j] < nums[minj]:
            minj = j
     nums[j] < nums[minj] nums[j] nums j nums[minj] nums minj minj = j minj j if minj != i:
        v = nums[i]
        nums[i] = nums[minj]
        nums[minj] = v
        swap_count += 1 minj != i minj i v = nums[i] v nums[i] nums i nums[i] = nums[minj] nums[i] nums i nums[minj] nums minj nums[minj] = v nums[minj] nums minj v swap_count += 1 swap_count 1 print ' '.join(map(str, nums)) ' '.join ' ' join map(str, nums) map str nums print nums = map(int, nums_str) map(int, nums_str) nums minj = j j minj swap_count += 1 1 swap_count nums_len = int(sys.stdin.readline()) int(sys.stdin.readline()) nums_len v = nums[i] nums[i] v nums_str = sys.stdin.readline().split(' ') sys.stdin.readline().split(' ') nums_str minj = i i minj swap_count = 0 0 swap_count
# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_2_B
# Selection Sort
# Result:
import sys

nums_len = int(sys.stdin.readline())
nums_str = sys.stdin.readline().split(' ')
nums = map(int, nums_str)

swap_count = 0
for i in range(0, nums_len):
    minj = i
    for j in range(i, nums_len):
        if nums[j] < nums[minj]:
            minj = j
    if minj != i:
        v = nums[i]
        nums[i] = nums[minj]
        nums[minj] = v
        swap_count += 1

print ' '.join(map(str, nums))
print swap_count