def Selection(A, N):
    c = 0
    i = 0
    while i < N:
        minj = i
        j = i
        while j < N:
            if A[j] < A[minj]:
                minj = j
            j += 1
        if i != minj:
            c += 1
            a = A[i]
            A[i] = A[minj]
            A[minj] = a
        i += 1
    return A, c

N = int(input())
A = list(map(int, input().split(' ')))
A, c = Selection(A, N)
print(' '.join(map(str, A)) + '\n' + str(c)) def Selection(A, N):
    c = 0
    i = 0
    while i < N:
        minj = i
        j = i
        while j < N:
            if A[j] < A[minj]:
                minj = j
            j += 1
        if i != minj:
            c += 1
            a = A[i]
            A[i] = A[minj]
            A[minj] = a
        i += 1
    return A, c Selection c = 0 c 0 i = 0 i 0 while i < N:
        minj = i
        j = i
        while j < N:
            if A[j] < A[minj]:
                minj = j
            j += 1
        if i != minj:
            c += 1
            a = A[i]
            A[i] = A[minj]
            A[minj] = a
        i += 1
     i < N i N minj = i minj i j = i j i while j < N:
            if A[j] < A[minj]:
                minj = j
            j += 1
         j < N j N if A[j] < A[minj]:
                minj = j
             A[j] < A[minj] A[j] A j A[minj] A minj minj = j minj j j += 1 j 1 if i != minj:
            c += 1
            a = A[i]
            A[i] = A[minj]
            A[minj] = a
         i != minj i minj c += 1 c 1 a = A[i] a A[i] A i A[i] = A[minj] A[i] A i A[minj] A minj A[minj] = a A[minj] A minj a i += 1 i 1 return A, c return A, c A c A A N N 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 ' ' A, c = Selection(A, N) A Selection(A, N) Selection A N c print(' '.join(map(str, A)) + '\n' + str(c)) print ' '.join(map(str, A)) + '\n' + str(c) ' '.join(map(str, A)) + '\n' ' '.join(map(str, A)) ' '.join ' ' join map(str, A) map str A '\n' str(c) str c A, c = Selection(A, N) Selection(A, N) A A = list(map(int, input().split(' '))) list(map(int, input().split(' '))) A c = Selection(A, N) Selection(A, N) c def Selection(A, N):
    c = 0
    i = 0
    while i < N:
        minj = i
        j = i
        while j < N:
            if A[j] < A[minj]:
                minj = j
            j += 1
        if i != minj:
            c += 1
            a = A[i]
            A[i] = A[minj]
            A[minj] = a
        i += 1
    return A, c def Selection(A, N):
    c = 0
    i = 0
    while i < N:
        minj = i
        j = i
        while j < N:
            if A[j] < A[minj]:
                minj = j
            j += 1
        if i != minj:
            c += 1
            a = A[i]
            A[i] = A[minj]
            A[minj] = a
        i += 1
    return A, c Selection N = int(input()) int(input()) N
def Selection(A, N):
    c = 0
    i = 0
    while i < N:
        minj = i
        j = i
        while j < N:
            if A[j] < A[minj]:
                minj = j
            j += 1
        if i != minj:
            c += 1
            a = A[i]
            A[i] = A[minj]
            A[minj] = a
        i += 1
    return A, c

N = int(input())
A = list(map(int, input().split(' ')))
A, c = Selection(A, N)
print(' '.join(map(str, A)) + '\n' + str(c))
