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

    return A,count

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

A,count = selectionSort(A,N)

for i in range(len(A)):  # output
    if i == len(A) - 1:
        print(A[i])
    else:
        print(A[i], end=' ')

print(count) def selectionSort(A,N):
    count = 0
    for i in range(0,N-1):
        minj = i
        for j in range(i+1,N):
            if A[j] < A[minj]:
                minj = j
        tmp = A[minj]
        A[minj] = A[i]
        A[i] = tmp
        if i != minj:
            count += 1

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

     i range(0,N-1) range 0 N-1 N 1 minj = i minj i for j in range(i+1,N):
            if A[j] < A[minj]:
                minj = j
         j range(i+1,N) range i+1 i 1 N if A[j] < A[minj]:
                minj = j
         A[j] < A[minj] A[j] A j A[minj] A minj minj = j minj j tmp = A[minj] tmp A[minj] A minj A[minj] = A[i] A[minj] A minj A[i] A i A[i] = tmp A[i] A i tmp if i != minj:
            count += 1

     i != minj i minj count += 1 count 1 return A,count return A,count A count 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,count = selectionSort(A,N) A selectionSort(A,N) selectionSort A N count for i in range(len(A)):  # output
    if i == len(A) - 1:
        print(A[i])
    else:
        print(A[i], end=' ') i range(len(A)) range len(A) len A if i == len(A) - 1:
        print(A[i])
    else:
        print(A[i], end=' ') i == len(A) - 1 i len(A) - 1 len(A) len A 1 print(A[i]) print A[i] A i print(A[i], end=' ') print A[i] A i end=' ' end ' ' print(count) print count A,count = selectionSort(A,N) selectionSort(A,N) A N = int(input()) int(input()) N def selectionSort(A,N):
    count = 0
    for i in range(0,N-1):
        minj = i
        for j in range(i+1,N):
            if A[j] < A[minj]:
                minj = j
        tmp = A[minj]
        A[minj] = A[i]
        A[i] = tmp
        if i != minj:
            count += 1

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

    return A,count selectionSort A = list(map(int,input().split(' '))) list(map(int,input().split(' '))) A count = selectionSort(A,N) selectionSort(A,N) count
def selectionSort(A,N):
    count = 0
    for i in range(0,N-1):
        minj = i
        for j in range(i+1,N):
            if A[j] < A[minj]:
                minj = j
        tmp = A[minj]
        A[minj] = A[i]
        A[i] = tmp
        if i != minj:
            count += 1

    return A,count

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

A,count = selectionSort(A,N)

for i in range(len(A)):  # output
    if i == len(A) - 1:
        print(A[i])
    else:
        print(A[i], end=' ')

print(count)