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


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

A, cnt = selection_sort(A, N)
string = list(map(str, A))
print(' '.join(string))
print(cnt) def selection_sort(A, N):
    cnt = 0
    for i in range(N):
        min_j = i
        for j in range(i, N):
            if A[j] < A[min_j]:
                min_j = j
        if i != min_j:
            A[i], A[min_j] = A[min_j], A[i]
            cnt += 1        
    return A, cnt selection_sort cnt = 0 cnt 0 for i in range(N):
        min_j = i
        for j in range(i, N):
            if A[j] < A[min_j]:
                min_j = j
        if i != min_j:
            A[i], A[min_j] = A[min_j], A[i]
            cnt += 1        
     i range(N) range N min_j = i min_j i for j in range(i, N):
            if A[j] < A[min_j]:
                min_j = j
         j range(i, N) range i N if A[j] < A[min_j]:
                min_j = j
         A[j] < A[min_j] A[j] A j A[min_j] A min_j min_j = j min_j j if i != min_j:
            A[i], A[min_j] = A[min_j], A[i]
            cnt += 1        
     i != min_j i min_j A[i], A[min_j] = A[min_j], A[i] A[i] A i A[min_j] A min_j A[min_j] A min_j A[i] A i cnt += 1 cnt 1 return A, cnt return A, cnt A cnt A A N N N = int(input().rstrip()) N int(input().rstrip()) int input().rstrip() ().rstrip () input rstrip A = list(map(int, input().rstrip().split())) A list(map(int, input().rstrip().split())) list map(int, input().rstrip().split()) map int input().rstrip().split() ().rstrip().split ().rstrip() ().rstrip () input rstrip split A, cnt = selection_sort(A, N) A selection_sort(A, N) selection_sort A N cnt string = list(map(str, A)) string list(map(str, A)) list map(str, A) map str A print(' '.join(string)) print ' '.join(string) ' '.join ' ' join string print(cnt) print cnt N = int(input().rstrip()) int(input().rstrip()) N A = list(map(int, input().rstrip().split())) list(map(int, input().rstrip().split())) A cnt = selection_sort(A, N) selection_sort(A, N) cnt A, cnt = selection_sort(A, N) selection_sort(A, N) A string = list(map(str, A)) list(map(str, A)) string def selection_sort(A, N):
    cnt = 0
    for i in range(N):
        min_j = i
        for j in range(i, N):
            if A[j] < A[min_j]:
                min_j = j
        if i != min_j:
            A[i], A[min_j] = A[min_j], A[i]
            cnt += 1        
    return A, cnt def selection_sort(A, N):
    cnt = 0
    for i in range(N):
        min_j = i
        for j in range(i, N):
            if A[j] < A[min_j]:
                min_j = j
        if i != min_j:
            A[i], A[min_j] = A[min_j], A[i]
            cnt += 1        
    return A, cnt selection_sort
def selection_sort(A, N):
    cnt = 0
    for i in range(N):
        min_j = i
        for j in range(i, N):
            if A[j] < A[min_j]:
                min_j = j
        if i != min_j:
            A[i], A[min_j] = A[min_j], A[i]
            cnt += 1        
    return A, cnt


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

A, cnt = selection_sort(A, N)
string = list(map(str, A))
print(' '.join(string))
print(cnt)
