def selectionSort(a, n):
    c = 0
    for i in range(n):
        minj = i
        for j in range(i, n):
            if a[j] < a[minj]:
                minj = j
        a[i], a[minj] = a[minj], a[i]
        if minj != i:
            c += 1

    return a, c

if __name__ == "__main__":
    n = int(input())
    a_l = [int(a) for a in input().split()]

    as_l, c = selectionSort(a_l, n)
    print(' '.join(map(str, as_l)))
    print(c) def selectionSort(a, n):
    c = 0
    for i in range(n):
        minj = i
        for j in range(i, n):
            if a[j] < a[minj]:
                minj = j
        a[i], a[minj] = a[minj], a[i]
        if minj != i:
            c += 1

    return a, c selectionSort c = 0 c 0 for i in range(n):
        minj = i
        for j in range(i, n):
            if a[j] < a[minj]:
                minj = j
        a[i], a[minj] = a[minj], a[i]
        if minj != i:
            c += 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 a[i], a[minj] = a[minj], a[i] a[i] a i a[minj] a minj a[minj] a minj a[i] a i if minj != i:
            c += 1

     minj != i minj i c += 1 c 1 return a, c return a, c a c a a n n if __name__ == "__main__":
    n = int(input())
    a_l = [int(a) for a in input().split()]

    as_l, c = selectionSort(a_l, n)
    print(' '.join(map(str, as_l)))
    print(c) __name__ == "__main__" __name__ "__main__" n = int(input()) n int(input()) int input() input int(a) for a in input().split() for a in input().split() a input().split() ().split () input split for a in input().split() int(a) int a a_l = [int(a) for a in input().split()] a_l [int(a) for a in input().split()] as_l, c = selectionSort(a_l, n) as_l selectionSort(a_l, n) selectionSort a_l n c print(' '.join(map(str, as_l))) print ' '.join(map(str, as_l)) ' '.join ' ' join map(str, as_l) map str as_l print(c) print c def selectionSort(a, n):
    c = 0
    for i in range(n):
        minj = i
        for j in range(i, n):
            if a[j] < a[minj]:
                minj = j
        a[i], a[minj] = a[minj], a[i]
        if minj != i:
            c += 1

    return a, c def selectionSort(a, n):
    c = 0
    for i in range(n):
        minj = i
        for j in range(i, n):
            if a[j] < a[minj]:
                minj = j
        a[i], a[minj] = a[minj], a[i]
        if minj != i:
            c += 1

    return a, c selectionSort a_l = [int(a) for a in input().split()] [int(a) for a in input().split()] a_l n = int(input()) int(input()) n c = selectionSort(a_l, n) selectionSort(a_l, n) c as_l, c = selectionSort(a_l, n) selectionSort(a_l, n) as_l
def selectionSort(a, n):
    c = 0
    for i in range(n):
        minj = i
        for j in range(i, n):
            if a[j] < a[minj]:
                minj = j
        a[i], a[minj] = a[minj], a[i]
        if minj != i:
            c += 1

    return a, c

if __name__ == "__main__":
    n = int(input())
    a_l = [int(a) for a in input().split()]

    as_l, c = selectionSort(a_l, n)
    print(' '.join(map(str, as_l)))
    print(c)