def selection_Sort(A,N):
    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] = A[minj],A[i]
            count += 1
    return (count)

if __name__ == '__main__':
    n = int(input())
    data = [int(i) for i in input().split()]
    result = selection_Sort(data,n)
    print(" ".join(map(str,data)))
    print(result) def selection_Sort(A,N):
    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] = A[minj],A[i]
            count += 1
    return (count) selection_Sort count = 0 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] = A[minj],A[i]
            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] = 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 (count) count A A N N if __name__ == '__main__':
    n = int(input())
    data = [int(i) for i in input().split()]
    result = selection_Sort(data,n)
    print(" ".join(map(str,data)))
    print(result) __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 data = [int(i) for i in input().split()] data [int(i) for i in input().split()] result = selection_Sort(data,n) result selection_Sort(data,n) selection_Sort data n print(" ".join(map(str,data))) print " ".join(map(str,data)) " ".join " " join map(str,data) map str data print(result) print result n = int(input()) int(input()) n data = [int(i) for i in input().split()] [int(i) for i in input().split()] data result = selection_Sort(data,n) selection_Sort(data,n) result def selection_Sort(A,N):
    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] = A[minj],A[i]
            count += 1
    return (count) def selection_Sort(A,N):
    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] = A[minj],A[i]
            count += 1
    return (count) selection_Sort
def selection_Sort(A,N):
    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] = A[minj],A[i]
            count += 1
    return (count)

if __name__ == '__main__':
    n = int(input())
    data = [int(i) for i in input().split()]
    result = selection_Sort(data,n)
    print(" ".join(map(str,data)))
    print(result)