# Selection Sort

length = int(input())
array = [int(i) for i in input().rstrip().split()]

count = 0
for i in range(length):
    minj = i
    for j in range(i, length):
        if array[j] < array[minj]:
            minj = j
    if minj != i:
        count += 1
        array[i], array[minj] = array[minj], array[i]

for i in range(length):
    if i < length - 1:
        print(array[i], end = " ")
    else:
        print(array[i])
print(count)
 length = int(input()) length int(input()) int input() input int(i) for i in input().rstrip().split() for i in input().rstrip().split() i input().rstrip().split() ().rstrip().split ().rstrip() ().rstrip () input rstrip split for i in input().rstrip().split() int(i) int i array = [int(i) for i in input().rstrip().split()] array [int(i) for i in input().rstrip().split()] count = 0 count 0 for i in range(length):
    minj = i
    for j in range(i, length):
        if array[j] < array[minj]:
            minj = j
    if minj != i:
        count += 1
        array[i], array[minj] = array[minj], array[i] i range(length) range length minj = i minj i for j in range(i, length):
        if array[j] < array[minj]:
            minj = j
     j range(i, length) range i length if array[j] < array[minj]:
            minj = j
     array[j] < array[minj] array[j] array j array[minj] array minj minj = j minj j if minj != i:
        count += 1
        array[i], array[minj] = array[minj], array[i] minj != i minj i count += 1 count 1 array[i], array[minj] = array[minj], array[i] array[i] array i array[minj] array minj array[minj] array minj array[i] array i for i in range(length):
    if i < length - 1:
        print(array[i], end = " ")
    else:
        print(array[i]) i range(length) range length if i < length - 1:
        print(array[i], end = " ")
    else:
        print(array[i]) i < length - 1 i length - 1 length 1 print(array[i], end = " ") print array[i] array i end = " " end " " print(array[i]) print array[i] array i print(count) print count minj = i i minj length = int(input()) int(input()) length count = 0 0 count count += 1 1 count array = [int(i) for i in input().rstrip().split()] [int(i) for i in input().rstrip().split()] array minj = j j minj
# Selection Sort

length = int(input())
array = [int(i) for i in input().rstrip().split()]

count = 0
for i in range(length):
    minj = i
    for j in range(i, length):
        if array[j] < array[minj]:
            minj = j
    if minj != i:
        count += 1
        array[i], array[minj] = array[minj], array[i]

for i in range(length):
    if i < length - 1:
        print(array[i], end = " ")
    else:
        print(array[i])
print(count)

