def selectionSort(a, n):
    count = 0
    for i in range(n):
        minj = i
        for j in range(i, n):
            if a[j] < a[minj]:
                minj = j
        a[i], a[minj] = a[minj], a[i]
        count += 1 if i != minj else  0
    return count

def show(a, n):
    for i in range(n):
        if i == n-1:
            print "%d" % a[i]
        else:
            print "%d" % a[i],

n = input()
a = map(int, raw_input().split())
c = selectionSort(a, n)
show(a, n)
print "%d" % c def selectionSort(a, n):
    count = 0
    for i in range(n):
        minj = i
        for j in range(i, n):
            if a[j] < a[minj]:
                minj = j
        a[i], a[minj] = a[minj], a[i]
        count += 1 if i != minj else  0
    return count selectionSort count = 0 count 0 for i in range(n):
        minj = i
        for j in range(i, n):
            if a[j] < a[minj]:
                minj = j
        a[i], a[minj] = a[minj], a[i]
        count += 1 if i != minj else  0
     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 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 if i != minj else  0 count 1 if i != minj else  0 i != minj i minj 1 0 return count count a a n n def show(a, n):
    for i in range(n):
        if i == n-1:
            print "%d" % a[i]
        else:
            print "%d" % a[i], show for i in range(n):
        if i == n-1:
            print "%d" % a[i]
        else:
            print "%d" % a[i], i range(n) range n if i == n-1:
            print "%d" % a[i]
        else:
            print "%d" % a[i], i == n-1 i n-1 n 1 print "%d" % a[i] "%d" a[i] a i print "%d" % a[i] "%d" a[i] a i 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 show(a, n) show a n print "%d" % c "%d" c def selectionSort(a, n):
    count = 0
    for i in range(n):
        minj = i
        for j in range(i, n):
            if a[j] < a[minj]:
                minj = j
        a[i], a[minj] = a[minj], a[i]
        count += 1 if i != minj else  0
    return count def selectionSort(a, n):
    count = 0
    for i in range(n):
        minj = i
        for j in range(i, n):
            if a[j] < a[minj]:
                minj = j
        a[i], a[minj] = a[minj], a[i]
        count += 1 if i != minj else  0
    return count selectionSort c = selectionSort(a, n) selectionSort(a, n) c a = map(int, raw_input().split()) map(int, raw_input().split()) a n = input() input() n def show(a, n):
    for i in range(n):
        if i == n-1:
            print "%d" % a[i]
        else:
            print "%d" % a[i], def show(a, n):
    for i in range(n):
        if i == n-1:
            print "%d" % a[i]
        else:
            print "%d" % a[i], show
def selectionSort(a, n):
    count = 0
    for i in range(n):
        minj = i
        for j in range(i, n):
            if a[j] < a[minj]:
                minj = j
        a[i], a[minj] = a[minj], a[i]
        count += 1 if i != minj else  0
    return count

def show(a, n):
    for i in range(n):
        if i == n-1:
            print "%d" % a[i]
        else:
            print "%d" % a[i],

n = input()
a = map(int, raw_input().split())
c = selectionSort(a, n)
show(a, n)
print "%d" % c