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

# MAIN
N = input()
A = map(int, raw_input().split())
c = selectionSort(A, N)
print " ".join(map(str, A))
print c def selectionSort(A, N):
    count = 0
    for i in xrange(N):
        minj = i
        cflag = 0
        for j in xrange(i, N):
            if A[j] < A[minj]:
                minj = j
                cflag = 1
        A[i], A[minj] = A[minj], A[i]
        count+=cflag
    return count

# MAIN selectionSort count = 0 count 0 for i in xrange(N):
        minj = i
        cflag = 0
        for j in xrange(i, N):
            if A[j] < A[minj]:
                minj = j
                cflag = 1
        A[i], A[minj] = A[minj], A[i]
        count+=cflag
     i xrange(N) xrange N minj = i minj i cflag = 0 cflag 0 for j in xrange(i, N):
            if A[j] < A[minj]:
                minj = j
                cflag = 1
         j xrange(i, N) xrange i N if A[j] < A[minj]:
                minj = j
                cflag = 1
         A[j] < A[minj] A[j] A j A[minj] A minj minj = j minj j cflag = 1 cflag 1 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+=cflag count cflag return count count A A N N 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 c = selectionSort(A, N) c selectionSort(A, N) selectionSort A N print " ".join(map(str, A)) " ".join " " join map(str, A) map str A print def selectionSort(A, N):
    count = 0
    for i in xrange(N):
        minj = i
        cflag = 0
        for j in xrange(i, N):
            if A[j] < A[minj]:
                minj = j
                cflag = 1
        A[i], A[minj] = A[minj], A[i]
        count+=cflag
    return count

# MAIN def selectionSort(A, N):
    count = 0
    for i in xrange(N):
        minj = i
        cflag = 0
        for j in xrange(i, N):
            if A[j] < A[minj]:
                minj = j
                cflag = 1
        A[i], A[minj] = A[minj], A[i]
        count+=cflag
    return count

# MAIN selectionSort A = map(int, raw_input().split()) map(int, raw_input().split()) A c = selectionSort(A, N) selectionSort(A, N) c N = input() input() N
def selectionSort(A, N):
    count = 0
    for i in xrange(N):
        minj = i
        cflag = 0
        for j in xrange(i, N):
            if A[j] < A[minj]:
                minj = j
                cflag = 1
        A[i], A[minj] = A[minj], A[i]
        count+=cflag
    return count

# MAIN
N = input()
A = map(int, raw_input().split())
c = selectionSort(A, N)
print " ".join(map(str, A))
print c