import sys

def selection_sort(x):
    count = 0
    for i in range(0,len(l)-1):
        mini = i
        for j in range(i+1,len(l)):
            if(x[j] < x[mini]):
                mini = j
        if(mini != i):
            count += 1
            temp = x[i]
            x[i] = x[mini]
            x[mini] = temp
    for data in x:
        print data,
    print
    print count


l = []
for input in sys.stdin:
    l.append(input)
l = l[1:]
l = l[0].split()
for i in range(0,len(l)):
    l[i] = int(l[i])
selection_sort(l) import sys sys def selection_sort(x):
    count = 0
    for i in range(0,len(l)-1):
        mini = i
        for j in range(i+1,len(l)):
            if(x[j] < x[mini]):
                mini = j
        if(mini != i):
            count += 1
            temp = x[i]
            x[i] = x[mini]
            x[mini] = temp
    for data in x:
        print data,
    print
    print count selection_sort count = 0 count 0 for i in range(0,len(l)-1):
        mini = i
        for j in range(i+1,len(l)):
            if(x[j] < x[mini]):
                mini = j
        if(mini != i):
            count += 1
            temp = x[i]
            x[i] = x[mini]
            x[mini] = temp
     i range(0,len(l)-1) range 0 len(l)-1 len(l) len l 1 mini = i mini i for j in range(i+1,len(l)):
            if(x[j] < x[mini]):
                mini = j
         j range(i+1,len(l)) range i+1 i 1 len(l) len l if(x[j] < x[mini]):
                mini = j
         x[j] < x[mini] x[j] x j x[mini] x mini mini = j mini j if(mini != i):
            count += 1
            temp = x[i]
            x[i] = x[mini]
            x[mini] = temp
     mini != i mini i count += 1 count 1 temp = x[i] temp x[i] x i x[i] = x[mini] x[i] x i x[mini] x mini x[mini] = temp x[mini] x mini temp for data in x:
        print data,
     data x print data print print x x l = [] l [] for input in sys.stdin:
    l.append(input) input sys.stdin sys stdin l.append(input) l.append l append input l = l[1:] l l[1:] l 1: 1 l = l[0].split() l l[0].split() [0].split [0] l 0 split for i in range(0,len(l)):
    l[i] = int(l[i]) i range(0,len(l)) range 0 len(l) len l l[i] = int(l[i]) l[i] l i int(l[i]) int l[i] l i selection_sort(l) selection_sort l l = l[0].split() l[0].split() l def selection_sort(x):
    count = 0
    for i in range(0,len(l)-1):
        mini = i
        for j in range(i+1,len(l)):
            if(x[j] < x[mini]):
                mini = j
        if(mini != i):
            count += 1
            temp = x[i]
            x[i] = x[mini]
            x[mini] = temp
    for data in x:
        print data,
    print
    print count def selection_sort(x):
    count = 0
    for i in range(0,len(l)-1):
        mini = i
        for j in range(i+1,len(l)):
            if(x[j] < x[mini]):
                mini = j
        if(mini != i):
            count += 1
            temp = x[i]
            x[i] = x[mini]
            x[mini] = temp
    for data in x:
        print data,
    print
    print count selection_sort l = [] [] l l = l[1:] l[1:] l
import sys

def selection_sort(x):
    count = 0
    for i in range(0,len(l)-1):
        mini = i
        for j in range(i+1,len(l)):
            if(x[j] < x[mini]):
                mini = j
        if(mini != i):
            count += 1
            temp = x[i]
            x[i] = x[mini]
            x[mini] = temp
    for data in x:
        print data,
    print
    print count


l = []
for input in sys.stdin:
    l.append(input)
l = l[1:]
l = l[0].split()
for i in range(0,len(l)):
    l[i] = int(l[i])
selection_sort(l)
