
def print_array(A, N):
    for i in xrange(N - 1):
        print str(A[i]),

    print A[N - 1]

def selectionSort(A, N):
    swap_num = 0
    for i in xrange(0, N):
        minj = i
        for j in xrange(i, N):
            if A[j] < A[minj]:
                minj = j

        if minj != i:
            swap_num += 1
            temp = A[i]
            A[i] = A[minj]
            A[minj] = temp

    return swap_num

def main():
    N = int(raw_input())
    A = []

    for num in raw_input().split():
        A.append(int(num))

    temp = selectionSort(A, N)
    print_array(A, N)

    print temp


if __name__ == "__main__":
    main() def print_array(A, N):
    for i in xrange(N - 1):
        print str(A[i]),

    print A[N - 1] print_array for i in xrange(N - 1):
        print str(A[i]),

     i xrange(N - 1) xrange N - 1 N 1 print str(A[i]) str A[i] A i print A[N - 1] A N - 1 N 1 A A N N def selectionSort(A, N):
    swap_num = 0
    for i in xrange(0, N):
        minj = i
        for j in xrange(i, N):
            if A[j] < A[minj]:
                minj = j

        if minj != i:
            swap_num += 1
            temp = A[i]
            A[i] = A[minj]
            A[minj] = temp

    return swap_num selectionSort swap_num = 0 swap_num 0 for i in xrange(0, N):
        minj = i
        for j in xrange(i, N):
            if A[j] < A[minj]:
                minj = j

        if minj != i:
            swap_num += 1
            temp = A[i]
            A[i] = A[minj]
            A[minj] = temp

     i xrange(0, N) xrange 0 N minj = i minj i for j in xrange(i, N):
            if A[j] < A[minj]:
                minj = j

         j xrange(i, N) xrange 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 minj != i:
            swap_num += 1
            temp = A[i]
            A[i] = A[minj]
            A[minj] = temp

     minj != i minj i swap_num += 1 swap_num 1 temp = A[i] temp A[i] A i A[i] = A[minj] A[i] A i A[minj] A minj A[minj] = temp A[minj] A minj temp return swap_num swap_num A A N N def main():
    N = int(raw_input())
    A = []

    for num in raw_input().split():
        A.append(int(num))

    temp = selectionSort(A, N)
    print_array(A, N)

    print temp main N = int(raw_input()) N int(raw_input()) int raw_input() raw_input A = [] A [] for num in raw_input().split():
        A.append(int(num))

     num raw_input().split() ().split () raw_input split A.append(int(num)) A.append A append int(num) int num temp = selectionSort(A, N) temp selectionSort(A, N) selectionSort A N print_array(A, N) print_array A N print if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def main():
    N = int(raw_input())
    A = []

    for num in raw_input().split():
        A.append(int(num))

    temp = selectionSort(A, N)
    print_array(A, N)

    print temp def main():
    N = int(raw_input())
    A = []

    for num in raw_input().split():
        A.append(int(num))

    temp = selectionSort(A, N)
    print_array(A, N)

    print temp main def selectionSort(A, N):
    swap_num = 0
    for i in xrange(0, N):
        minj = i
        for j in xrange(i, N):
            if A[j] < A[minj]:
                minj = j

        if minj != i:
            swap_num += 1
            temp = A[i]
            A[i] = A[minj]
            A[minj] = temp

    return swap_num def selectionSort(A, N):
    swap_num = 0
    for i in xrange(0, N):
        minj = i
        for j in xrange(i, N):
            if A[j] < A[minj]:
                minj = j

        if minj != i:
            swap_num += 1
            temp = A[i]
            A[i] = A[minj]
            A[minj] = temp

    return swap_num selectionSort def print_array(A, N):
    for i in xrange(N - 1):
        print str(A[i]),

    print A[N - 1] def print_array(A, N):
    for i in xrange(N - 1):
        print str(A[i]),

    print A[N - 1] print_array

def print_array(A, N):
    for i in xrange(N - 1):
        print str(A[i]),

    print A[N - 1]

def selectionSort(A, N):
    swap_num = 0
    for i in xrange(0, N):
        minj = i
        for j in xrange(i, N):
            if A[j] < A[minj]:
                minj = j

        if minj != i:
            swap_num += 1
            temp = A[i]
            A[i] = A[minj]
            A[minj] = temp

    return swap_num

def main():
    N = int(raw_input())
    A = []

    for num in raw_input().split():
        A.append(int(num))

    temp = selectionSort(A, N)
    print_array(A, N)

    print temp


if __name__ == "__main__":
    main()