def selection(A, N):
    count = 0
    for i in range(0, 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]
            count += 1
    return A, count



if __name__ == "__main__":
    N = int(input())
    A = [int(i) for i in input().split()]

    A, count = selection(A, N)
    print (*A)
    print (count) def selection(A, N):
    count = 0
    for i in range(0, 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]
            count += 1
    return A, count selection count = 0 count 0 for i in range(0, 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]
            count += 1
     i range(0, N) range 0 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]
            count += 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 count += 1 count 1 return A, count return A, count A count A A N N if __name__ == "__main__":
    N = int(input())
    A = [int(i) for i in input().split()]

    A, count = selection(A, N)
    print (*A)
    print (count) __name__ == "__main__" __name__ "__main__" N = int(input()) N int(input()) int input() input int(i) for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() int(i) int i A = [int(i) for i in input().split()] A [int(i) for i in input().split()] A, count = selection(A, N) A selection(A, N) selection A N count print (*A) print *A A print (count) print count A, count = selection(A, N) selection(A, N) A A = [int(i) for i in input().split()] [int(i) for i in input().split()] A def selection(A, N):
    count = 0
    for i in range(0, 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]
            count += 1
    return A, count def selection(A, N):
    count = 0
    for i in range(0, 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]
            count += 1
    return A, count selection N = int(input()) int(input()) N count = selection(A, N) selection(A, N) count
def selection(A, N):
    count = 0
    for i in range(0, 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]
            count += 1
    return A, count



if __name__ == "__main__":
    N = int(input())
    A = [int(i) for i in input().split()]

    A, count = selection(A, N)
    print (*A)
    print (count)