def selection_sort(a, n):
    cnt = 0
    for i in range(0, n):
        minj = i
        for j in range(i, n):
            if a[j] < a[minj]:
                minj = j
        if i != minj:
            tmp = a[i]
            a[i] = a[minj]
            a[minj] = tmp
            cnt += 1
    return a, cnt

a = []
n = int(input())
s = input()
a = list(map(int, s.split()))
a, cnt = selection_sort(a, n)
print(*a)
print(cnt) def selection_sort(a, n):
    cnt = 0
    for i in range(0, n):
        minj = i
        for j in range(i, n):
            if a[j] < a[minj]:
                minj = j
        if i != minj:
            tmp = a[i]
            a[i] = a[minj]
            a[minj] = tmp
            cnt += 1
    return a, cnt selection_sort cnt = 0 cnt 0 for i in range(0, n):
        minj = i
        for j in range(i, n):
            if a[j] < a[minj]:
                minj = j
        if i != minj:
            tmp = a[i]
            a[i] = a[minj]
            a[minj] = tmp
            cnt += 1
     i range(0, n) range 0 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:
            tmp = a[i]
            a[i] = a[minj]
            a[minj] = tmp
            cnt += 1
     i != minj i minj tmp = a[i] tmp a[i] a i a[i] = a[minj] a[i] a i a[minj] a minj a[minj] = tmp a[minj] a minj tmp cnt += 1 cnt 1 return a, cnt return a, cnt a cnt a a n n a = [] a [] n = int(input()) n int(input()) int input() input s = input() s input() input a = list(map(int, s.split())) a list(map(int, s.split())) list map(int, s.split()) map int s.split() s.split s split a, cnt = selection_sort(a, n) a selection_sort(a, n) selection_sort a n cnt print(*a) print *a a print(cnt) print cnt a = list(map(int, s.split())) list(map(int, s.split())) a s = input() input() s def selection_sort(a, n):
    cnt = 0
    for i in range(0, n):
        minj = i
        for j in range(i, n):
            if a[j] < a[minj]:
                minj = j
        if i != minj:
            tmp = a[i]
            a[i] = a[minj]
            a[minj] = tmp
            cnt += 1
    return a, cnt def selection_sort(a, n):
    cnt = 0
    for i in range(0, n):
        minj = i
        for j in range(i, n):
            if a[j] < a[minj]:
                minj = j
        if i != minj:
            tmp = a[i]
            a[i] = a[minj]
            a[minj] = tmp
            cnt += 1
    return a, cnt selection_sort n = int(input()) int(input()) n a, cnt = selection_sort(a, n) selection_sort(a, n) a cnt = selection_sort(a, n) selection_sort(a, n) cnt a = [] [] a
def selection_sort(a, n):
    cnt = 0
    for i in range(0, n):
        minj = i
        for j in range(i, n):
            if a[j] < a[minj]:
                minj = j
        if i != minj:
            tmp = a[i]
            a[i] = a[minj]
            a[minj] = tmp
            cnt += 1
    return a, cnt

a = []
n = int(input())
s = input()
a = list(map(int, s.split()))
a, cnt = selection_sort(a, n)
print(*a)
print(cnt)