def selection_sort(a,n):
    count = 0
    for i in range(n):
        minj = i
        for j in range(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)

n = int(input())
a = list(map(int, input().split()))
a,c = selection_sort(a,n)
print(' '.join(map(str, a)))
print(c) def selection_sort(a,n):
    count = 0
    for i in range(n):
        minj = i
        for j in range(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) selection_sort count = 0 count 0 for i in range(n):
        minj = i
        for j in range(i,n):
            if a[j] < a[minj]:
                minj = j
        if i != minj:
            a[i],a[minj] = a[minj],a[i]
            count += 1

     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 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) (a,count) a count a a n n n = int(input()) n int(input()) int input() input a = list(map(int, input().split())) a list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split a,c = selection_sort(a,n) a selection_sort(a,n) selection_sort a n c print(' '.join(map(str, a))) print ' '.join(map(str, a)) ' '.join ' ' join map(str, a) map str a print(c) print c n = int(input()) int(input()) n def selection_sort(a,n):
    count = 0
    for i in range(n):
        minj = i
        for j in range(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 selection_sort(a,n):
    count = 0
    for i in range(n):
        minj = i
        for j in range(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) selection_sort a = list(map(int, input().split())) list(map(int, input().split())) a c = selection_sort(a,n) selection_sort(a,n) c a,c = selection_sort(a,n) selection_sort(a,n) a
def selection_sort(a,n):
    count = 0
    for i in range(n):
        minj = i
        for j in range(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)

n = int(input())
a = list(map(int, input().split()))
a,c = selection_sort(a,n)
print(' '.join(map(str, a)))
print(c)