N = int(input())
A = [int(e) for e in input().split()]

def selection_sort(A, N):
    steps = 0
    for i in range(0, N):
        minj = i
        for j in range(i, N):
            if A[minj] > A[j]:
                minj = j
        if i != minj:
            steps += 1
        A[minj], A[i] = A[i], A[minj]

    for e in A[:-1]:
        print(e, end=' ')
    print(A[-1])
    print(steps)
    return A

selection_sort(A, N) N = int(input()) N int(input()) int input() input int(e) for e in input().split() for e in input().split() e input().split() ().split () input split for e in input().split() int(e) int e A = [int(e) for e in input().split()] A [int(e) for e in input().split()] def selection_sort(A, N):
    steps = 0
    for i in range(0, N):
        minj = i
        for j in range(i, N):
            if A[minj] > A[j]:
                minj = j
        if i != minj:
            steps += 1
        A[minj], A[i] = A[i], A[minj]

    for e in A[:-1]:
        print(e, end=' ')
    print(A[-1])
    print(steps)
    return A selection_sort steps = 0 steps 0 for i in range(0, N):
        minj = i
        for j in range(i, N):
            if A[minj] > A[j]:
                minj = j
        if i != minj:
            steps += 1
        A[minj], A[i] = A[i], A[minj]

     i range(0, N) range 0 N minj = i minj i for j in range(i, N):
            if A[minj] > A[j]:
                minj = j
         j range(i, N) range i N if A[minj] > A[j]:
                minj = j
         A[minj] > A[j] A[minj] A minj A[j] A j minj = j minj j if i != minj:
            steps += 1
         i != minj i minj steps += 1 steps 1 A[minj], A[i] = A[i], A[minj] A[minj] A minj A[i] A i A[i] A i A[minj] A minj for e in A[:-1]:
        print(e, end=' ')
     e A[:-1] A :-1 -1 print(e, end=' ') print e end=' ' end ' ' print(A[-1]) print A[-1] A -1 print(steps) print steps return A A A A N N selection_sort(A, N) selection_sort A N def selection_sort(A, N):
    steps = 0
    for i in range(0, N):
        minj = i
        for j in range(i, N):
            if A[minj] > A[j]:
                minj = j
        if i != minj:
            steps += 1
        A[minj], A[i] = A[i], A[minj]

    for e in A[:-1]:
        print(e, end=' ')
    print(A[-1])
    print(steps)
    return A def selection_sort(A, N):
    steps = 0
    for i in range(0, N):
        minj = i
        for j in range(i, N):
            if A[minj] > A[j]:
                minj = j
        if i != minj:
            steps += 1
        A[minj], A[i] = A[i], A[minj]

    for e in A[:-1]:
        print(e, end=' ')
    print(A[-1])
    print(steps)
    return A selection_sort A = [int(e) for e in input().split()] [int(e) for e in input().split()] A N = int(input()) int(input()) N
N = int(input())
A = [int(e) for e in input().split()]

def selection_sort(A, N):
    steps = 0
    for i in range(0, N):
        minj = i
        for j in range(i, N):
            if A[minj] > A[j]:
                minj = j
        if i != minj:
            steps += 1
        A[minj], A[i] = A[i], A[minj]

    for e in A[:-1]:
        print(e, end=' ')
    print(A[-1])
    print(steps)
    return A

selection_sort(A, N)
