# -*- coding: utf-8 -*-


def selection_sort(seq, l):
    cnt = 0

    for head_i in range(l):
        flag = False

        min_i = head_i
        for target_i in range(head_i+1, l):
            if seq[target_i] < seq[min_i]:
                min_i = target_i
                flag = True
        if flag:
            seq[head_i], seq[min_i] = seq[min_i], seq[head_i]
            cnt += 1

    print(' '.join([str(n) for n in seq]))
    print(cnt)


def to_int(v):
    return int(v)


def to_seq(v):
    return [int(c) for c in v.split()]


if __name__ == '__main__':
    l = to_int(input())
    seq = to_seq(input())

    selection_sort(seq, l) def selection_sort(seq, l):
    cnt = 0

    for head_i in range(l):
        flag = False

        min_i = head_i
        for target_i in range(head_i+1, l):
            if seq[target_i] < seq[min_i]:
                min_i = target_i
                flag = True
        if flag:
            seq[head_i], seq[min_i] = seq[min_i], seq[head_i]
            cnt += 1

    print(' '.join([str(n) for n in seq]))
    print(cnt) selection_sort cnt = 0 cnt 0 for head_i in range(l):
        flag = False

        min_i = head_i
        for target_i in range(head_i+1, l):
            if seq[target_i] < seq[min_i]:
                min_i = target_i
                flag = True
        if flag:
            seq[head_i], seq[min_i] = seq[min_i], seq[head_i]
            cnt += 1

     head_i range(l) range l flag = False flag False min_i = head_i min_i head_i for target_i in range(head_i+1, l):
            if seq[target_i] < seq[min_i]:
                min_i = target_i
                flag = True
         target_i range(head_i+1, l) range head_i+1 head_i 1 l if seq[target_i] < seq[min_i]:
                min_i = target_i
                flag = True
         seq[target_i] < seq[min_i] seq[target_i] seq target_i seq[min_i] seq min_i min_i = target_i min_i target_i flag = True flag True if flag:
            seq[head_i], seq[min_i] = seq[min_i], seq[head_i]
            cnt += 1

     flag seq[head_i], seq[min_i] = seq[min_i], seq[head_i] seq[head_i] seq head_i seq[min_i] seq min_i seq[min_i] seq min_i seq[head_i] seq head_i cnt += 1 cnt 1 str(n) for n in seq for n in seq n seq for n in seq str(n) str n print(' '.join([str(n) for n in seq])) print ' '.join([str(n) for n in seq]) ' '.join ' ' join [str(n) for n in seq] print(cnt) print cnt seq seq l l def to_int(v):
    return int(v) to_int return int(v) int(v) int v v v def to_seq(v):
    return [int(c) for c in v.split()] to_seq int(c) for c in v.split() for c in v.split() c v.split() v.split v split for c in v.split() int(c) int c return [int(c) for c in v.split()] [int(c) for c in v.split()] v v if __name__ == '__main__':
    l = to_int(input())
    seq = to_seq(input())

    selection_sort(seq, l) __name__ == '__main__' __name__ '__main__' l = to_int(input()) l to_int(input()) to_int input() input seq = to_seq(input()) seq to_seq(input()) to_seq input() input selection_sort(seq, l) selection_sort seq l seq = to_seq(input()) to_seq(input()) seq def to_seq(v):
    return [int(c) for c in v.split()] def to_seq(v):
    return [int(c) for c in v.split()] to_seq l = to_int(input()) to_int(input()) l def to_int(v):
    return int(v) def to_int(v):
    return int(v) to_int def selection_sort(seq, l):
    cnt = 0

    for head_i in range(l):
        flag = False

        min_i = head_i
        for target_i in range(head_i+1, l):
            if seq[target_i] < seq[min_i]:
                min_i = target_i
                flag = True
        if flag:
            seq[head_i], seq[min_i] = seq[min_i], seq[head_i]
            cnt += 1

    print(' '.join([str(n) for n in seq]))
    print(cnt) def selection_sort(seq, l):
    cnt = 0

    for head_i in range(l):
        flag = False

        min_i = head_i
        for target_i in range(head_i+1, l):
            if seq[target_i] < seq[min_i]:
                min_i = target_i
                flag = True
        if flag:
            seq[head_i], seq[min_i] = seq[min_i], seq[head_i]
            cnt += 1

    print(' '.join([str(n) for n in seq]))
    print(cnt) selection_sort
# -*- coding: utf-8 -*-


def selection_sort(seq, l):
    cnt = 0

    for head_i in range(l):
        flag = False

        min_i = head_i
        for target_i in range(head_i+1, l):
            if seq[target_i] < seq[min_i]:
                min_i = target_i
                flag = True
        if flag:
            seq[head_i], seq[min_i] = seq[min_i], seq[head_i]
            cnt += 1

    print(' '.join([str(n) for n in seq]))
    print(cnt)


def to_int(v):
    return int(v)


def to_seq(v):
    return [int(c) for c in v.split()]


if __name__ == '__main__':
    l = to_int(input())
    seq = to_seq(input())

    selection_sort(seq, l)