from sys import stdin
def stdinput():
    return stdin.readline().strip()

def main():
    n = int(stdinput())
    A = list(map(int, stdinput().split()))

    count = 0
    for i in range(n):
        min_idx = i
        for j in range(i, n):
            if A[j] < A[min_idx]:
                min_idx = j
        if min_idx != i:
            A[i], A[min_idx] = A[min_idx], A[i]
            count += 1
    
    print(' '.join(map(str, A)))
    print(count)

if __name__ == '__main__':
    main() from sys import stdin def stdinput():
    return stdin.readline().strip() stdinput return stdin.readline().strip() stdin.readline().strip() stdin.readline().strip stdin.readline() stdin.readline stdin readline strip def main():
    n = int(stdinput())
    A = list(map(int, stdinput().split()))

    count = 0
    for i in range(n):
        min_idx = i
        for j in range(i, n):
            if A[j] < A[min_idx]:
                min_idx = j
        if min_idx != i:
            A[i], A[min_idx] = A[min_idx], A[i]
            count += 1
    
    print(' '.join(map(str, A)))
    print(count) main n = int(stdinput()) n int(stdinput()) int stdinput() stdinput A = list(map(int, stdinput().split())) A list(map(int, stdinput().split())) list map(int, stdinput().split()) map int stdinput().split() ().split () stdinput split count = 0 count 0 for i in range(n):
        min_idx = i
        for j in range(i, n):
            if A[j] < A[min_idx]:
                min_idx = j
        if min_idx != i:
            A[i], A[min_idx] = A[min_idx], A[i]
            count += 1
    
     i range(n) range n min_idx = i min_idx i for j in range(i, n):
            if A[j] < A[min_idx]:
                min_idx = j
         j range(i, n) range i n if A[j] < A[min_idx]:
                min_idx = j
         A[j] < A[min_idx] A[j] A j A[min_idx] A min_idx min_idx = j min_idx j if min_idx != i:
            A[i], A[min_idx] = A[min_idx], A[i]
            count += 1
    
     min_idx != i min_idx i A[i], A[min_idx] = A[min_idx], A[i] A[i] A i A[min_idx] A min_idx A[min_idx] A min_idx A[i] A i count += 1 count 1 print(' '.join(map(str, A))) print ' '.join(map(str, A)) ' '.join ' ' join map(str, A) map str A print(count) print count if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    n = int(stdinput())
    A = list(map(int, stdinput().split()))

    count = 0
    for i in range(n):
        min_idx = i
        for j in range(i, n):
            if A[j] < A[min_idx]:
                min_idx = j
        if min_idx != i:
            A[i], A[min_idx] = A[min_idx], A[i]
            count += 1
    
    print(' '.join(map(str, A)))
    print(count) def main():
    n = int(stdinput())
    A = list(map(int, stdinput().split()))

    count = 0
    for i in range(n):
        min_idx = i
        for j in range(i, n):
            if A[j] < A[min_idx]:
                min_idx = j
        if min_idx != i:
            A[i], A[min_idx] = A[min_idx], A[i]
            count += 1
    
    print(' '.join(map(str, A)))
    print(count) main def stdinput():
    return stdin.readline().strip() def stdinput():
    return stdin.readline().strip() stdinput
from sys import stdin
def stdinput():
    return stdin.readline().strip()

def main():
    n = int(stdinput())
    A = list(map(int, stdinput().split()))

    count = 0
    for i in range(n):
        min_idx = i
        for j in range(i, n):
            if A[j] < A[min_idx]:
                min_idx = j
        if min_idx != i:
            A[i], A[min_idx] = A[min_idx], A[i]
            count += 1
    
    print(' '.join(map(str, A)))
    print(count)

if __name__ == '__main__':
    main()
