#!/usr/bin/env python
# -*- coding: utf-8 -*-


def print_array(a):
    print(" ".join(map(str, a)))


def selectionsort(arr, n):
    a = arr[:]
    s = 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])
            s += 1
    return (a, s)


def main():
    n = int(input())
    arr = list(map(int, input().split()))
    (a, s) = selectionsort(arr, n)
    print_array(a)
    print(s)


if __name__ == "__main__":
    main() def print_array(a):
    print(" ".join(map(str, a))) print_array print(" ".join(map(str, a))) print " ".join(map(str, a)) " ".join " " join map(str, a) map str a a a def selectionsort(arr, n):
    a = arr[:]
    s = 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])
            s += 1
    return (a, s) selectionsort a = arr[:] a arr[:] arr : s = 0 s 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])
            s += 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])
            s += 1
     i != minj i minj (a[i], a[minj]) = (a[minj], a[i]) (a[i], a[minj]) a[i] a i a[minj] a minj (a[minj], a[i]) a[minj] a minj a[i] a i s += 1 s 1 return (a, s) (a, s) a s arr arr n n def main():
    n = int(input())
    arr = list(map(int, input().split()))
    (a, s) = selectionsort(arr, n)
    print_array(a)
    print(s) main n = int(input()) n int(input()) int input() input arr = list(map(int, input().split())) arr list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split (a, s) = selectionsort(arr, n) (a, s) a s selectionsort(arr, n) selectionsort arr n print_array(a) print_array a print(s) print s if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def print_array(a):
    print(" ".join(map(str, a))) def print_array(a):
    print(" ".join(map(str, a))) print_array def selectionsort(arr, n):
    a = arr[:]
    s = 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])
            s += 1
    return (a, s) def selectionsort(arr, n):
    a = arr[:]
    s = 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])
            s += 1
    return (a, s) selectionsort def main():
    n = int(input())
    arr = list(map(int, input().split()))
    (a, s) = selectionsort(arr, n)
    print_array(a)
    print(s) def main():
    n = int(input())
    arr = list(map(int, input().split()))
    (a, s) = selectionsort(arr, n)
    print_array(a)
    print(s) main
#!/usr/bin/env python
# -*- coding: utf-8 -*-


def print_array(a):
    print(" ".join(map(str, a)))


def selectionsort(arr, n):
    a = arr[:]
    s = 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])
            s += 1
    return (a, s)


def main():
    n = int(input())
    arr = list(map(int, input().split()))
    (a, s) = selectionsort(arr, n)
    print_array(a)
    print(s)


if __name__ == "__main__":
    main()