def selection(a, n):
    cnt = 0
    for i in range(n):
        flag = 0
        minj = i
        for j in range(i+1,n):
            if a[j] < a[minj]:
                minj = j
                flag = 1
        if flag == 1:
            temp = a[minj]
            a[minj] = a[i]
            a[i] = temp
            cnt += 1
    return cnt

n = int(input())
a = list(map(int, input().split()))

cnt = selection(a, n)   
ans = str(a[0])
for i in range(1,n):
    ans += ' '+str(a[i])           
print(ans)
print(cnt) def selection(a, n):
    cnt = 0
    for i in range(n):
        flag = 0
        minj = i
        for j in range(i+1,n):
            if a[j] < a[minj]:
                minj = j
                flag = 1
        if flag == 1:
            temp = a[minj]
            a[minj] = a[i]
            a[i] = temp
            cnt += 1
    return cnt selection cnt = 0 cnt 0 for i in range(n):
        flag = 0
        minj = i
        for j in range(i+1,n):
            if a[j] < a[minj]:
                minj = j
                flag = 1
        if flag == 1:
            temp = a[minj]
            a[minj] = a[i]
            a[i] = temp
            cnt += 1
     i range(n) range n flag = 0 flag 0 minj = i minj i for j in range(i+1,n):
            if a[j] < a[minj]:
                minj = j
                flag = 1
         j range(i+1,n) range i+1 i 1 n if a[j] < a[minj]:
                minj = j
                flag = 1
         a[j] < a[minj] a[j] a j a[minj] a minj minj = j minj j flag = 1 flag 1 if flag == 1:
            temp = a[minj]
            a[minj] = a[i]
            a[i] = temp
            cnt += 1
     flag == 1 flag 1 temp = a[minj] temp a[minj] a minj a[minj] = a[i] a[minj] a minj a[i] a i a[i] = temp a[i] a i temp cnt += 1 cnt 1 return cnt cnt 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 cnt = selection(a, n) cnt selection(a, n) selection a n ans = str(a[0]) ans str(a[0]) str a[0] a 0 for i in range(1,n):
    ans += ' '+str(a[i])            i range(1,n) range 1 n ans += ' '+str(a[i]) ans ' '+str(a[i]) ' ' str(a[i]) str a[i] a i print(ans) print ans print(cnt) print cnt ans += ' '+str(a[i]) ' '+str(a[i]) ans def selection(a, n):
    cnt = 0
    for i in range(n):
        flag = 0
        minj = i
        for j in range(i+1,n):
            if a[j] < a[minj]:
                minj = j
                flag = 1
        if flag == 1:
            temp = a[minj]
            a[minj] = a[i]
            a[i] = temp
            cnt += 1
    return cnt def selection(a, n):
    cnt = 0
    for i in range(n):
        flag = 0
        minj = i
        for j in range(i+1,n):
            if a[j] < a[minj]:
                minj = j
                flag = 1
        if flag == 1:
            temp = a[minj]
            a[minj] = a[i]
            a[i] = temp
            cnt += 1
    return cnt selection cnt = selection(a, n) selection(a, n) cnt n = int(input()) int(input()) n ans = str(a[0]) str(a[0]) ans a = list(map(int, input().split())) list(map(int, input().split())) a
def selection(a, n):
    cnt = 0
    for i in range(n):
        flag = 0
        minj = i
        for j in range(i+1,n):
            if a[j] < a[minj]:
                minj = j
                flag = 1
        if flag == 1:
            temp = a[minj]
            a[minj] = a[i]
            a[i] = temp
            cnt += 1
    return cnt

n = int(input())
a = list(map(int, input().split()))

cnt = selection(a, n)   
ans = str(a[0])
for i in range(1,n):
    ans += ' '+str(a[i])           
print(ans)
print(cnt)
