# selection sort
N = int(input())
A = [int(i) for i in input().split()]

cnt = 0

for i in range(0, N):
    min_i = i
    for j in range(i+1, N):
        if A[j] < A[min_i]:
            min_i = j
    if i != min_i:
        A[i], A[min_i] = A[min_i], A[i]
        cnt = cnt + 1

print(' '.join([str(i) for i in A]))
print(cnt) 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()] cnt = 0 cnt 0 for i in range(0, N):
    min_i = i
    for j in range(i+1, N):
        if A[j] < A[min_i]:
            min_i = j
    if i != min_i:
        A[i], A[min_i] = A[min_i], A[i]
        cnt = cnt + 1 i range(0, N) range 0 N min_i = i min_i i for j in range(i+1, N):
        if A[j] < A[min_i]:
            min_i = j
     j range(i+1, N) range i+1 i 1 N if A[j] < A[min_i]:
            min_i = j
     A[j] < A[min_i] A[j] A j A[min_i] A min_i min_i = j min_i j if i != min_i:
        A[i], A[min_i] = A[min_i], A[i]
        cnt = cnt + 1 i != min_i i min_i A[i], A[min_i] = A[min_i], A[i] A[i] A i A[min_i] A min_i A[min_i] A min_i A[i] A i cnt = cnt + 1 cnt cnt + 1 cnt 1 str(i) for i in A for i in A i A for i in A str(i) str i print(' '.join([str(i) for i in A])) print ' '.join([str(i) for i in A]) ' '.join ' ' join [str(i) for i in A] print(cnt) print cnt min_i = j j min_i cnt = cnt + 1 cnt + 1 cnt min_i = i i min_i N = int(input()) int(input()) N A = [int(i) for i in input().split()] [int(i) for i in input().split()] A cnt = 0 0 cnt
# selection sort
N = int(input())
A = [int(i) for i in input().split()]

cnt = 0

for i in range(0, N):
    min_i = i
    for j in range(i+1, N):
        if A[j] < A[min_i]:
            min_i = j
    if i != min_i:
        A[i], A[min_i] = A[min_i], A[i]
        cnt = cnt + 1

print(' '.join([str(i) for i in A]))
print(cnt)