# -*- coding: utf-8 -*-
"""
Created on Sun Jun 18 09:48:56 2017

@author: syaga
"""

if __name__ == "__main__":
    N = int(input())
    A = list(map(int, input().split()))
    num = 0
    for i in range(0, N):
        minj = i
        for j in range(i, N):
            if A[j] < A[minj]:
                minj = j
        temp = A[i]
        A[i] = A[minj]
        A[minj] = temp
        if minj != i:
            num += 1
    print(" ".join(map(str, A)))
    print(num) """
Created on Sun Jun 18 09:48:56 2017

@author: syaga
""" if __name__ == "__main__":
    N = int(input())
    A = list(map(int, input().split()))
    num = 0
    for i in range(0, N):
        minj = i
        for j in range(i, N):
            if A[j] < A[minj]:
                minj = j
        temp = A[i]
        A[i] = A[minj]
        A[minj] = temp
        if minj != i:
            num += 1
    print(" ".join(map(str, A)))
    print(num) __name__ == "__main__" __name__ "__main__" 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 num = 0 num 0 for i in range(0, N):
        minj = i
        for j in range(i, N):
            if A[j] < A[minj]:
                minj = j
        temp = A[i]
        A[i] = A[minj]
        A[minj] = temp
        if minj != i:
            num += 1
     i range(0, N) range 0 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 temp = A[i] temp A[i] A i A[i] = A[minj] A[i] A i A[minj] A minj A[minj] = temp A[minj] A minj temp if minj != i:
            num += 1
     minj != i minj i num += 1 num 1 print(" ".join(map(str, A))) print " ".join(map(str, A)) " ".join " " join map(str, A) map str A print(num) print num N = int(input()) int(input()) N minj = j j minj num = 0 0 num num += 1 1 num minj = i i minj temp = A[i] A[i] temp A = list(map(int, input().split())) list(map(int, input().split())) A
# -*- coding: utf-8 -*-
"""
Created on Sun Jun 18 09:48:56 2017

@author: syaga
"""

if __name__ == "__main__":
    N = int(input())
    A = list(map(int, input().split()))
    num = 0
    for i in range(0, N):
        minj = i
        for j in range(i, N):
            if A[j] < A[minj]:
                minj = j
        temp = A[i]
        A[i] = A[minj]
        A[minj] = temp
        if minj != i:
            num += 1
    print(" ".join(map(str, A)))
    print(num)