import math

N = int(input())
A = list(map(int, input().split()))

count = 0

for i in range(0, N):
    minj = i
    for j in range(i, N):
        if A[j] < A[minj]:
            minj = j
    if i != minj:
        count += 1
        temp = A[i]
        A[i] = A[minj]
        A[minj] = temp
    
print(' '.join(map(str, A)))
print(count) import math math N = int(input()) N int(input()) int input() input A = list(map(int, input().split())) A list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split count = 0 count 0 for i in range(0, N):
    minj = i
    for j in range(i, N):
        if A[j] < A[minj]:
            minj = j
    if i != minj:
        count += 1
        temp = A[i]
        A[i] = A[minj]
        A[minj] = temp
     i range(0, N) range 0 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 i != minj:
        count += 1
        temp = A[i]
        A[i] = A[minj]
        A[minj] = temp
     i != minj i minj count += 1 count 1 temp = A[i] temp A[i] A i A[i] = A[minj] A[i] A i A[minj] A minj A[minj] = temp A[minj] A minj temp print(' '.join(map(str, A))) print ' '.join(map(str, A)) ' '.join ' ' join map(str, A) map str A print(count) print count N = int(input()) int(input()) N minj = i i minj A = list(map(int, input().split())) list(map(int, input().split())) A minj = j j minj temp = A[i] A[i] temp count = 0 0 count count += 1 1 count
import math

N = int(input())
A = list(map(int, input().split()))

count = 0

for i in range(0, N):
    minj = i
    for j in range(i, N):
        if A[j] < A[minj]:
            minj = j
    if i != minj:
        count += 1
        temp = A[i]
        A[i] = A[minj]
        A[minj] = temp
    
print(' '.join(map(str, A)))
print(count)