n = int(eval(input()))

a = list(map(int, input().split()))

count = 0

for i in range(0, n):

	minj = min(list(range(i, n)), key=lambda j: a[j])

	if i != minj:

		a[i], a[minj] = a[minj], a[i]

		count += 1

print((*a))

print(count)

n = int(eval(input()))

a = list(map(int, input().split()))

count = 0

for i in range(n):

	minj = min(list(range(i, n)), key=lambda j: a[j])

	if i != minj:

		a[i], a[minj] = a[minj], a[i]

		count += 1

print((*a))

print(count)

n = int(eval(input()))
a = list(map(int, input().split()))
count = 0
for i in range(0, n):
    minj = min(list(range(i, n)), key=lambda j: a[j])
    if i != minj:
        a[i], a[minj] = a[minj], a[i]
        count += 1
print((*a))
print(count)

n = int(eval(input()))
a = list(map(int, input().split()))
count = 0
for i in range(n):
    minj = min(list(range(i, n)), key=lambda j: a[j])
    if i != minj:
        a[i], a[minj] = a[minj], a[i]
        count += 1
print((*a))
print(count)

-for i in range(0, n): +for i in range(n):