#! python3
# selection_sort.py

# 各ステップで最小値を選択

n = int(input())
A = [int(x) for x in input().split(' ')]

exc_num = 0
for i in range(n-1):
    minj = i
    for j in range(i, n):
        if A[j] < A[minj]:
            minj = j
    if i != minj:
        exc_num += 1
        A[i], A[minj] = A[minj], A[i]

print(' '.join([str(x) for x in A]))
print(exc_num) n = int(input()) n int(input()) int input() input int(x) for x in input().split(' ') for x in input().split(' ') x input().split(' ') ().split () input split ' ' for x in input().split(' ') int(x) int x A = [int(x) for x in input().split(' ')] A [int(x) for x in input().split(' ')] exc_num = 0 exc_num 0 for i in range(n-1):
    minj = i
    for j in range(i, n):
        if A[j] < A[minj]:
            minj = j
    if i != minj:
        exc_num += 1
        A[i], A[minj] = A[minj], A[i] i range(n-1) range n-1 n 1 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 i != minj:
        exc_num += 1
        A[i], A[minj] = A[minj], A[i] i != minj i minj exc_num += 1 exc_num 1 A[i], A[minj] = A[minj], A[i] A[i] A i A[minj] A minj A[minj] A minj A[i] A i str(x) for x in A for x in A x A for x in A str(x) str x print(' '.join([str(x) for x in A])) print ' '.join([str(x) for x in A]) ' '.join ' ' join [str(x) for x in A] print(exc_num) print exc_num minj = j j minj n = int(input()) int(input()) n A = [int(x) for x in input().split(' ')] [int(x) for x in input().split(' ')] A exc_num = 0 0 exc_num minj = i i minj exc_num += 1 1 exc_num
#! python3
# selection_sort.py

# 各ステップで最小値を選択

n = int(input())
A = [int(x) for x in input().split(' ')]

exc_num = 0
for i in range(n-1):
    minj = i
    for j in range(i, n):
        if A[j] < A[minj]:
            minj = j
    if i != minj:
        exc_num += 1
        A[i], A[minj] = A[minj], A[i]

print(' '.join([str(x) for x in A]))
print(exc_num)
