import sys

lines = sys.stdin.readlines()

N = lines[0]
A = lines[1].strip().split(" ")

count = 0
for i in range(len(A)):
    minj = i
    for j in range(i, len(A)):
        if int(A[j]) < int(A[minj]):
            minj = j
    if i != minj:
        a = A[i]
        b = A[minj]
        A[i] = b
        A[minj] = a
        count += 1

print " ".join(A)
print count import sys sys lines = sys.stdin.readlines() lines sys.stdin.readlines() sys.stdin.readlines sys.stdin sys stdin readlines N = lines[0] N lines[0] lines 0 A = lines[1].strip().split(" ") A lines[1].strip().split(" ") [1].strip().split [1].strip() [1].strip [1] lines 1 strip split " " count = 0 count 0 for i in range(len(A)):
    minj = i
    for j in range(i, len(A)):
        if int(A[j]) < int(A[minj]):
            minj = j
    if i != minj:
        a = A[i]
        b = A[minj]
        A[i] = b
        A[minj] = a
        count += 1 i range(len(A)) range len(A) len A minj = i minj i for j in range(i, len(A)):
        if int(A[j]) < int(A[minj]):
            minj = j
     j range(i, len(A)) range i len(A) len A if int(A[j]) < int(A[minj]):
            minj = j
     int(A[j]) < int(A[minj]) int(A[j]) int A[j] A j int(A[minj]) int A[minj] A minj minj = j minj j if i != minj:
        a = A[i]
        b = A[minj]
        A[i] = b
        A[minj] = a
        count += 1 i != minj i minj a = A[i] a A[i] A i b = A[minj] b A[minj] A minj A[i] = b A[i] A i b A[minj] = a A[minj] A minj a count += 1 count 1 print " ".join(A) " ".join " " join A print b = A[minj] A[minj] b a = A[i] A[i] a count = 0 0 count minj = i i minj minj = j j minj A = lines[1].strip().split(" ") lines[1].strip().split(" ") A count += 1 1 count lines = sys.stdin.readlines() sys.stdin.readlines() lines N = lines[0] lines[0] N
import sys

lines = sys.stdin.readlines()

N = lines[0]
A = lines[1].strip().split(" ")

count = 0
for i in range(len(A)):
    minj = i
    for j in range(i, len(A)):
        if int(A[j]) < int(A[minj]):
            minj = j
    if i != minj:
        a = A[i]
        b = A[minj]
        A[i] = b
        A[minj] = a
        count += 1

print " ".join(A)
print count