#coding:UTF-8
def SS(N,A):
    count=0
    for i in range(N):
        minj = i
        for j in range(i,N):
            if A[j]<A[minj]:
                minj=j
        if i!=minj:
            count+=1
            swap=A[i]
            A[i]=A[minj]
            A[minj]=swap
    for i in range(len(A)):
        A[i]=str(A[i])
    print(" ".join(A))
    print(count)

if __name__=="__main__":
    N=int(input())
    a=input()
    A=a.split(" ")
    for i in range(len(A)):
        A[i]=int(A[i])
    SS(N,A) def SS(N,A):
    count=0
    for i in range(N):
        minj = i
        for j in range(i,N):
            if A[j]<A[minj]:
                minj=j
        if i!=minj:
            count+=1
            swap=A[i]
            A[i]=A[minj]
            A[minj]=swap
    for i in range(len(A)):
        A[i]=str(A[i])
    print(" ".join(A))
    print(count) SS 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 i!=minj:
            count+=1
            swap=A[i]
            A[i]=A[minj]
            A[minj]=swap
     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 i!=minj:
            count+=1
            swap=A[i]
            A[i]=A[minj]
            A[minj]=swap
     i!=minj i minj count+=1 count 1 swap=A[i] swap A[i] A i A[i]=A[minj] A[i] A i A[minj] A minj A[minj]=swap A[minj] A minj swap for i in range(len(A)):
        A[i]=str(A[i])
     i range(len(A)) range len(A) len A A[i]=str(A[i]) A[i] A i str(A[i]) str A[i] A i print(" ".join(A)) print " ".join(A) " ".join " " join A print(count) print count N N A A if __name__=="__main__":
    N=int(input())
    a=input()
    A=a.split(" ")
    for i in range(len(A)):
        A[i]=int(A[i])
    SS(N,A) __name__=="__main__" __name__ "__main__" N=int(input()) N int(input()) int input() input a=input() a input() input A=a.split(" ") A a.split(" ") a.split a split " " for i in range(len(A)):
        A[i]=int(A[i])
     i range(len(A)) range len(A) len A A[i]=int(A[i]) A[i] A i int(A[i]) int A[i] A i SS(N,A) SS N A N=int(input()) int(input()) N a=input() input() a A=a.split(" ") a.split(" ") A def SS(N,A):
    count=0
    for i in range(N):
        minj = i
        for j in range(i,N):
            if A[j]<A[minj]:
                minj=j
        if i!=minj:
            count+=1
            swap=A[i]
            A[i]=A[minj]
            A[minj]=swap
    for i in range(len(A)):
        A[i]=str(A[i])
    print(" ".join(A))
    print(count) def SS(N,A):
    count=0
    for i in range(N):
        minj = i
        for j in range(i,N):
            if A[j]<A[minj]:
                minj=j
        if i!=minj:
            count+=1
            swap=A[i]
            A[i]=A[minj]
            A[minj]=swap
    for i in range(len(A)):
        A[i]=str(A[i])
    print(" ".join(A))
    print(count) SS
#coding:UTF-8
def SS(N,A):
    count=0
    for i in range(N):
        minj = i
        for j in range(i,N):
            if A[j]<A[minj]:
                minj=j
        if i!=minj:
            count+=1
            swap=A[i]
            A[i]=A[minj]
            A[minj]=swap
    for i in range(len(A)):
        A[i]=str(A[i])
    print(" ".join(A))
    print(count)

if __name__=="__main__":
    N=int(input())
    a=input()
    A=a.split(" ")
    for i in range(len(A)):
        A[i]=int(A[i])
    SS(N,A)