def main():
    n = int(input())
    array = [int(x) for x in input().split()]

    cnt = 0
    for i in range(n):
        min_idx = i
        for j in range(i+1, n):
            if array[min_idx] > array[j]:
                min_idx = j
        if min_idx != i:
            tmp = array[i]
            array[i] = array[min_idx]
            array[min_idx] = tmp
            cnt += 1

    print(" ".join(map(str, array)))
    print(cnt)


main() def main():
    n = int(input())
    array = [int(x) for x in input().split()]

    cnt = 0
    for i in range(n):
        min_idx = i
        for j in range(i+1, n):
            if array[min_idx] > array[j]:
                min_idx = j
        if min_idx != i:
            tmp = array[i]
            array[i] = array[min_idx]
            array[min_idx] = tmp
            cnt += 1

    print(" ".join(map(str, array)))
    print(cnt) main n = int(input()) n int(input()) int input() input int(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) int x array = [int(x) for x in input().split()] array [int(x) for x in input().split()] cnt = 0 cnt 0 for i in range(n):
        min_idx = i
        for j in range(i+1, n):
            if array[min_idx] > array[j]:
                min_idx = j
        if min_idx != i:
            tmp = array[i]
            array[i] = array[min_idx]
            array[min_idx] = tmp
            cnt += 1

     i range(n) range n min_idx = i min_idx i for j in range(i+1, n):
            if array[min_idx] > array[j]:
                min_idx = j
         j range(i+1, n) range i+1 i 1 n if array[min_idx] > array[j]:
                min_idx = j
         array[min_idx] > array[j] array[min_idx] array min_idx array[j] array j min_idx = j min_idx j if min_idx != i:
            tmp = array[i]
            array[i] = array[min_idx]
            array[min_idx] = tmp
            cnt += 1

     min_idx != i min_idx i tmp = array[i] tmp array[i] array i array[i] = array[min_idx] array[i] array i array[min_idx] array min_idx array[min_idx] = tmp array[min_idx] array min_idx tmp cnt += 1 cnt 1 print(" ".join(map(str, array))) print " ".join(map(str, array)) " ".join " " join map(str, array) map str array print(cnt) print cnt main() main def main():
    n = int(input())
    array = [int(x) for x in input().split()]

    cnt = 0
    for i in range(n):
        min_idx = i
        for j in range(i+1, n):
            if array[min_idx] > array[j]:
                min_idx = j
        if min_idx != i:
            tmp = array[i]
            array[i] = array[min_idx]
            array[min_idx] = tmp
            cnt += 1

    print(" ".join(map(str, array)))
    print(cnt) def main():
    n = int(input())
    array = [int(x) for x in input().split()]

    cnt = 0
    for i in range(n):
        min_idx = i
        for j in range(i+1, n):
            if array[min_idx] > array[j]:
                min_idx = j
        if min_idx != i:
            tmp = array[i]
            array[i] = array[min_idx]
            array[min_idx] = tmp
            cnt += 1

    print(" ".join(map(str, array)))
    print(cnt) main
def main():
    n = int(input())
    array = [int(x) for x in input().split()]

    cnt = 0
    for i in range(n):
        min_idx = i
        for j in range(i+1, n):
            if array[min_idx] > array[j]:
                min_idx = j
        if min_idx != i:
            tmp = array[i]
            array[i] = array[min_idx]
            array[min_idx] = tmp
            cnt += 1

    print(" ".join(map(str, array)))
    print(cnt)


main()
