def selection_sort(a, n):
    sw_num = 0
    for i in range(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
            sw_num += 1

    return sw_num


n = int(input())
a = [int(i) for i in input().split()]

sw_num = selection_sort(a, n)

print(' '.join([str(i) for i in a]))
print(sw_num) def selection_sort(a, n):
    sw_num = 0
    for i in range(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
            sw_num += 1

    return sw_num selection_sort sw_num = 0 sw_num 0 for i in range(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
            sw_num += 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:
            tmp = a[i]
            a[i] = a[minj]
            a[minj] = tmp
            sw_num += 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 sw_num += 1 sw_num 1 return sw_num sw_num a a n n n = int(input()) n int(input()) int input() input int(i) for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() int(i) int i a = [int(i) for i in input().split()] a [int(i) for i in input().split()] sw_num = selection_sort(a, n) sw_num selection_sort(a, n) selection_sort a n str(i) for i in a for i in a i a for i in a str(i) str i print(' '.join([str(i) for i in a])) print ' '.join([str(i) for i in a]) ' '.join ' ' join [str(i) for i in a] print(sw_num) print sw_num n = int(input()) int(input()) n a = [int(i) for i in input().split()] [int(i) for i in input().split()] a sw_num = selection_sort(a, n) selection_sort(a, n) sw_num def selection_sort(a, n):
    sw_num = 0
    for i in range(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
            sw_num += 1

    return sw_num def selection_sort(a, n):
    sw_num = 0
    for i in range(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
            sw_num += 1

    return sw_num selection_sort
def selection_sort(a, n):
    sw_num = 0
    for i in range(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
            sw_num += 1

    return sw_num


n = int(input())
a = [int(i) for i in input().split()]

sw_num = selection_sort(a, n)

print(' '.join([str(i) for i in a]))
print(sw_num)
