def selectionSort(A, N): # N個の要素を含む0-オリジンの配列A
    A = list(map(int, A.split(" ")))
    change_count = 0
    for i in range(N):
        minj = i
        for j in range(i,N):
            if A[j] < A[minj]:
                minj = j
        if i != minj:
            #A[i] と A[minj] を交換
            tmp = A[i]
            A[i] = A[minj]
            A[minj] = tmp
            change_count+=1
    
    # 回答
    print(" ".join(map(str,A)))
    print(change_count)
    #return True

# 入力
N = int(input())  # 数列の長さを表す整数（N）
A = input("")   # N個の整数が空白区切り
selectionSort(A,N)
 def selectionSort(A, N): # N個の要素を含む0-オリジンの配列A
    A = list(map(int, A.split(" ")))
    change_count = 0
    for i in range(N):
        minj = i
        for j in range(i,N):
            if A[j] < A[minj]:
                minj = j
        if i != minj:
            #A[i] と A[minj] を交換
            tmp = A[i]
            A[i] = A[minj]
            A[minj] = tmp
            change_count+=1
    
    # 回答
    print(" ".join(map(str,A)))
    print(change_count)
    #return True

# 入力 selectionSort A = list(map(int, A.split(" "))) A list(map(int, A.split(" "))) list map(int, A.split(" ")) map int A.split(" ") A.split A split " " change_count = 0 change_count 0 for i in range(N):
        minj = i
        for j in range(i,N):
            if A[j] < A[minj]:
                minj = j
        if i != minj:
            #A[i] と A[minj] を交換
            tmp = A[i]
            A[i] = A[minj]
            A[minj] = tmp
            change_count+=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:
            #A[i] と A[minj] を交換
            tmp = A[i]
            A[i] = A[minj]
            A[minj] = tmp
            change_count+=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 change_count+=1 change_count 1 print(" ".join(map(str,A))) print " ".join(map(str,A)) " ".join " " join map(str,A) map str A print(change_count) print change_count A A N N N = int(input()) N int(input()) int input() input A = input("") A input("") input "" selectionSort(A,N) selectionSort A N A = input("") input("") A def selectionSort(A, N): # N個の要素を含む0-オリジンの配列A
    A = list(map(int, A.split(" ")))
    change_count = 0
    for i in range(N):
        minj = i
        for j in range(i,N):
            if A[j] < A[minj]:
                minj = j
        if i != minj:
            #A[i] と A[minj] を交換
            tmp = A[i]
            A[i] = A[minj]
            A[minj] = tmp
            change_count+=1
    
    # 回答
    print(" ".join(map(str,A)))
    print(change_count)
    #return True

# 入力 def selectionSort(A, N): # N個の要素を含む0-オリジンの配列A
    A = list(map(int, A.split(" ")))
    change_count = 0
    for i in range(N):
        minj = i
        for j in range(i,N):
            if A[j] < A[minj]:
                minj = j
        if i != minj:
            #A[i] と A[minj] を交換
            tmp = A[i]
            A[i] = A[minj]
            A[minj] = tmp
            change_count+=1
    
    # 回答
    print(" ".join(map(str,A)))
    print(change_count)
    #return True

# 入力 selectionSort N = int(input()) int(input()) N
def selectionSort(A, N): # N個の要素を含む0-オリジンの配列A
    A = list(map(int, A.split(" ")))
    change_count = 0
    for i in range(N):
        minj = i
        for j in range(i,N):
            if A[j] < A[minj]:
                minj = j
        if i != minj:
            #A[i] と A[minj] を交換
            tmp = A[i]
            A[i] = A[minj]
            A[minj] = tmp
            change_count+=1
    
    # 回答
    print(" ".join(map(str,A)))
    print(change_count)
    #return True

# 入力
N = int(input())  # 数列の長さを表す整数（N）
A = input("")   # N個の整数が空白区切り
selectionSort(A,N)

