#coding: UTF-8

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


def InsertionSort(A,N):
    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:
            tmp = A[i]
            A[i] = A[minj]
            A[minj] = tmp
            c+=1

    for i in range(N - 1):
        print(A[i],end=' ')
    print(A[N - 1])
    print(c)

InsertionSort(A,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 def InsertionSort(A,N):
    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:
            tmp = A[i]
            A[i] = A[minj]
            A[minj] = tmp
            c+=1

    for i in range(N - 1):
        print(A[i],end=' ')
    print(A[N - 1])
    print(c) InsertionSort 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:
            tmp = A[i]
            A[i] = A[minj]
            A[minj] = tmp
            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:
            tmp = A[i]
            A[i] = A[minj]
            A[minj] = tmp
            c+=1

     i != minj i minj tmp = A[i] tmp A[i] A i A[i] = A[minj] A[i] A i A[minj] A minj A[minj] = tmp A[minj] A minj tmp c+=1 c 1 for i in range(N - 1):
        print(A[i],end=' ')
     i range(N - 1) range N - 1 N 1 print(A[i],end=' ') print A[i] A i end=' ' end ' ' print(A[N - 1]) print A[N - 1] A N - 1 N 1 print(c) print c A A N N InsertionSort(A,N) InsertionSort A N def InsertionSort(A,N):
    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:
            tmp = A[i]
            A[i] = A[minj]
            A[minj] = tmp
            c+=1

    for i in range(N - 1):
        print(A[i],end=' ')
    print(A[N - 1])
    print(c) def InsertionSort(A,N):
    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:
            tmp = A[i]
            A[i] = A[minj]
            A[minj] = tmp
            c+=1

    for i in range(N - 1):
        print(A[i],end=' ')
    print(A[N - 1])
    print(c) InsertionSort N = int(input()) int(input()) N A = list(map(int, input().split())) list(map(int, input().split())) A
#coding: UTF-8

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


def InsertionSort(A,N):
    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:
            tmp = A[i]
            A[i] = A[minj]
            A[minj] = tmp
            c+=1

    for i in range(N - 1):
        print(A[i],end=' ')
    print(A[N - 1])
    print(c)

InsertionSort(A,N)