def selectionSort(a,n):
    cnt = 0
    for i in range(n-1):
        minj = i
        for j in range(i+1,n):
            if a[j] < a[minj]:
                minj = j

        if i != minj: 
            temp = a[minj]
            a[minj] = a[i]
            a[i] = temp
            cnt += 1
    print(" ".join(map(str,a)))
    print(cnt)

n = int(input())
a = list(map(int,input().split()))

selectionSort(a,n) def selectionSort(a,n):
    cnt = 0
    for i in range(n-1):
        minj = i
        for j in range(i+1,n):
            if a[j] < a[minj]:
                minj = j

        if i != minj: 
            temp = a[minj]
            a[minj] = a[i]
            a[i] = temp
            cnt += 1
    print(" ".join(map(str,a)))
    print(cnt) selectionSort cnt = 0 cnt 0 for i in range(n-1):
        minj = i
        for j in range(i+1,n):
            if a[j] < a[minj]:
                minj = j

        if i != minj: 
            temp = a[minj]
            a[minj] = a[i]
            a[i] = temp
            cnt += 1
     i range(n-1) range n-1 n 1 minj = i minj i for j in range(i+1,n):
            if a[j] < a[minj]:
                minj = j

         j range(i+1,n) range i+1 i 1 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 i != minj: 
            temp = a[minj]
            a[minj] = a[i]
            a[i] = temp
            cnt += 1
     i != minj i minj temp = a[minj] temp a[minj] a minj a[minj] = a[i] a[minj] a minj a[i] a i a[i] = temp a[i] a i temp cnt += 1 cnt 1 print(" ".join(map(str,a))) print " ".join(map(str,a)) " ".join " " join map(str,a) map str a print(cnt) print cnt 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 selectionSort(a,n) selectionSort a n a = list(map(int,input().split())) list(map(int,input().split())) a def selectionSort(a,n):
    cnt = 0
    for i in range(n-1):
        minj = i
        for j in range(i+1,n):
            if a[j] < a[minj]:
                minj = j

        if i != minj: 
            temp = a[minj]
            a[minj] = a[i]
            a[i] = temp
            cnt += 1
    print(" ".join(map(str,a)))
    print(cnt) def selectionSort(a,n):
    cnt = 0
    for i in range(n-1):
        minj = i
        for j in range(i+1,n):
            if a[j] < a[minj]:
                minj = j

        if i != minj: 
            temp = a[minj]
            a[minj] = a[i]
            a[i] = temp
            cnt += 1
    print(" ".join(map(str,a)))
    print(cnt) selectionSort n = int(input()) int(input()) n
def selectionSort(a,n):
    cnt = 0
    for i in range(n-1):
        minj = i
        for j in range(i+1,n):
            if a[j] < a[minj]:
                minj = j

        if i != minj: 
            temp = a[minj]
            a[minj] = a[i]
            a[i] = temp
            cnt += 1
    print(" ".join(map(str,a)))
    print(cnt)

n = int(input())
a = list(map(int,input().split()))

selectionSort(a,n)