def print_list():
    for i,e in enumerate(A):
        if i == N - 1:
            print(e)
        else:
            print(e, end=" ")

N = int(input())
A = [int(e) for e in input().split()]
cnt = 0
for i in range(N):
    min_index = i
    for j in range(i, N):
        if A[min_index] > A[j]:
            min_index = j
    if i != min_index:
        w = A[i]; A[i] = A[min_index]; A[min_index] = w
        cnt += 1
print_list()
print(cnt)
 def print_list():
    for i,e in enumerate(A):
        if i == N - 1:
            print(e)
        else:
            print(e, end=" ") print_list for i,e in enumerate(A):
        if i == N - 1:
            print(e)
        else:
            print(e, end=" ") i e enumerate(A) enumerate A if i == N - 1:
            print(e)
        else:
            print(e, end=" ") i == N - 1 i N - 1 N 1 print(e) print e print(e, end=" ") print e end=" " end " " N = int(input()) N int(input()) int input() input int(e) for e in input().split() for e in input().split() e input().split() ().split () input split for e in input().split() int(e) int e A = [int(e) for e in input().split()] A [int(e) for e in input().split()] cnt = 0 cnt 0 for i in range(N):
    min_index = i
    for j in range(i, N):
        if A[min_index] > A[j]:
            min_index = j
    if i != min_index:
        w = A[i]; A[i] = A[min_index]; A[min_index] = w
        cnt += 1 i range(N) range N min_index = i min_index i for j in range(i, N):
        if A[min_index] > A[j]:
            min_index = j
     j range(i, N) range i N if A[min_index] > A[j]:
            min_index = j
     A[min_index] > A[j] A[min_index] A min_index A[j] A j min_index = j min_index j if i != min_index:
        w = A[i]; A[i] = A[min_index]; A[min_index] = w
        cnt += 1 i != min_index i min_index w = A[i] w A[i] A i A[i] = A[min_index] A[i] A i A[min_index] A min_index A[min_index] = w A[min_index] A min_index w cnt += 1 cnt 1 print_list() print_list print(cnt) print cnt w = A[i] A[i] w A = [int(e) for e in input().split()] [int(e) for e in input().split()] A min_index = i i min_index def print_list():
    for i,e in enumerate(A):
        if i == N - 1:
            print(e)
        else:
            print(e, end=" ") def print_list():
    for i,e in enumerate(A):
        if i == N - 1:
            print(e)
        else:
            print(e, end=" ") print_list N = int(input()) int(input()) N cnt = 0 0 cnt cnt += 1 1 cnt min_index = j j min_index
def print_list():
    for i,e in enumerate(A):
        if i == N - 1:
            print(e)
        else:
            print(e, end=" ")

N = int(input())
A = [int(e) for e in input().split()]
cnt = 0
for i in range(N):
    min_index = i
    for j in range(i, N):
        if A[min_index] > A[j]:
            min_index = j
    if i != min_index:
        w = A[i]; A[i] = A[min_index]; A[min_index] = w
        cnt += 1
print_list()
print(cnt)

