def selectionSort():
    N = int(input())
    A = list(map(int, input().split()))
    C = 0
    
    for i in range(N):
        minj = i
        for j in range(i, N):
            if A[j] < A[minj]:
                minj = j
        
        A[i], A[minj] = A[minj], A[i]
        if not(minj == i):
            C += 1
    
    print(*A)
    print(C)
    
selectionSort() def selectionSort():
    N = int(input())
    A = list(map(int, input().split()))
    C = 0
    
    for i in range(N):
        minj = i
        for j in range(i, N):
            if A[j] < A[minj]:
                minj = j
        
        A[i], A[minj] = A[minj], A[i]
        if not(minj == i):
            C += 1
    
    print(*A)
    print(C)
     selectionSort 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 C = 0 C 0 for i in range(N):
        minj = i
        for j in range(i, N):
            if A[j] < A[minj]:
                minj = j
        
        A[i], A[minj] = A[minj], A[i]
        if not(minj == i):
            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 A[i], A[minj] = A[minj], A[i] A[i] A i A[minj] A minj A[minj] A minj A[i] A i if not(minj == i):
            C += 1
    
     not(minj == i) minj == i minj i C += 1 C 1 print(*A) print *A A print(C) print C selectionSort() selectionSort def selectionSort():
    N = int(input())
    A = list(map(int, input().split()))
    C = 0
    
    for i in range(N):
        minj = i
        for j in range(i, N):
            if A[j] < A[minj]:
                minj = j
        
        A[i], A[minj] = A[minj], A[i]
        if not(minj == i):
            C += 1
    
    print(*A)
    print(C)
     def selectionSort():
    N = int(input())
    A = list(map(int, input().split()))
    C = 0
    
    for i in range(N):
        minj = i
        for j in range(i, N):
            if A[j] < A[minj]:
                minj = j
        
        A[i], A[minj] = A[minj], A[i]
        if not(minj == i):
            C += 1
    
    print(*A)
    print(C)
     selectionSort
def selectionSort():
    N = int(input())
    A = list(map(int, input().split()))
    C = 0
    
    for i in range(N):
        minj = i
        for j in range(i, N):
            if A[j] < A[minj]:
                minj = j
        
        A[i], A[minj] = A[minj], A[i]
        if not(minj == i):
            C += 1
    
    print(*A)
    print(C)
    
selectionSort()