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

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

N = int(input())
A = list(map(int,input().split()))
X , cnt = selectionSort(A,N)
print(*X)
print(cnt)