def selection_sort(a):
    res = 0
    for i in range(len(a)):
        m = i
        for j in range(i, len(a)):
            if a[m] > a[j]:
                m = j
        if m != i:
            res += 1
            a[i], a[m] = a[m], a[i]
    return res


def main():
    n = int(input())
    a = list(map(int, input().split()))
    ans = selection_sort(a)
    print(' '.join(map(str, a)))
    print(ans)


if __name__ == '__main__':
    main() def selection_sort(a):
    res = 0
    for i in range(len(a)):
        m = i
        for j in range(i, len(a)):
            if a[m] > a[j]:
                m = j
        if m != i:
            res += 1
            a[i], a[m] = a[m], a[i]
    return res selection_sort res = 0 res 0 for i in range(len(a)):
        m = i
        for j in range(i, len(a)):
            if a[m] > a[j]:
                m = j
        if m != i:
            res += 1
            a[i], a[m] = a[m], a[i]
     i range(len(a)) range len(a) len a m = i m i for j in range(i, len(a)):
            if a[m] > a[j]:
                m = j
         j range(i, len(a)) range i len(a) len a if a[m] > a[j]:
                m = j
         a[m] > a[j] a[m] a m a[j] a j m = j m j if m != i:
            res += 1
            a[i], a[m] = a[m], a[i]
     m != i m i res += 1 res 1 a[i], a[m] = a[m], a[i] a[i] a i a[m] a m a[m] a m a[i] a i return res res a a def main():
    n = int(input())
    a = list(map(int, input().split()))
    ans = selection_sort(a)
    print(' '.join(map(str, a)))
    print(ans) main 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 ans = selection_sort(a) ans selection_sort(a) selection_sort a print(' '.join(map(str, a))) print ' '.join(map(str, a)) ' '.join ' ' join map(str, a) map str a print(ans) print ans if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def selection_sort(a):
    res = 0
    for i in range(len(a)):
        m = i
        for j in range(i, len(a)):
            if a[m] > a[j]:
                m = j
        if m != i:
            res += 1
            a[i], a[m] = a[m], a[i]
    return res def selection_sort(a):
    res = 0
    for i in range(len(a)):
        m = i
        for j in range(i, len(a)):
            if a[m] > a[j]:
                m = j
        if m != i:
            res += 1
            a[i], a[m] = a[m], a[i]
    return res selection_sort def main():
    n = int(input())
    a = list(map(int, input().split()))
    ans = selection_sort(a)
    print(' '.join(map(str, a)))
    print(ans) def main():
    n = int(input())
    a = list(map(int, input().split()))
    ans = selection_sort(a)
    print(' '.join(map(str, a)))
    print(ans) main
def selection_sort(a):
    res = 0
    for i in range(len(a)):
        m = i
        for j in range(i, len(a)):
            if a[m] > a[j]:
                m = j
        if m != i:
            res += 1
            a[i], a[m] = a[m], a[i]
    return res


def main():
    n = int(input())
    a = list(map(int, input().split()))
    ans = selection_sort(a)
    print(' '.join(map(str, a)))
    print(ans)


if __name__ == '__main__':
    main()
