def pretty_sequence(sequence):
    n = len(sequence)
    for i in range(n-1):
        print(format(sequence[i]) + ' ', end='')
    print(sequence[n - 1])

n = int(input())
sequence = [int(x) for x in input().split(' ')]


def selectionsort(seq, x):
    count = 0
    for i in range(x):
        minj = i
        for j in range(i, x):
            if seq[j] < seq[minj]:
                minj = j
        if seq[i] != seq[minj]:
            tmp_val = seq[i]
            seq[i] = seq[minj]
            seq[minj] = tmp_val
            count += 1
    return seq, count

sequence, count = selectionsort(sequence, n)
pretty_sequence(sequence)
print(count) def pretty_sequence(sequence):
    n = len(sequence)
    for i in range(n-1):
        print(format(sequence[i]) + ' ', end='')
    print(sequence[n - 1]) pretty_sequence n = len(sequence) n len(sequence) len sequence for i in range(n-1):
        print(format(sequence[i]) + ' ', end='')
     i range(n-1) range n-1 n 1 print(format(sequence[i]) + ' ', end='') print format(sequence[i]) + ' ' format(sequence[i]) format sequence[i] sequence i ' ' end='' end '' print(sequence[n - 1]) print sequence[n - 1] sequence n - 1 n 1 sequence sequence 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 sequence = [int(x) for x in input().split(' ')] sequence [int(x) for x in input().split(' ')] def selectionsort(seq, x):
    count = 0
    for i in range(x):
        minj = i
        for j in range(i, x):
            if seq[j] < seq[minj]:
                minj = j
        if seq[i] != seq[minj]:
            tmp_val = seq[i]
            seq[i] = seq[minj]
            seq[minj] = tmp_val
            count += 1
    return seq, count selectionsort count = 0 count 0 for i in range(x):
        minj = i
        for j in range(i, x):
            if seq[j] < seq[minj]:
                minj = j
        if seq[i] != seq[minj]:
            tmp_val = seq[i]
            seq[i] = seq[minj]
            seq[minj] = tmp_val
            count += 1
     i range(x) range x minj = i minj i for j in range(i, x):
            if seq[j] < seq[minj]:
                minj = j
         j range(i, x) range i x if seq[j] < seq[minj]:
                minj = j
         seq[j] < seq[minj] seq[j] seq j seq[minj] seq minj minj = j minj j if seq[i] != seq[minj]:
            tmp_val = seq[i]
            seq[i] = seq[minj]
            seq[minj] = tmp_val
            count += 1
     seq[i] != seq[minj] seq[i] seq i seq[minj] seq minj tmp_val = seq[i] tmp_val seq[i] seq i seq[i] = seq[minj] seq[i] seq i seq[minj] seq minj seq[minj] = tmp_val seq[minj] seq minj tmp_val count += 1 count 1 return seq, count return seq, count seq count seq seq x x sequence, count = selectionsort(sequence, n) sequence selectionsort(sequence, n) selectionsort sequence n count pretty_sequence(sequence) pretty_sequence sequence print(count) print count def selectionsort(seq, x):
    count = 0
    for i in range(x):
        minj = i
        for j in range(i, x):
            if seq[j] < seq[minj]:
                minj = j
        if seq[i] != seq[minj]:
            tmp_val = seq[i]
            seq[i] = seq[minj]
            seq[minj] = tmp_val
            count += 1
    return seq, count def selectionsort(seq, x):
    count = 0
    for i in range(x):
        minj = i
        for j in range(i, x):
            if seq[j] < seq[minj]:
                minj = j
        if seq[i] != seq[minj]:
            tmp_val = seq[i]
            seq[i] = seq[minj]
            seq[minj] = tmp_val
            count += 1
    return seq, count selectionsort sequence, count = selectionsort(sequence, n) selectionsort(sequence, n) sequence count = selectionsort(sequence, n) selectionsort(sequence, n) count n = int(input()) int(input()) n sequence = [int(x) for x in input().split(' ')] [int(x) for x in input().split(' ')] sequence def pretty_sequence(sequence):
    n = len(sequence)
    for i in range(n-1):
        print(format(sequence[i]) + ' ', end='')
    print(sequence[n - 1]) def pretty_sequence(sequence):
    n = len(sequence)
    for i in range(n-1):
        print(format(sequence[i]) + ' ', end='')
    print(sequence[n - 1]) pretty_sequence
def pretty_sequence(sequence):
    n = len(sequence)
    for i in range(n-1):
        print(format(sequence[i]) + ' ', end='')
    print(sequence[n - 1])

n = int(input())
sequence = [int(x) for x in input().split(' ')]


def selectionsort(seq, x):
    count = 0
    for i in range(x):
        minj = i
        for j in range(i, x):
            if seq[j] < seq[minj]:
                minj = j
        if seq[i] != seq[minj]:
            tmp_val = seq[i]
            seq[i] = seq[minj]
            seq[minj] = tmp_val
            count += 1
    return seq, count

sequence, count = selectionsort(sequence, n)
pretty_sequence(sequence)
print(count)