n = int(input())
a = [int(i) for i in input().split()]
counter = 0
for i in range(n):
    minj = i
    for j in range(i, n):
        if a[j] < a[minj]:
            minj = j
    if minj != i:
        a[i], a[minj] = a[minj], a[i]
        counter += 1
print(*a)
print(counter)
 n = int(input()) n int(input()) int input() input int(i) for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() int(i) int i a = [int(i) for i in input().split()] a [int(i) for i in input().split()] counter = 0 counter 0 for i in range(n):
    minj = i
    for j in range(i, n):
        if a[j] < a[minj]:
            minj = j
    if minj != i:
        a[i], a[minj] = a[minj], a[i]
        counter += 1 i range(n) range n minj = i minj i for j in range(i, n):
        if a[j] < a[minj]:
            minj = j
     j range(i, n) range i n if a[j] < a[minj]:
            minj = j
     a[j] < a[minj] a[j] a j a[minj] a minj minj = j minj j if minj != i:
        a[i], a[minj] = a[minj], a[i]
        counter += 1 minj != i minj i a[i], a[minj] = a[minj], a[i] a[i] a i a[minj] a minj a[minj] a minj a[i] a i counter += 1 counter 1 print(*a) print *a a print(counter) print counter minj = i i minj n = int(input()) int(input()) n a = [int(i) for i in input().split()] [int(i) for i in input().split()] a minj = j j minj counter += 1 1 counter counter = 0 0 counter
n = int(input())
a = [int(i) for i in input().split()]
counter = 0
for i in range(n):
    minj = i
    for j in range(i, n):
        if a[j] < a[minj]:
            minj = j
    if minj != i:
        a[i], a[minj] = a[minj], a[i]
        counter += 1
print(*a)
print(counter)

