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


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


A, c = selectionSort(int(input()), list(map(int, input().split())))
print(*A)
print(c)