# -*- coding: utf-8 -*-


def selection_sort(A, N):
    change = 0
    for i in xrange(N):
        minj = i
        for j in xrange(i, N, 1):
            if A[j] < A[minj]:
                minj = j
        if minj != i:
            temp = A[minj]
            A[minj] = A[i]
            A[i] = temp
            change += 1
    return (A, change)


if __name__ == "__main__":
    N = input()
    A = map(int, raw_input().split())
    result, change = selection_sort(A, N)
    print ' '.join(map(str, result))
    print change def selection_sort(A, N):
    change = 0
    for i in xrange(N):
        minj = i
        for j in xrange(i, N, 1):
            if A[j] < A[minj]:
                minj = j
        if minj != i:
            temp = A[minj]
            A[minj] = A[i]
            A[i] = temp
            change += 1
    return (A, change) selection_sort change = 0 change 0 for i in xrange(N):
        minj = i
        for j in xrange(i, N, 1):
            if A[j] < A[minj]:
                minj = j
        if minj != i:
            temp = A[minj]
            A[minj] = A[i]
            A[i] = temp
            change += 1
     i xrange(N) xrange N minj = i minj i for j in xrange(i, N, 1):
            if A[j] < A[minj]:
                minj = j
         j xrange(i, N, 1) xrange i N 1 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:
            temp = A[minj]
            A[minj] = A[i]
            A[i] = temp
            change += 1
     minj != i minj i temp = A[minj] temp A[minj] A minj A[minj] = A[i] A[minj] A minj A[i] A i A[i] = temp A[i] A i temp change += 1 change 1 return (A, change) (A, change) A change A A N N if __name__ == "__main__":
    N = input()
    A = map(int, raw_input().split())
    result, change = selection_sort(A, N)
    print ' '.join(map(str, result))
    print change __name__ == "__main__" __name__ "__main__" N = input() N input() input A = map(int, raw_input().split()) A map(int, raw_input().split()) map int raw_input().split() ().split () raw_input split result, change = selection_sort(A, N) result selection_sort(A, N) selection_sort A N change print ' '.join(map(str, result)) ' '.join ' ' join map(str, result) map str result print def selection_sort(A, N):
    change = 0
    for i in xrange(N):
        minj = i
        for j in xrange(i, N, 1):
            if A[j] < A[minj]:
                minj = j
        if minj != i:
            temp = A[minj]
            A[minj] = A[i]
            A[i] = temp
            change += 1
    return (A, change) def selection_sort(A, N):
    change = 0
    for i in xrange(N):
        minj = i
        for j in xrange(i, N, 1):
            if A[j] < A[minj]:
                minj = j
        if minj != i:
            temp = A[minj]
            A[minj] = A[i]
            A[i] = temp
            change += 1
    return (A, change) selection_sort N = input() input() N result, change = selection_sort(A, N) selection_sort(A, N) result A = map(int, raw_input().split()) map(int, raw_input().split()) A change = selection_sort(A, N) selection_sort(A, N) change
# -*- coding: utf-8 -*-


def selection_sort(A, N):
    change = 0
    for i in xrange(N):
        minj = i
        for j in xrange(i, N, 1):
            if A[j] < A[minj]:
                minj = j
        if minj != i:
            temp = A[minj]
            A[minj] = A[i]
            A[i] = temp
            change += 1
    return (A, change)


if __name__ == "__main__":
    N = input()
    A = map(int, raw_input().split())
    result, change = selection_sort(A, N)
    print ' '.join(map(str, result))
    print change