def selectionSort(a,n):
    count = 0
    for i in range(n):
        minj = i
        for j in range(i, n):
            if(a[j] < a[minj]):
                minj = j
        if(minj != i):
            count += 1
        a[i], a[minj] = a[minj], a[i]
    return [a, count]
n = int(input())
a = list(map(int,input().split(' ')))
sa , c = selectionSort(a, n)
str = " ".join([str(i) for i in sa])
print("{}\n{}".format(str,c)) def selectionSort(a,n):
    count = 0
    for i in range(n):
        minj = i
        for j in range(i, n):
            if(a[j] < a[minj]):
                minj = j
        if(minj != i):
            count += 1
        a[i], a[minj] = a[minj], a[i]
    return [a, count] selectionSort count = 0 count 0 for i in range(n):
        minj = i
        for j in range(i, n):
            if(a[j] < a[minj]):
                minj = j
        if(minj != i):
            count += 1
        a[i], a[minj] = a[minj], a[i]
     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 if(minj != i):
            count += 1
         minj != i minj i count += 1 count 1 a[i], a[minj] = a[minj], a[i] a[i] a i a[minj] a minj a[minj] a minj a[i] a i return [a, count] [a, count] a count a a n n 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 ' ' sa , c = selectionSort(a, n) sa selectionSort(a, n) selectionSort a n c str(i) for i in sa for i in sa i sa for i in sa str(i) str i str = " ".join([str(i) for i in sa]) str " ".join([str(i) for i in sa]) " ".join " " join [str(i) for i in sa] print("{}\n{}".format(str,c)) print "{}\n{}".format(str,c) "{}\n{}".format "{}\n{}" format str c c = selectionSort(a, n) selectionSort(a, n) c n = int(input()) int(input()) n sa , c = selectionSort(a, n) selectionSort(a, n) sa def selectionSort(a,n):
    count = 0
    for i in range(n):
        minj = i
        for j in range(i, n):
            if(a[j] < a[minj]):
                minj = j
        if(minj != i):
            count += 1
        a[i], a[minj] = a[minj], a[i]
    return [a, count] def selectionSort(a,n):
    count = 0
    for i in range(n):
        minj = i
        for j in range(i, n):
            if(a[j] < a[minj]):
                minj = j
        if(minj != i):
            count += 1
        a[i], a[minj] = a[minj], a[i]
    return [a, count] selectionSort a = list(map(int,input().split(' '))) list(map(int,input().split(' '))) a str = " ".join([str(i) for i in sa]) " ".join([str(i) for i in sa]) str
def selectionSort(a,n):
    count = 0
    for i in range(n):
        minj = i
        for j in range(i, n):
            if(a[j] < a[minj]):
                minj = j
        if(minj != i):
            count += 1
        a[i], a[minj] = a[minj], a[i]
    return [a, count]
n = int(input())
a = list(map(int,input().split(' ')))
sa , c = selectionSort(a, n)
str = " ".join([str(i) for i in sa])
print("{}\n{}".format(str,c))
