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

N=int(input())
A=list(map(int, input().split()))
selectionSort(A) def selectionSort(A):
    N = len(A)
    cnt = 0
    for i in range(N):
        min_i = i
        for j in range(i,N):
            if A[j] < A[min_i]:
                min_i = j
        if min_i != i:
            A[i], A[min_i] = A[min_i], A[i]
            cnt += 1
    print(*A)
    print(cnt) selectionSort N = len(A) N len(A) len A cnt = 0 cnt 0 for i in range(N):
        min_i = i
        for j in range(i,N):
            if A[j] < A[min_i]:
                min_i = j
        if min_i != i:
            A[i], A[min_i] = A[min_i], A[i]
            cnt += 1
     i range(N) range N min_i = i min_i i for j in range(i,N):
            if A[j] < A[min_i]:
                min_i = j
         j range(i,N) range i 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 min_i != i:
            A[i], A[min_i] = A[min_i], A[i]
            cnt += 1
     min_i != i min_i 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 += 1 cnt 1 print(*A) print *A A print(cnt) print cnt A A 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 selectionSort(A) selectionSort A def selectionSort(A):
    N = len(A)
    cnt = 0
    for i in range(N):
        min_i = i
        for j in range(i,N):
            if A[j] < A[min_i]:
                min_i = j
        if min_i != i:
            A[i], A[min_i] = A[min_i], A[i]
            cnt += 1
    print(*A)
    print(cnt) def selectionSort(A):
    N = len(A)
    cnt = 0
    for i in range(N):
        min_i = i
        for j in range(i,N):
            if A[j] < A[min_i]:
                min_i = j
        if min_i != i:
            A[i], A[min_i] = A[min_i], A[i]
            cnt += 1
    print(*A)
    print(cnt) selectionSort A=list(map(int, input().split())) list(map(int, input().split())) A N=int(input()) int(input()) N
def selectionSort(A):
    N = len(A)
    cnt = 0
    for i in range(N):
        min_i = i
        for j in range(i,N):
            if A[j] < A[min_i]:
                min_i = j
        if min_i != i:
            A[i], A[min_i] = A[min_i], A[i]
            cnt += 1
    print(*A)
    print(cnt)

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