# encode: utf-8

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

def main():
    n = input()
    a = map(int, raw_input().split())
    a, count = selectionSort(a, n)
    print " ".join(map(str, a))
    print count

main() def selectionSort(A, N):
    count = 0
    for i in xrange(0, N):
        minj = i
        for j in xrange(i, N):
            if A[j] < A[minj]:
                minj = j
        if i != minj:
            A[i] , A[minj] = A[minj], A[i]
            count += 1
    return A, count selectionSort count = 0 count 0 for i in xrange(0, N):
        minj = i
        for j in xrange(i, N):
            if A[j] < A[minj]:
                minj = j
        if i != minj:
            A[i] , A[minj] = A[minj], A[i]
            count += 1
     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 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 A, count return A, count A count A A N N def main():
    n = input()
    a = map(int, raw_input().split())
    a, count = selectionSort(a, n)
    print " ".join(map(str, a))
    print count 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 a, count = selectionSort(a, n) a selectionSort(a, n) selectionSort a n count print " ".join(map(str, a)) " ".join " " join map(str, a) map str a print main() main def main():
    n = input()
    a = map(int, raw_input().split())
    a, count = selectionSort(a, n)
    print " ".join(map(str, a))
    print count def main():
    n = input()
    a = map(int, raw_input().split())
    a, count = selectionSort(a, n)
    print " ".join(map(str, a))
    print count main def selectionSort(A, N):
    count = 0
    for i in xrange(0, N):
        minj = i
        for j in xrange(i, N):
            if A[j] < A[minj]:
                minj = j
        if i != minj:
            A[i] , A[minj] = A[minj], A[i]
            count += 1
    return A, count def selectionSort(A, N):
    count = 0
    for i in xrange(0, N):
        minj = i
        for j in xrange(i, N):
            if A[j] < A[minj]:
                minj = j
        if i != minj:
            A[i] , A[minj] = A[minj], A[i]
            count += 1
    return A, count selectionSort
# encode: utf-8

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

def main():
    n = input()
    a = map(int, raw_input().split())
    a, count = selectionSort(a, n)
    print " ".join(map(str, a))
    print count

main()