n = int(input())

A = list(map(int, input().split()))

count = 0
def swap(a, b):
    t = a
    a = b
    b = t
    return [a, b]

def selection_sort(l):
    global count
    for i in range(0, len(l)):
        mini = i
        for j in range(i, len(l)):
            if l[j] < l[mini]:
                mini = j
        if i != mini:
            count += 1
        l[i], l[mini] = swap(l[i], l[mini])
    return l

l = selection_sort(A)
print(' '.join(str(x) for x in l))
print(count) 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 count = 0 count 0 def swap(a, b):
    t = a
    a = b
    b = t
    return [a, b] swap t = a t a a = b a b b = t b t return [a, b] [a, b] a b a a b b def selection_sort(l):
    global count
    for i in range(0, len(l)):
        mini = i
        for j in range(i, len(l)):
            if l[j] < l[mini]:
                mini = j
        if i != mini:
            count += 1
        l[i], l[mini] = swap(l[i], l[mini])
    return l selection_sort global count for i in range(0, len(l)):
        mini = i
        for j in range(i, len(l)):
            if l[j] < l[mini]:
                mini = j
        if i != mini:
            count += 1
        l[i], l[mini] = swap(l[i], l[mini])
     i range(0, len(l)) range 0 len(l) len l mini = i mini i for j in range(i, len(l)):
            if l[j] < l[mini]:
                mini = j
         j range(i, len(l)) range i len(l) len l if l[j] < l[mini]:
                mini = j
         l[j] < l[mini] l[j] l j l[mini] l mini mini = j mini j if i != mini:
            count += 1
         i != mini i mini count += 1 count 1 l[i], l[mini] = swap(l[i], l[mini]) l[i] l i swap(l[i], l[mini]) swap l[i] l i l[mini] l mini l[mini] l mini return l l l l l = selection_sort(A) l selection_sort(A) selection_sort A print(' '.join(str(x) for x in l)) print ' '.join(str(x) for x in l) ' '.join ' ' join str(x) str x print(count) print count n = int(input()) int(input()) n def selection_sort(l):
    global count
    for i in range(0, len(l)):
        mini = i
        for j in range(i, len(l)):
            if l[j] < l[mini]:
                mini = j
        if i != mini:
            count += 1
        l[i], l[mini] = swap(l[i], l[mini])
    return l def selection_sort(l):
    global count
    for i in range(0, len(l)):
        mini = i
        for j in range(i, len(l)):
            if l[j] < l[mini]:
                mini = j
        if i != mini:
            count += 1
        l[i], l[mini] = swap(l[i], l[mini])
    return l selection_sort count = 0 0 count def swap(a, b):
    t = a
    a = b
    b = t
    return [a, b] def swap(a, b):
    t = a
    a = b
    b = t
    return [a, b] swap l = selection_sort(A) selection_sort(A) l A = list(map(int, input().split())) list(map(int, input().split())) A
n = int(input())

A = list(map(int, input().split()))

count = 0
def swap(a, b):
    t = a
    a = b
    b = t
    return [a, b]

def selection_sort(l):
    global count
    for i in range(0, len(l)):
        mini = i
        for j in range(i, len(l)):
            if l[j] < l[mini]:
                mini = j
        if i != mini:
            count += 1
        l[i], l[mini] = swap(l[i], l[mini])
    return l

l = selection_sort(A)
print(' '.join(str(x) for x in l))
print(count)