# Aizu Problem ALDS_1_2_C: Selection Sort
#
import sys, math, os

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")


def printA(A):
    print(' '.join([str(a) for a in A]))

def selection_sort(A):
    swaps = 0
    for i in range(len(A)):
        mini = i
        for j in range(i, len(A)):
            if A[j] < A[mini]:
                mini = j
        if mini != i:
            swaps += 1
            A[i], A[mini] = A[mini], A[i]
    return A, swaps

        
N = int(input())
A = [int(_) for _ in input().split()]
A, swaps = selection_sort(A)
printA(A)
print(swaps) import sys, math, os sys math os PYDEV = os.environ.get('PYDEV') PYDEV os.environ.get('PYDEV') os.environ.get os.environ os environ get 'PYDEV' if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt") PYDEV=="True" PYDEV "True" sys.stdin = open("sample-input.txt", "rt") sys.stdin sys stdin open("sample-input.txt", "rt") open "sample-input.txt" "rt" def printA(A):
    print(' '.join([str(a) for a in A])) printA str(a) for a in A for a in A a A for a in A str(a) str a print(' '.join([str(a) for a in A])) print ' '.join([str(a) for a in A]) ' '.join ' ' join [str(a) for a in A] A A def selection_sort(A):
    swaps = 0
    for i in range(len(A)):
        mini = i
        for j in range(i, len(A)):
            if A[j] < A[mini]:
                mini = j
        if mini != i:
            swaps += 1
            A[i], A[mini] = A[mini], A[i]
    return A, swaps

         selection_sort swaps = 0 swaps 0 for i in range(len(A)):
        mini = i
        for j in range(i, len(A)):
            if A[j] < A[mini]:
                mini = j
        if mini != i:
            swaps += 1
            A[i], A[mini] = A[mini], A[i]
     i range(len(A)) range len(A) len A mini = i mini i for j in range(i, len(A)):
            if A[j] < A[mini]:
                mini = j
         j range(i, len(A)) range i len(A) len A if A[j] < A[mini]:
                mini = j
         A[j] < A[mini] A[j] A j A[mini] A mini mini = j mini j if mini != i:
            swaps += 1
            A[i], A[mini] = A[mini], A[i]
     mini != i mini i swaps += 1 swaps 1 A[i], A[mini] = A[mini], A[i] A[i] A i A[mini] A mini A[mini] A mini A[i] A i return A, swaps return A, swaps A swaps A A N = int(input()) N int(input()) int input() input int(_) for _ in input().split() for _ in input().split() _ input().split() ().split () input split for _ in input().split() int(_) int _ A = [int(_) for _ in input().split()] A [int(_) for _ in input().split()] A, swaps = selection_sort(A) A selection_sort(A) selection_sort A swaps printA(A) printA A print(swaps) print swaps A = [int(_) for _ in input().split()] [int(_) for _ in input().split()] A N = int(input()) int(input()) N swaps = selection_sort(A) selection_sort(A) swaps def printA(A):
    print(' '.join([str(a) for a in A])) def printA(A):
    print(' '.join([str(a) for a in A])) printA A, swaps = selection_sort(A) selection_sort(A) A PYDEV = os.environ.get('PYDEV') os.environ.get('PYDEV') PYDEV def selection_sort(A):
    swaps = 0
    for i in range(len(A)):
        mini = i
        for j in range(i, len(A)):
            if A[j] < A[mini]:
                mini = j
        if mini != i:
            swaps += 1
            A[i], A[mini] = A[mini], A[i]
    return A, swaps

         def selection_sort(A):
    swaps = 0
    for i in range(len(A)):
        mini = i
        for j in range(i, len(A)):
            if A[j] < A[mini]:
                mini = j
        if mini != i:
            swaps += 1
            A[i], A[mini] = A[mini], A[i]
    return A, swaps

         selection_sort
# Aizu Problem ALDS_1_2_C: Selection Sort
#
import sys, math, os

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")


def printA(A):
    print(' '.join([str(a) for a in A]))

def selection_sort(A):
    swaps = 0
    for i in range(len(A)):
        mini = i
        for j in range(i, len(A)):
            if A[j] < A[mini]:
                mini = j
        if mini != i:
            swaps += 1
            A[i], A[mini] = A[mini], A[i]
    return A, swaps

        
N = int(input())
A = [int(_) for _ in input().split()]
A, swaps = selection_sort(A)
printA(A)
print(swaps)